1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-19 20:57:53 +02:00

Merge pull request #335 from matthewmueller/fix/rpm

fix RPM cross-compiling (OSX => amazonlinux/CentOS)
This commit is contained in:
Carlos Alexandro Becker 2017-08-18 18:42:44 -03:00 committed by GitHub
commit 683c019bc1

View File

@ -46,7 +46,7 @@ func (Pipe) Run(ctx *context.Context) error {
arch := archFor(platform) arch := archFor(platform)
for folder, binaries := range groups { for folder, binaries := range groups {
g.Go(func() error { 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" 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 path = filepath.Join(ctx.Config.Dist, folder)
var file = path + "." + format var file = path + "." + format
log.WithField("file", file).Info("creating fpm archive") 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) 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 { for _, binary := range binaries {
// This basically tells fpm to put the binary in the /usr/local/bin // This basically tells fpm to put the binary in the /usr/local/bin
// binary=/usr/local/bin/binary // binary=/usr/local/bin/binary