1
0
forked from brl/citadel-tools

Add mandatory timestamp field to image metainfo

This commit is contained in:
Bruce Leidl 2019-01-07 18:59:21 -05:00
parent 8e341d6005
commit da0922c29d
3 changed files with 9 additions and 0 deletions

View File

@ -181,6 +181,7 @@ impl UpdateBuilder {
} }
writeln!(v, "channel = \"{}\"", self.config.channel())?; writeln!(v, "channel = \"{}\"", self.config.channel())?;
writeln!(v, "version = {}", self.config.version())?; writeln!(v, "version = {}", self.config.version())?;
writeln!(v, "timestamp = \"{}\"", self.config.timestamp())?;
writeln!(v, "nblocks = {}", self.nblocks.unwrap())?; writeln!(v, "nblocks = {}", self.nblocks.unwrap())?;
writeln!(v, "shasum = \"{}\"", self.shasum.as_ref().unwrap())?; writeln!(v, "shasum = \"{}\"", self.shasum.as_ref().unwrap())?;
writeln!(v, "verity-salt = \"{}\"", self.verity_salt.as_ref().unwrap())?; writeln!(v, "verity-salt = \"{}\"", self.verity_salt.as_ref().unwrap())?;

View File

@ -12,6 +12,7 @@ pub struct BuildConfig {
image_type: String, image_type: String,
channel: String, channel: String,
version: usize, version: usize,
timestamp: String,
source: String, source: String,
#[serde(rename = "kernel-version")] #[serde(rename = "kernel-version")]
kernel_version: Option<String>, kernel_version: Option<String>,
@ -76,6 +77,8 @@ impl BuildConfig {
Ok(()) Ok(())
} }
pub fn timestamp(&self) -> &str { &self.timestamp }
pub fn source(&self) -> &Path { pub fn source(&self) -> &Path {
&self.src_path &self.src_path
} }

View File

@ -297,6 +297,7 @@ struct MetaInfoToml {
#[serde(rename = "kernel-id")] #[serde(rename = "kernel-id")]
kernel_id: Option<String>, kernel_id: Option<String>,
version: u32, version: u32,
timestamp: String,
#[serde(rename = "base-version")] #[serde(rename = "base-version")]
base_version: Option<u32>, base_version: Option<u32>,
date: Option<String>, date: Option<String>,
@ -348,6 +349,10 @@ impl MetaInfo {
self.toml().version self.toml().version
} }
pub fn timestamp(&self) -> &str {
&self.toml().timestamp
}
pub fn date(&self) -> Option<&str> { pub fn date(&self) -> Option<&str> {
self.toml().date.as_ref().map(|s| s.as_str()) self.toml().date.as_ref().map(|s| s.as_str())
} }