Skip to content

Commit 481103c

Browse files
authored
Merge pull request #3270 from jcaamano/master
Improve ARM platform matching
2 parents f80d285 + ad25c1a commit 481103c

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

platforms/compare.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,48 @@ type MatchComparer interface {
2929
// Only returns a match comparer for a single platform
3030
// using default resolution logic for the platform.
3131
//
32+
// For ARMv8, will also match ARMv7, ARMv6 and ARMv5 (for 32bit runtimes)
3233
// For ARMv7, will also match ARMv6 and ARMv5
3334
// For ARMv6, will also match ARMv5
3435
func Only(platform specs.Platform) MatchComparer {
3536
platform = Normalize(platform)
3637
if platform.Architecture == "arm" {
38+
if platform.Variant == "v8" {
39+
return orderedPlatformComparer{
40+
matchers: []Matcher{
41+
&matcher{
42+
Platform: platform,
43+
},
44+
&matcher{
45+
Platform: specs.Platform{
46+
Architecture: platform.Architecture,
47+
OS: platform.OS,
48+
OSVersion: platform.OSVersion,
49+
OSFeatures: platform.OSFeatures,
50+
Variant: "v7",
51+
},
52+
},
53+
&matcher{
54+
Platform: specs.Platform{
55+
Architecture: platform.Architecture,
56+
OS: platform.OS,
57+
OSVersion: platform.OSVersion,
58+
OSFeatures: platform.OSFeatures,
59+
Variant: "v6",
60+
},
61+
},
62+
&matcher{
63+
Platform: specs.Platform{
64+
Architecture: platform.Architecture,
65+
OS: platform.OS,
66+
OSVersion: platform.OSVersion,
67+
OSFeatures: platform.OSFeatures,
68+
Variant: "v5",
69+
},
70+
},
71+
},
72+
}
73+
}
3774
if platform.Variant == "v7" {
3875
return orderedPlatformComparer{
3976
matchers: []Matcher{

platforms/cpuinfo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func getCPUVariant() string {
9797
}
9898

9999
switch variant {
100-
case "8":
100+
case "8", "AArch64":
101101
variant = "v8"
102102
case "7", "7M", "?(12)", "?(13)", "?(14)", "?(15)", "?(16)", "?(17)":
103103
variant = "v7"

0 commit comments

Comments
 (0)