-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce 'release' crate for SVSM Versioning
Introduce the crate 'release' which will provide the version of the COCONUT-SVSM being built. The crate is used in SVSM and Stage2 to print a version identification in the initial console greeting. Signed-off-by: Joerg Roedel <[email protected]>
- Loading branch information
1 parent
dda83f0
commit 4b459da
Showing
6 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "release" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
|
||
[lints] | ||
workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// Copyright (c) 2025 SUSE LLC | ||
// | ||
// Author: Joerg Roedel <[email protected]> | ||
|
||
#![no_std] | ||
|
||
use core::fmt; | ||
|
||
#[allow(dead_code)] | ||
#[derive(Debug)] | ||
enum ReleaseType { | ||
/// Development Release | ||
Development, | ||
/// Stable Release Candidate | ||
Candidate(u32), | ||
/// Stable Release | ||
Stable(u32), | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct SvsmVersion { | ||
year: u32, | ||
month: u32, | ||
release_type: ReleaseType, | ||
} | ||
|
||
impl fmt::Display for SvsmVersion { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
match self.release_type { | ||
ReleaseType::Development => { | ||
write!(f, "{}.{:#02}-devel", self.year, self.month) | ||
} | ||
ReleaseType::Candidate(counter) => { | ||
write!(f, "{}.{:#02}-rc{}", self.year, self.month, counter) | ||
} | ||
ReleaseType::Stable(counter) => { | ||
write!(f, "{}.{:#02}.{}", self.year, self.month, counter) | ||
} | ||
} | ||
} | ||
} | ||
|
||
const VERSION_YEAR: u32 = 2025; | ||
const VERSION_MONTH: u32 = 1; | ||
#[allow(dead_code)] | ||
const VERSION_COUNTER: u32 = 0; | ||
|
||
pub static COCONUT_VERSION: SvsmVersion = SvsmVersion { | ||
year: VERSION_YEAR, | ||
month: VERSION_MONTH, | ||
release_type: ReleaseType::Development, | ||
}; |