diff options
| author | Hermes Agent <hermes@localhost> | 2026-08-12 00:04:41 +0000 |
|---|---|---|
| committer | Hermes Agent <hermes@localhost> | 2026-08-12 00:04:41 +0000 |
| commit | c24c00c1d89990d44d796c4fd2b84e92162b044a (patch) | |
| tree | a58cd6fc3aaf473463dd1e51315043064787f53f /src/stage.rs | |
| parent | 191e2b7429ff4547b5fdd0fbfcff943ce96c2d68 (diff) | |
Add validated image build stage graph
Diffstat (limited to 'src/stage.rs')
| -rw-r--r-- | src/stage.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/stage.rs b/src/stage.rs new file mode 100644 index 0000000..612b594 --- /dev/null +++ b/src/stage.rs @@ -0,0 +1,45 @@ +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Stage { + Resolve, + Install, + FinalizeRootfs, + BuildInitramfs, + Package, + Manifest, +} + +impl Stage { + pub const ORDERED: [Self; 6] = [ + Self::Resolve, + Self::Install, + Self::FinalizeRootfs, + Self::BuildInitramfs, + Self::Package, + Self::Manifest, + ]; + + pub fn dependencies(self) -> &'static [Self] { + match self { + Self::Resolve => &[], + Self::Install => &[Self::Resolve], + Self::FinalizeRootfs => &[Self::Install], + Self::BuildInitramfs => &[Self::Install], + Self::Package => &[Self::FinalizeRootfs, Self::BuildInitramfs], + Self::Manifest => &[Self::Package], + } + } +} + +impl std::fmt::Display for Stage { + fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let name = match self { + Self::Resolve => "resolve", + Self::Install => "install", + Self::FinalizeRootfs => "finalize-rootfs", + Self::BuildInitramfs => "initramfs", + Self::Package => "package", + Self::Manifest => "manifest", + }; + formatter.write_str(name) + } +} |