(os: &str, arch: &str)
| 49 | } |
| 50 | |
| 51 | fn 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. |
| 72 | fn parse_platform(platform: &str) -> Result<(&str, &str, &str)> { |
no test coverage detected