MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / normalize_docker_platform

Function normalize_docker_platform

crates/openshell-bootstrap/src/build.rs:51–69  ·  view source on GitHub ↗
(os: &str, arch: &str)

Source from the content-addressed store, hash-verified

49}
50
51fn normalize_docker_platform(os: &str, arch: &str) -> Result<String> {
52 // Remote or non-standard daemons may return mixed-case arch strings.
53 let arch_lower = arch.to_lowercase();
54 let normalized_arch = match arch_lower.as_str() {
55 "amd64" | "x86_64" => "amd64",
56 "arm64" | "aarch64" => "arm64",
57 "arm" | "armv7" | "armv7l" | "armhf" => "arm/v7",
58 "armv6" | "armv6l" => "arm/v6",
59 "386" | "i386" | "i686" => "386",
60 "ppc64le" => "ppc64le",
61 "s390x" => "s390x",
62 _ => {
63 return Err(miette::miette!(
64 "unsupported Docker daemon architecture for local image build: {arch}"
65 ));
66 }
67 };
68 Ok(format!("{os}/{normalized_arch}"))
69}
70
71/// Parse `os/arch[/variant]` and reject malformed empty segments.
72fn parse_platform(platform: &str) -> Result<(&str, &str, &str)> {

Callers 1

docker_daemon_platformFunction · 0.85

Calls 1

as_strMethod · 0.45

Tested by

no test coverage detected