1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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)
}
}
|