diff --git a/internal/linux/arch.go b/internal/linux/arch.go index 54302233b..b3304aade 100644 --- a/internal/linux/arch.go +++ b/internal/linux/arch.go @@ -6,7 +6,10 @@ import "strings" // Arch converts a goarch to a linux-compatible arch. func Arch(key string) string { // XXX: list of all linux arches: `go tool dist list | grep linux` - var arch = strings.TrimPrefix(key, "linux") + arch := strings.TrimPrefix(key, "linux") + for _, suffix := range []string{"hardfloat", "softfloat"} { + arch = strings.TrimSuffix(arch, suffix) + } switch arch { case "386": return "i386" @@ -18,7 +21,10 @@ func Arch(key string) string { return "armhf" case "arm7": // GOARCH + GOARM return "armhf" - default: - return arch + case "mips64le": + return "mips64el" + case "mipsle": + return "mipsel" } + return arch } diff --git a/internal/linux/arch_test.go b/internal/linux/arch_test.go index 86873b816..591ca7579 100644 --- a/internal/linux/arch_test.go +++ b/internal/linux/arch_test.go @@ -9,15 +9,19 @@ import ( func TestArch(t *testing.T) { for from, to := range map[string]string{ - "linuxamd64": "amd64", - "linux386": "i386", - "linuxarm64": "arm64", - "linuxarm5": "armel", - "linuxarm6": "armhf", - "linuxarm7": "armhf", - "linuxppc64": "ppc64", - "linuxppc64le": "ppc64le", - "linuxwhat": "what", + "linuxamd64": "amd64", + "linux386": "i386", + "linuxarm64": "arm64", + "linuxarm5": "armel", + "linuxarm6": "armhf", + "linuxarm7": "armhf", + "linuxppc64": "ppc64", + "linuxppc64le": "ppc64le", + "linuxwhat": "what", + "linuxmips64lesoftfloat": "mips64el", + "linuxmipslehardfloat": "mipsel", + "linuxmipssoftfloat": "mips", + "linuxmips64hardfloat": "mips64", } { t.Run(fmt.Sprintf("%s to %s", from, to), func(t *testing.T) { require.Equal(t, to, Arch(from))