mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
feat(nfpm): better support aix (#5075)
building upon the great work done at #4898 closes #4898 --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> Co-authored-by: Dylan Myers <dylan.myers@bluemedora.com>
This commit is contained in:
parent
11aa7cfceb
commit
5b87a85ee0
@ -105,6 +105,7 @@ func doRun(ctx *context.Context, fpm config.NFPM) error {
|
||||
artifact.ByGoos("linux"),
|
||||
artifact.ByGoos("ios"),
|
||||
artifact.ByGoos("android"),
|
||||
artifact.ByGoos("aix"),
|
||||
),
|
||||
}
|
||||
if len(fpm.Builds) > 0 {
|
||||
@ -114,7 +115,7 @@ func doRun(ctx *context.Context, fpm config.NFPM) error {
|
||||
Filter(artifact.And(filters...)).
|
||||
GroupByPlatform()
|
||||
if len(linuxBinaries) == 0 {
|
||||
return fmt.Errorf("no linux binaries found for builds %v", fpm.Builds)
|
||||
return fmt.Errorf("no linux/unix binaries found for builds %v", fpm.Builds)
|
||||
}
|
||||
g := semerrgroup.New(ctx.Parallelism)
|
||||
for _, format := range fpm.Formats {
|
||||
@ -191,6 +192,30 @@ func create(ctx *context.Context, fpm config.NFPM, format string, artifacts []*a
|
||||
}
|
||||
}
|
||||
|
||||
// AIX is weird, so we default to 7.2 as the earliest release
|
||||
// that supports golang. This can be overridden by setting platform
|
||||
// in your .goreleaser.yaml. See the following:
|
||||
// https://www.unix.com/aix/266963-tip-problem-rpm-different-operating-system.html
|
||||
// Additionally, it is recommended to set the rpmArch to ppc
|
||||
// As AIX, while being ppc64, expects the rpms to specify ppc.
|
||||
// We will default to setting ppc here, but again this can be
|
||||
// overridden by setting it in your .goreleaser.yaml See the following:
|
||||
// https://developer.ibm.com/articles/au-aix-build-open-source-rpm-packages/
|
||||
// https://developer.ibm.com/articles/configure-yum-on-aix/
|
||||
if infoPlatform == "aix" {
|
||||
if artifacts[0].Goarch != "ppc64" {
|
||||
log.Debugf("skipping aix/%s as its not supported", infoArch)
|
||||
return nil
|
||||
}
|
||||
if format == "rpm" {
|
||||
infoPlatform = "aix7.2"
|
||||
infoArch = "ppc"
|
||||
} else {
|
||||
log.Infof("skipping aix for %s as its not supported", format)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
switch format {
|
||||
case "archlinux":
|
||||
if !isSupportedArchlinuxArch(artifacts[0].Goarch, artifacts[0].Goarm) {
|
||||
|
@ -196,11 +196,14 @@ func TestRunPipe(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}, testctx.WithVersion("1.0.0"), testctx.WithCurrentTag("v1.0.0"))
|
||||
for _, goos := range []string{"linux", "darwin", "ios", "android"} {
|
||||
for _, goarch := range []string{"amd64", "386", "arm64", "arm", "mips"} {
|
||||
for _, goos := range []string{"linux", "darwin", "ios", "android", "aix"} {
|
||||
for _, goarch := range []string{"amd64", "386", "arm64", "arm", "mips", "ppc64"} {
|
||||
if goos == "ios" && goarch != "arm64" {
|
||||
continue
|
||||
}
|
||||
if goarch == "ppc64" && goos != "aix" {
|
||||
continue
|
||||
}
|
||||
switch goarch {
|
||||
case "arm":
|
||||
for _, goarm := range []string{"6", "7"} {
|
||||
@ -389,7 +392,7 @@ func TestRunPipe(t *testing.T) {
|
||||
}
|
||||
require.NoError(t, Pipe{}.Run(ctx))
|
||||
packages := ctx.Artifacts.Filter(artifact.ByType(artifact.LinuxPackage)).List()
|
||||
require.Len(t, packages, 56)
|
||||
require.Len(t, packages, 57)
|
||||
|
||||
for _, pkg := range packages {
|
||||
format := pkg.Format()
|
||||
@ -421,6 +424,8 @@ func TestRunPipe(t *testing.T) {
|
||||
require.Equal(t, "foo_1.0.0_linux_"+arch+"-10-20"+ext, pkg.Name)
|
||||
case "android":
|
||||
require.Equal(t, "foo_1.0.0_android_"+arch+"-10-20"+ext, pkg.Name)
|
||||
case "aix":
|
||||
require.Equal(t, "foo_1.0.0_aix_ppc64-10-20"+ext, pkg.Name)
|
||||
default:
|
||||
require.Equal(t, "foo_1.0.0_ios_arm64-10-20"+ext, pkg.Name)
|
||||
}
|
||||
@ -527,8 +532,12 @@ func doTestRunPipeConventionalNameTemplate(t *testing.T, snapshot bool) {
|
||||
if snapshot {
|
||||
ctx.Snapshot = true
|
||||
}
|
||||
for _, goos := range []string{"linux", "darwin"} {
|
||||
for _, goarch := range []string{"amd64", "386", "arm64", "arm", "mips"} {
|
||||
for _, goos := range []string{"linux", "darwin", "aix"} {
|
||||
for _, goarch := range []string{"amd64", "386", "arm64", "arm", "mips", "ppc64"} {
|
||||
if goarch == "ppc64" && goos != "aix" {
|
||||
continue
|
||||
}
|
||||
|
||||
switch goarch {
|
||||
case "arm":
|
||||
for _, goarm := range []string{"6", "7"} {
|
||||
@ -588,7 +597,7 @@ func doTestRunPipeConventionalNameTemplate(t *testing.T, snapshot bool) {
|
||||
}
|
||||
require.NoError(t, Pipe{}.Run(ctx))
|
||||
packages := ctx.Artifacts.Filter(artifact.ByType(artifact.LinuxPackage)).List()
|
||||
require.Len(t, packages, 47)
|
||||
require.Len(t, packages, 48)
|
||||
prefix := "foo"
|
||||
if snapshot {
|
||||
prefix += "-snapshot"
|
||||
@ -607,6 +616,7 @@ func doTestRunPipeConventionalNameTemplate(t *testing.T, snapshot bool) {
|
||||
prefix + "-1.0.0-1.x86_64v2.rpm",
|
||||
prefix + "-1.0.0-1.x86_64v3.rpm",
|
||||
prefix + "-1.0.0-1.x86_64v4.rpm",
|
||||
prefix + "-1.0.0-1.ppc.rpm",
|
||||
prefix + "_1.0.0_aarch64.apk",
|
||||
prefix + "_1.0.0_amd64.deb",
|
||||
prefix + "_1.0.0_amd64.ipk",
|
||||
@ -818,7 +828,7 @@ func TestNoBuildsFound(t *testing.T) {
|
||||
artifact.ExtraID: "default",
|
||||
},
|
||||
})
|
||||
require.EqualError(t, Pipe{}.Run(ctx), `no linux binaries found for builds [nope]`)
|
||||
require.EqualError(t, Pipe{}.Run(ctx), `no linux/unix binaries found for builds [nope]`)
|
||||
}
|
||||
|
||||
func TestCreateFileDoesntExist(t *testing.T) {
|
||||
|
1
internal/pipe/nfpm/testdata/testfile-ppc64.txt
vendored
Normal file
1
internal/pipe/nfpm/testdata/testfile-ppc64.txt
vendored
Normal file
@ -0,0 +1 @@
|
||||
this is a test file
|
Loading…
x
Reference in New Issue
Block a user