Fix arm platform matching

The normalization was being inconsistently applied causing a
failure to match some platforms in manifest lists.
Fix the matcher and normalization to be more consistent and
add changes to parser to prevent the defaulted variants from being
set in the platform structure.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2018-06-21 16:04:03 -07:00
parent 7ff2748f9c
commit 37ab93e2c8
3 changed files with 128 additions and 10 deletions

View File

@@ -89,18 +89,21 @@ func normalizeArch(arch, variant string) (string, string) {
case "x86_64", "x86-64":
arch = "amd64"
variant = ""
case "aarch64":
case "aarch64", "arm64":
arch = "arm64"
variant = "" // v8 is implied
switch variant {
case "", "8":
variant = "v8"
}
case "armhf":
arch = "arm"
variant = ""
variant = "v7"
case "armel":
arch = "arm"
variant = "v6"
case "arm":
switch variant {
case "v7", "7":
case "", "7":
variant = "v7"
case "5", "6", "8":
variant = "v" + variant
@@ -109,3 +112,15 @@ func normalizeArch(arch, variant string) (string, string) {
return arch, variant
}
// defaultVariant detects default variants on normalized arch/variant
func defaultVariant(arch, variant string) bool {
switch arch {
case "arm64":
return variant == "v8"
case "arm":
return variant == "v7"
default:
return true
}
}