From da0922c29d9a0980521d2c3a6a2737f6eea3310d Mon Sep 17 00:00:00 2001 From: Bruce Leidl Date: Mon, 7 Jan 2019 18:59:21 -0500 Subject: [PATCH] Add mandatory timestamp field to image metainfo --- citadel-image/src/build.rs | 1 + citadel-image/src/config.rs | 3 +++ libcitadel/src/header.rs | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/citadel-image/src/build.rs b/citadel-image/src/build.rs index 8948a34..6bb39c8 100644 --- a/citadel-image/src/build.rs +++ b/citadel-image/src/build.rs @@ -181,6 +181,7 @@ impl UpdateBuilder { } writeln!(v, "channel = \"{}\"", self.config.channel())?; writeln!(v, "version = {}", self.config.version())?; + writeln!(v, "timestamp = \"{}\"", self.config.timestamp())?; writeln!(v, "nblocks = {}", self.nblocks.unwrap())?; writeln!(v, "shasum = \"{}\"", self.shasum.as_ref().unwrap())?; writeln!(v, "verity-salt = \"{}\"", self.verity_salt.as_ref().unwrap())?; diff --git a/citadel-image/src/config.rs b/citadel-image/src/config.rs index 54a509a..3569332 100644 --- a/citadel-image/src/config.rs +++ b/citadel-image/src/config.rs @@ -12,6 +12,7 @@ pub struct BuildConfig { image_type: String, channel: String, version: usize, + timestamp: String, source: String, #[serde(rename = "kernel-version")] kernel_version: Option, @@ -76,6 +77,8 @@ impl BuildConfig { Ok(()) } + pub fn timestamp(&self) -> &str { &self.timestamp } + pub fn source(&self) -> &Path { &self.src_path } diff --git a/libcitadel/src/header.rs b/libcitadel/src/header.rs index 426e0a5..748b2f7 100644 --- a/libcitadel/src/header.rs +++ b/libcitadel/src/header.rs @@ -297,6 +297,7 @@ struct MetaInfoToml { #[serde(rename = "kernel-id")] kernel_id: Option, version: u32, + timestamp: String, #[serde(rename = "base-version")] base_version: Option, date: Option, @@ -348,6 +349,10 @@ impl MetaInfo { self.toml().version } + pub fn timestamp(&self) -> &str { + &self.toml().timestamp + } + pub fn date(&self) -> Option<&str> { self.toml().date.as_ref().map(|s| s.as_str()) }