1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

fix RPM cross-compiling (OSX => amazonlinux/CentOS)

This commit is contained in:
Matthew 2017-08-17 14:29:32 +07:00
parent 658d46397f
commit 164af46838

View File

@ -46,7 +46,7 @@ func (Pipe) Run(ctx *context.Context) error {
arch := archFor(platform)
for folder, binaries := range groups {
g.Go(func() error {
return create(ctx, format, folder, arch, binaries)
return create(ctx, format, folder, arch, platform, binaries)
})
}
}
@ -61,7 +61,7 @@ func archFor(key string) string {
return "x86_64"
}
func create(ctx *context.Context, format, folder, arch string, binaries []context.Binary) error {
func create(ctx *context.Context, format, folder, arch, platform string, binaries []context.Binary) error {
var path = filepath.Join(ctx.Config.Dist, folder)
var file = path + "." + format
log.WithField("file", file).Info("creating fpm archive")
@ -99,6 +99,11 @@ func create(ctx *context.Context, format, folder, arch string, binaries []contex
options = append(options, "--conflicts", conflict)
}
// FPM requires --rpm-os=linux if your rpm target is linux
if format == "rpm" && strings.Contains(platform, "linux") {
options = append(options, "--rpm-os", "linux")
}
for _, binary := range binaries {
// This basically tells fpm to put the binary in the /usr/local/bin
// binary=/usr/local/bin/binary