Update platforms to v1.0.0-rc.0
Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
8
vendor/github.com/containerd/platforms/.golangci.yml
generated
vendored
8
vendor/github.com/containerd/platforms/.golangci.yml
generated
vendored
@@ -1,6 +1,6 @@
|
||||
linters:
|
||||
enable:
|
||||
- exportloopref # Checks for pointers to enclosing loop variables
|
||||
- copyloopvar
|
||||
- gofmt
|
||||
- goimports
|
||||
- gosec
|
||||
@@ -12,14 +12,16 @@ linters:
|
||||
- tenv # Detects using os.Setenv instead of t.Setenv since Go 1.17
|
||||
- unconvert
|
||||
- unused
|
||||
- vet
|
||||
- govet
|
||||
- dupword # Checks for duplicate words in the source code
|
||||
disable:
|
||||
- errcheck
|
||||
|
||||
run:
|
||||
timeout: 5m
|
||||
skip-dirs:
|
||||
|
||||
issues:
|
||||
exclude-dirs:
|
||||
- api
|
||||
- cluster
|
||||
- design
|
||||
|
||||
62
vendor/github.com/containerd/platforms/compare.go
generated
vendored
62
vendor/github.com/containerd/platforms/compare.go
generated
vendored
@@ -72,6 +72,66 @@ func platformVector(platform specs.Platform) []specs.Platform {
|
||||
if variant == "" {
|
||||
variant = "v8"
|
||||
}
|
||||
|
||||
majorVariant, minorVariant, hasMinor := strings.Cut(variant, ".")
|
||||
if armMajor, err := strconv.Atoi(strings.TrimPrefix(majorVariant, "v")); err == nil && armMajor >= 8 {
|
||||
armMinor := 0
|
||||
if len(variant) == 4 {
|
||||
if minor, err := strconv.Atoi(minorVariant); err == nil && hasMinor {
|
||||
armMinor = minor
|
||||
}
|
||||
}
|
||||
|
||||
if armMajor == 9 {
|
||||
for minor := armMinor - 1; minor >= 0; minor-- {
|
||||
arm64Variant := "v" + strconv.Itoa(armMajor) + "." + strconv.Itoa(minor)
|
||||
if minor == 0 {
|
||||
arm64Variant = "v" + strconv.Itoa(armMajor)
|
||||
}
|
||||
vector = append(vector, specs.Platform{
|
||||
Architecture: platform.Architecture,
|
||||
OS: platform.OS,
|
||||
OSVersion: platform.OSVersion,
|
||||
OSFeatures: platform.OSFeatures,
|
||||
Variant: arm64Variant,
|
||||
})
|
||||
}
|
||||
|
||||
// v9.0 diverged from v8.5, meaning that v9.x is compatible with v8.{x+5} until v9.4/v8.9
|
||||
armMinor = armMinor + 5
|
||||
if armMinor > 9 {
|
||||
armMinor = 9
|
||||
}
|
||||
armMajor = 8
|
||||
vector = append(vector, specs.Platform{
|
||||
Architecture: platform.Architecture,
|
||||
OS: platform.OS,
|
||||
OSVersion: platform.OSVersion,
|
||||
OSFeatures: platform.OSFeatures,
|
||||
Variant: "v8." + strconv.Itoa(armMinor),
|
||||
})
|
||||
}
|
||||
|
||||
for minor := armMinor - 1; minor >= 0; minor-- {
|
||||
arm64Variant := "v" + strconv.Itoa(armMajor) + "." + strconv.Itoa(minor)
|
||||
if minor == 0 {
|
||||
arm64Variant = "v" + strconv.Itoa(armMajor)
|
||||
}
|
||||
vector = append(vector, specs.Platform{
|
||||
Architecture: platform.Architecture,
|
||||
OS: platform.OS,
|
||||
OSVersion: platform.OSVersion,
|
||||
OSFeatures: platform.OSFeatures,
|
||||
Variant: arm64Variant,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// All arm64/v8.x and arm64/v9.x are compatible with arm/v8 (32-bits) and below.
|
||||
// There's no arm64 v9 variant, so it's normalized to v8.
|
||||
if strings.HasPrefix(variant, "v8.") || strings.HasPrefix(variant, "v9.") {
|
||||
variant = "v8"
|
||||
}
|
||||
vector = append(vector, platformVector(specs.Platform{
|
||||
Architecture: "arm",
|
||||
OS: platform.OS,
|
||||
@@ -87,6 +147,8 @@ func platformVector(platform specs.Platform) []specs.Platform {
|
||||
// Only returns a match comparer for a single platform
|
||||
// using default resolution logic for the platform.
|
||||
//
|
||||
// For arm64/v9.x, will also match arm64/v9.{0..x-1} and arm64/v8.{0..x+5}
|
||||
// For arm64/v8.x, will also match arm64/v8.{0..x-1}
|
||||
// For arm/v8, will also match arm/v7, arm/v6 and arm/v5
|
||||
// For arm/v7, will also match arm/v6 and arm/v5
|
||||
// For arm/v6, will also match arm/v5
|
||||
|
||||
17
vendor/github.com/containerd/platforms/database.go
generated
vendored
17
vendor/github.com/containerd/platforms/database.go
generated
vendored
@@ -86,9 +86,22 @@ func normalizeArch(arch, variant string) (string, string) {
|
||||
}
|
||||
case "aarch64", "arm64":
|
||||
arch = "arm64"
|
||||
switch variant {
|
||||
case "8", "v8":
|
||||
majorVariant, minorVariant, hasMinor := strings.Cut(variant, ".")
|
||||
majorVariant = strings.TrimPrefix(majorVariant, "v")
|
||||
if minorVariant == "0" {
|
||||
minorVariant = ""
|
||||
hasMinor = false
|
||||
}
|
||||
|
||||
if (majorVariant == "" || majorVariant == "8") && !hasMinor {
|
||||
// normalize v8 to empty string
|
||||
variant = ""
|
||||
} else {
|
||||
// otherwise to v8.x or v9 or v9.x
|
||||
variant = "v" + majorVariant
|
||||
if hasMinor {
|
||||
variant = variant + "." + minorVariant
|
||||
}
|
||||
}
|
||||
case "armhf":
|
||||
arch = "arm"
|
||||
|
||||
6
vendor/github.com/containerd/platforms/defaults_windows.go
generated
vendored
6
vendor/github.com/containerd/platforms/defaults_windows.go
generated
vendored
@@ -69,9 +69,9 @@ func getOSVersion(osVersionPrefix string) osVersion {
|
||||
return osVersion{}
|
||||
}
|
||||
|
||||
majorVersion, _ := strconv.Atoi(parts[0])
|
||||
minorVersion, _ := strconv.Atoi(parts[1])
|
||||
buildNumber, _ := strconv.Atoi(parts[2])
|
||||
majorVersion, _ := strconv.ParseUint(parts[0], 10, 8)
|
||||
minorVersion, _ := strconv.ParseUint(parts[1], 10, 8)
|
||||
buildNumber, _ := strconv.ParseUint(parts[2], 10, 16)
|
||||
|
||||
return osVersion{
|
||||
MajorVersion: uint8(majorVersion),
|
||||
|
||||
2
vendor/github.com/containerd/platforms/platforms.go
generated
vendored
2
vendor/github.com/containerd/platforms/platforms.go
generated
vendored
@@ -121,7 +121,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
specifierRe = regexp.MustCompile(`^[A-Za-z0-9_-]+$`)
|
||||
specifierRe = regexp.MustCompile(`^[A-Za-z0-9_.-]+$`)
|
||||
osAndVersionRe = regexp.MustCompile(`^([A-Za-z0-9_-]+)(?:\(([A-Za-z0-9_.-]*)\))?$`)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user