Merge pull request #10942 from dmcgowan/update-platforms-v1-rc
Update platforms to v1.0.0-rc.0
This commit is contained in:
		
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							| @@ -24,7 +24,7 @@ require ( | ||||
| 	github.com/containerd/log v0.1.0 | ||||
| 	github.com/containerd/nri v0.7.0 | ||||
| 	github.com/containerd/otelttrpc v0.0.0-20240305015340-ea5083fda723 | ||||
| 	github.com/containerd/platforms v0.2.1 | ||||
| 	github.com/containerd/platforms v1.0.0-rc.0 | ||||
| 	github.com/containerd/plugin v1.0.0 | ||||
| 	github.com/containerd/ttrpc v1.2.6 | ||||
| 	github.com/containerd/typeurl/v2 v2.2.0 | ||||
|   | ||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							| @@ -691,8 +691,8 @@ github.com/containerd/nri v0.7.0 h1:scGL9JiBqNaWnghLFFPOzp0GxxWAc1uQtQ7qx8PHdCs= | ||||
| github.com/containerd/nri v0.7.0/go.mod h1:uSkgBrCdEtAiEz4vnrq8gmAC4EnVAM5Klt0OuK5rZYQ= | ||||
| github.com/containerd/otelttrpc v0.0.0-20240305015340-ea5083fda723 h1:swk9KxrmARZjSMrHc1Lzb39XhcDwAhYpqkBhinCFLCQ= | ||||
| github.com/containerd/otelttrpc v0.0.0-20240305015340-ea5083fda723/go.mod h1:ZKzztepTSz/LKtbUSzfBNVwgqBEPABVZV9PQF/l53+Q= | ||||
| github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= | ||||
| github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw= | ||||
| github.com/containerd/platforms v1.0.0-rc.0 h1:GuHWSKgVVO3POn6nRBB4sH63uPOLa87yuuhsGLWaXAA= | ||||
| github.com/containerd/platforms v1.0.0-rc.0/go.mod h1:T1XAzzOdYs3it7l073MNXyxRwQofJfqwi/8cRjufIk4= | ||||
| github.com/containerd/plugin v1.0.0 h1:c8Kf1TNl6+e2TtMHZt+39yAPDbouRH9WAToRjex483Y= | ||||
| github.com/containerd/plugin v1.0.0/go.mod h1:hQfJe5nmWfImiqT1q8Si3jLv3ynMUIBB47bQ+KexvO8= | ||||
| github.com/containerd/ttrpc v1.2.2/go.mod h1:sIT6l32Ph/H9cvnJsfXM5drIVzTr5A2flTf1G5tYZak= | ||||
|   | ||||
							
								
								
									
										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_.-]*)\))?$`) | ||||
| ) | ||||
|  | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							| @@ -183,7 +183,7 @@ github.com/containerd/nri/types/v1 | ||||
| ## explicit; go 1.13 | ||||
| github.com/containerd/otelttrpc | ||||
| github.com/containerd/otelttrpc/internal | ||||
| # github.com/containerd/platforms v0.2.1 | ||||
| # github.com/containerd/platforms v1.0.0-rc.0 | ||||
| ## explicit; go 1.20 | ||||
| github.com/containerd/platforms | ||||
| # github.com/containerd/plugin v1.0.0 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Derek McGowan
					Derek McGowan