Compare commits
2 Commits
f2d4d5250a
...
10893c07c3
Author | SHA1 | Date | |
---|---|---|---|
10893c07c3 | |||
e7e742d98d |
8
build.go
8
build.go
@ -689,10 +689,14 @@ func archMatches(architectures []string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
if slices.Contains(architectures, "arm") {
|
||||
architectures = append(architectures, cpu.ARMVariant())
|
||||
for _, arch := range architectures {
|
||||
if strings.HasPrefix(arch, "arm") {
|
||||
architectures = append(architectures, cpu.CompatibleARMReverse(arch)...)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println(architectures)
|
||||
|
||||
return slices.Contains(architectures, cpu.Arch())
|
||||
}
|
||||
|
||||
|
@ -44,11 +44,55 @@ func ARMVariant() string {
|
||||
}
|
||||
}
|
||||
|
||||
// CompatibleARM returns all the compatible ARM variants given the system architecture
|
||||
func CompatibleARM(variant string) []string {
|
||||
switch variant {
|
||||
case "arm7", "arm":
|
||||
return []string{"arm7", "arm6", "arm5"}
|
||||
case "arm6":
|
||||
return []string{"arm6", "arm5"}
|
||||
case "arm5":
|
||||
return []string{"arm5"}
|
||||
default:
|
||||
return []string{variant}
|
||||
}
|
||||
}
|
||||
|
||||
// CompatibleARMReverse returns all the compatible ARM variants given the package's architecture
|
||||
func CompatibleARMReverse(variant string) []string {
|
||||
switch variant {
|
||||
case "arm7":
|
||||
return []string{"arm7"}
|
||||
case "arm6":
|
||||
return []string{"arm6", "arm7"}
|
||||
case "arm5", "arm":
|
||||
return []string{"arm5", "arm6", "arm7"}
|
||||
default:
|
||||
return []string{variant}
|
||||
}
|
||||
}
|
||||
|
||||
// Arch returns the canonical CPU architecture of the system
|
||||
func Arch() string {
|
||||
arch := runtime.GOARCH
|
||||
arch := os.Getenv("LURE_ARCH")
|
||||
if arch == "" {
|
||||
arch = runtime.GOARCH
|
||||
}
|
||||
if arch == "arm" {
|
||||
arch = ARMVariant()
|
||||
}
|
||||
return arch
|
||||
}
|
||||
|
||||
// Arches returns all the architectures the system is compatible with
|
||||
func Arches() []string {
|
||||
arch := os.Getenv("LURE_ARCH")
|
||||
if arch == "" {
|
||||
arch = runtime.GOARCH
|
||||
}
|
||||
if strings.HasPrefix(arch, "arm") {
|
||||
return append(CompatibleARM(arch), "arm")
|
||||
} else {
|
||||
return []string{Arch()}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ package overrides
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"go.elara.ws/lure/distro"
|
||||
@ -59,13 +58,7 @@ func Resolve(info *distro.OSRelease, opts *Opts) ([]string, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
architectures := []string{runtime.GOARCH}
|
||||
|
||||
if runtime.GOARCH == "arm" {
|
||||
// More specific goes first
|
||||
architectures[0] = cpu.ARMVariant()
|
||||
architectures = append(architectures, "arm")
|
||||
}
|
||||
architectures := cpu.Arches()
|
||||
|
||||
distros := []string{info.ID}
|
||||
if opts.LikeDistros {
|
||||
|
Loading…
Reference in New Issue
Block a user