Merge pull request #2417 from dmcgowan/update-arm64-normalize
Normalize arm64 to an empty variant
This commit is contained in:
		| @@ -92,8 +92,8 @@ func normalizeArch(arch, variant string) (string, string) { | ||||
| 	case "aarch64", "arm64": | ||||
| 		arch = "arm64" | ||||
| 		switch variant { | ||||
| 		case "", "8": | ||||
| 			variant = "v8" | ||||
| 		case "8", "v8": | ||||
| 			variant = "" | ||||
| 		} | ||||
| 	case "armhf": | ||||
| 		arch = "arm" | ||||
| @@ -112,15 +112,3 @@ 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 | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -197,7 +197,7 @@ func Parse(specifier string) (specs.Platform, error) { | ||||
| 		} | ||||
|  | ||||
| 		p.Architecture, p.Variant = normalizeArch(parts[0], "") | ||||
| 		if defaultVariant(p.Architecture, p.Variant) { | ||||
| 		if p.Architecture == "arm" && p.Variant == "v7" { | ||||
| 			p.Variant = "" | ||||
| 		} | ||||
| 		if isKnownArch(p.Architecture) { | ||||
| @@ -211,7 +211,7 @@ func Parse(specifier string) (specs.Platform, error) { | ||||
| 		// about whether or not we know of the platform. | ||||
| 		p.OS = normalizeOS(parts[0]) | ||||
| 		p.Architecture, p.Variant = normalizeArch(parts[1], "") | ||||
| 		if defaultVariant(p.Architecture, p.Variant) { | ||||
| 		if p.Architecture == "arm" && p.Variant == "v7" { | ||||
| 			p.Variant = "" | ||||
| 		} | ||||
|  | ||||
| @@ -220,6 +220,9 @@ func Parse(specifier string) (specs.Platform, error) { | ||||
| 		// we have a fully specified variant, this is rare | ||||
| 		p.OS = normalizeOS(parts[0]) | ||||
| 		p.Architecture, p.Variant = normalizeArch(parts[1], parts[2]) | ||||
| 		if p.Architecture == "arm64" && p.Variant == "" { | ||||
| 			p.Variant = "v8" | ||||
| 		} | ||||
|  | ||||
| 		return p, nil | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Michael Crosby
					Michael Crosby