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:
@@ -135,7 +135,7 @@ type Matcher interface {
|
||||
// Applications should opt to use `Match` over directly parsing specifiers.
|
||||
func NewMatcher(platform specs.Platform) Matcher {
|
||||
return &matcher{
|
||||
Platform: platform,
|
||||
Platform: Normalize(platform),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +197,9 @@ func Parse(specifier string) (specs.Platform, error) {
|
||||
}
|
||||
|
||||
p.Architecture, p.Variant = normalizeArch(parts[0], "")
|
||||
if defaultVariant(p.Architecture, p.Variant) {
|
||||
p.Variant = ""
|
||||
}
|
||||
if isKnownArch(p.Architecture) {
|
||||
p.OS = runtime.GOOS
|
||||
return p, nil
|
||||
@@ -208,6 +211,9 @@ 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) {
|
||||
p.Variant = ""
|
||||
}
|
||||
|
||||
return p, nil
|
||||
case 3:
|
||||
|
||||
Reference in New Issue
Block a user