From 639dabd639c3610296046ad8ae056f489cf35b8f Mon Sep 17 00:00:00 2001 From: Tom Forbes Date: Sat, 13 Apr 2024 14:23:37 +0100 Subject: [PATCH] Rename os_version to os.version and fix macos version string. Signed-off-by: Tom Forbes --- src/image/descriptor.rs | 2 +- src/image/mod.rs | 2 ++ src/runtime/mod.rs | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/image/descriptor.rs b/src/image/descriptor.rs index 5e36e372cc..379e175d89 100644 --- a/src/image/descriptor.rs +++ b/src/image/descriptor.rs @@ -102,7 +102,7 @@ pub struct Platform { /// manifests where os.version is not known to work with the host OS /// version. Valid values are implementation-defined. e.g. /// 10.0.14393.1066 on windows. - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(rename = "os.version", skip_serializing_if = "Option::is_none")] #[builder(default)] os_version: Option, /// This OPTIONAL property specifies an array of strings, each diff --git a/src/image/mod.rs b/src/image/mod.rs index 571e10c78a..679e78190d 100644 --- a/src/image/mod.rs +++ b/src/image/mod.rs @@ -231,6 +231,8 @@ impl From<&str> for Os { "aix" => Os::AIX, "android" => Os::Android, "darwin" => Os::Darwin, + // std::env::consts::OS returns "macos" instead of darwin + "macos" => Os::Darwin, "dragonfly" => Os::DragonFlyBSD, "freebsd" => Os::FreeBSD, "hurd" => Os::Hurd, diff --git a/src/runtime/mod.rs b/src/runtime/mod.rs index a681c81e80..4e9adfbe33 100644 --- a/src/runtime/mod.rs +++ b/src/runtime/mod.rs @@ -295,7 +295,7 @@ mod tests { .expect("failed to canonicalize rootfs"); assert_eq!( - &rootfs_absolute_path, + &rootfs_absolute_path.canonicalize().unwrap(), spec.root.expect("no root in spec").path() ); } @@ -310,7 +310,7 @@ mod tests { .expect("failed to canonicalize rootfs"); assert_eq!( - &rootfs_absolute_path, + &rootfs_absolute_path.canonicalize().unwrap(), spec.root.expect("no root in spec").path() ); }