summaryrefslogtreecommitdiff
path: root/src/stage.rs
diff options
context:
space:
mode:
authorHermes Agent <hermes@localhost>2026-08-12 00:04:41 +0000
committerHermes Agent <hermes@localhost>2026-08-12 00:04:41 +0000
commitc24c00c1d89990d44d796c4fd2b84e92162b044a (patch)
treea58cd6fc3aaf473463dd1e51315043064787f53f /src/stage.rs
parent191e2b7429ff4547b5fdd0fbfcff943ce96c2d68 (diff)
Add validated image build stage graph
Diffstat (limited to 'src/stage.rs')
-rw-r--r--src/stage.rs45
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)
+ }
+}