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

fix: only build archlinux and aur for supported arches (#4695)

closes #4693

see https://wiki.archlinux.org/title/Frequently_asked_questions
This commit is contained in:
Carlos Alexandro Becker 2024-03-16 11:40:57 -03:00 committed by GitHub
parent 932e4249af
commit 0a272037b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 28 additions and 14 deletions

View File

@ -110,7 +110,6 @@ func doRun(ctx *context.Context, aur config.AUR, cl client.ReleaseURLTemplater)
artifact.ByGoarch("arm"),
artifact.Or(
artifact.ByGoarm("7"),
artifact.ByGoarm("6"),
),
),
),

View File

@ -5,7 +5,7 @@ pkgver=1.0.1
pkgrel=1
pkgdesc='A run pipe test aur and FOO=foo_is_bar'
url='https://github.com/goreleaser'
arch=('aarch64' 'armv6h' 'armv7h' 'i686' 'x86_64')
arch=('aarch64' 'armv7h' 'i686' 'x86_64')
license=('MIT')
provides=('foo')
conflicts=('foo')
@ -13,9 +13,6 @@ conflicts=('foo')
source_aarch64=("${pkgname}_${pkgver}_aarch64.tar.gz::https://dummyhost/download/v1.0.1/arm64.tar.gz")
sha256sums_aarch64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
source_armv6h=("${pkgname}_${pkgver}_armv6h.tar.gz::https://dummyhost/download/v1.0.1/armv6.tar.gz")
sha256sums_armv6h=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
source_armv7h=("${pkgname}_${pkgver}_armv7h.tar.gz::https://dummyhost/download/v1.0.1/armv7.tar.gz")
sha256sums_armv7h=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')

View File

@ -9,9 +9,6 @@ pkgbase = foo-bin
arch = aarch64
source_aarch64 = https://dummyhost/download/v1.0.1/arm64.tar.gz
sha256sums_aarch64 = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
arch = armv6h
source_armv6h = https://dummyhost/download/v1.0.1/armv6.tar.gz
sha256sums_armv6h = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
arch = armv7h
source_armv7h = https://dummyhost/download/v1.0.1/armv7.tar.gz
sha256sums_armv7h = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

View File

@ -153,6 +153,20 @@ func isSupportedTermuxArch(arch string) bool {
return false
}
// arch officially only supports x86_64.
// however, there are unofficial ports for 686, arm64, and armv7
func isSupportedArchlinuxArch(arch, arm string) bool {
if arch == "arm" && arm == "7" {
return true
}
for _, a := range []string{"amd64", "arm64", "386"} {
if strings.HasPrefix(arch, a) {
return true
}
}
return false
}
func create(ctx *context.Context, fpm config.NFPM, format string, artifacts []*artifact.Artifact) error {
// TODO: improve mips handling on nfpm
infoArch := artifacts[0].Goarch + artifacts[0].Goarm + artifacts[0].Gomips // key used for the ConventionalFileName et al
@ -162,12 +176,19 @@ func create(ctx *context.Context, fpm config.NFPM, format string, artifacts []*a
if format == "deb" {
infoPlatform = "iphoneos-arm64"
} else {
log.Debugf("skipping ios for %s as its not supported", format)
return nil
}
}
if format == termuxFormat {
if !isSupportedTermuxArch(arch) {
switch format {
case "archlinux":
if !isSupportedArchlinuxArch(artifacts[0].Goarch, artifacts[0].Goarm) {
log.Debugf("skipping archlinux for %s as its not supported", arch)
return nil
}
case termuxFormat:
if !isSupportedTermuxArch(artifacts[0].Goarch) {
log.Debugf("skipping termux.deb for %s as its not supported by termux", arch)
return nil
}

View File

@ -389,7 +389,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, 47)
require.Len(t, packages, 44)
for _, pkg := range packages {
format := pkg.Format()
require.NotEmpty(t, format)
@ -406,7 +406,7 @@ func TestRunPipe(t *testing.T) {
}
ext := "." + format
if format != "termux.deb" {
if format != termuxFormat {
packager, err := nfpm.Get(format)
require.NoError(t, err)
@ -584,7 +584,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, 40)
require.Len(t, packages, 37)
prefix := "foo"
if snapshot {
prefix += "-snapshot"

View File

@ -775,7 +775,7 @@ type NFPM struct {
ID string `yaml:"id,omitempty" json:"id,omitempty"`
Builds []string `yaml:"builds,omitempty" json:"builds,omitempty"`
Formats []string `yaml:"formats,omitempty" json:"formats,omitempty"`
Formats []string `yaml:"formats,omitempty" json:"formats,omitempty" jsonschema:"enum=apk,enum=deb,enum=rpm,enum=termux.deb,enum=archlinux"`
Section string `yaml:"section,omitempty" json:"section,omitempty"`
Priority string `yaml:"priority,omitempty" json:"priority,omitempty"`
Vendor string `yaml:"vendor,omitempty" json:"vendor,omitempty"`