mirror of
https://github.com/goreleaser/nfpm
synced 2024-11-18 19:04:07 +01:00
fix: mips softfloat/hardfloat handling
This commit is contained in:
parent
a8c16744a1
commit
9524bb8a26
@ -51,13 +51,6 @@ func ensureValidArch(info *nfpm.Info) *nfpm.Info {
|
||||
info.Arch = info.Deb.Arch
|
||||
} else if arch, ok := archToDebian[info.Arch]; ok {
|
||||
info.Arch = arch
|
||||
} else {
|
||||
for k, v := range archToDebian {
|
||||
if strings.HasPrefix(info.Arch, k) {
|
||||
info.Arch = v
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return info
|
||||
|
6
nfpm.go
6
nfpm.go
@ -479,6 +479,12 @@ func WithDefaults(info *Info) *Info {
|
||||
if info.Arch == "" {
|
||||
info.Arch = "amd64"
|
||||
}
|
||||
if strings.HasPrefix(info.Arch, "mips") {
|
||||
info.Arch = strings.NewReplacer(
|
||||
"softfloat", "",
|
||||
"hardfloat", "",
|
||||
).Replace(info.Arch)
|
||||
}
|
||||
if info.Version == "" {
|
||||
info.Version = "v0.0.0-rc0"
|
||||
}
|
||||
|
22
nfpm_test.go
22
nfpm_test.go
@ -119,6 +119,28 @@ func TestDefaults(t *testing.T) {
|
||||
},
|
||||
}, *got)
|
||||
})
|
||||
t.Run("mips softfloat", func(t *testing.T) {
|
||||
makeinfo := func() nfpm.Info {
|
||||
return nfpm.Info{
|
||||
Platform: "linux",
|
||||
Arch: "mips64softfloat",
|
||||
}
|
||||
}
|
||||
info := makeinfo()
|
||||
nfpm.WithDefaults(&info)
|
||||
require.Equal(t, "mips64", info.Arch)
|
||||
})
|
||||
t.Run("mips softfloat", func(t *testing.T) {
|
||||
makeinfo := func() nfpm.Info {
|
||||
return nfpm.Info{
|
||||
Platform: "linux",
|
||||
Arch: "mips64hardfloat",
|
||||
}
|
||||
}
|
||||
info := makeinfo()
|
||||
nfpm.WithDefaults(&info)
|
||||
require.Equal(t, "mips64", info.Arch)
|
||||
})
|
||||
}
|
||||
|
||||
func TestPrepareForPackager(t *testing.T) {
|
||||
|
@ -75,13 +75,6 @@ func ensureValidArch(info *nfpm.Info) *nfpm.Info {
|
||||
info.Arch = info.RPM.Arch
|
||||
} else if arch, ok := archToRPM[info.Arch]; ok {
|
||||
info.Arch = arch
|
||||
} else {
|
||||
for k, v := range archToRPM {
|
||||
if strings.HasPrefix(info.Arch, k) {
|
||||
info.Arch = v
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return info
|
||||
|
Loading…
Reference in New Issue
Block a user