Skip to main content

rto_exec/
runtime_file_pins.rs

1// GENERATED FILE — do not edit by hand.
2//
3// Regenerate with:
4//
5//     scripts/derive-runtime-file-pins.py
6//
7// # What these are, and why they are derived rather than written
8//
9// `boxlite` downloads the runtime archive, extracts it into its own OUT_DIR and
10// `include_bytes!`s **the extracted files** into the rlib. Those files are what
11// ends up in the binary, so those are what `build.rs` verifies — one digest per
12// file per platform, checked after extraction and before anything is linked.
13//
14// The archive pins in `runtime_pins.rs` remain the source of truth. This file is
15// a mechanical function of them: the generator verifies each archive against its
16// own pin before opening it, then hashes every member. A `boxlite` bump is
17// therefore `runtime_pins.rs` + re-run the generator + review the diff, never
18// fifteen hand-typed hex strings.
19//
20// Standalone on purpose — **no `use`, no `crate::` paths** — because `build.rs`
21// pulls it in with `include!`, exactly as it does `runtime_pins.rs`.
22
23/// One file as it must appear in `boxlite`'s extracted runtime directory.
24#[derive(Debug, Clone, Copy, PartialEq, Eq)]
25pub struct PinnedFile {
26    /// Its name in the runtime directory — the archive member with the
27    /// leading `boxlite-runtime/` component stripped, as
28    /// `tar --strip-components=1` leaves it.
29    pub name: &'static str,
30    /// Lowercase hex SHA-256 of its contents.
31    pub sha256: &'static str,
32    /// Its exact size in bytes.
33    pub bytes: u64,
34}
35
36/// One platform's extracted runtime files.
37#[derive(Debug, Clone, Copy, PartialEq, Eq)]
38pub struct PinnedRuntimeFiles {
39    /// The platform, as the upstream release names it.
40    pub target: &'static str,
41    /// The archive these were derived from, so a bumped archive pin that
42    /// nobody re-derived is a test failure rather than a silent mismatch.
43    pub archive_sha256: &'static str,
44    /// Every file the archive contributes, sorted by name.
45    pub files: &'static [PinnedFile],
46}
47
48/// The `boxlite` release these were derived from.
49pub const RUNTIME_FILES_VERSION: &str = "0.10.0";
50
51/// Every pinned platform's extracted runtime files.
52pub const RUNTIME_FILES: &[PinnedRuntimeFiles] = &[
53    PinnedRuntimeFiles {
54        target: "darwin-arm64",
55        archive_sha256: "8867bb02687c02a8ab6975c1dd8ef85d549dba9e5e94087cb7fb61838b56d979",
56        files: &[
57            PinnedFile {
58                name: "boxlite-guest",
59                sha256: "b9d7905916ee8b46ef4a4e18b22623aca05ce9a6683e453bc2d5835d5106595f",
60                bytes: 20_526_368,
61            },
62            PinnedFile {
63                name: "boxlite-shim",
64                sha256: "c1e8bfb8c81aa17bcc905fcf20e4c4df2935b32c5365b9a22ef92d8728f0876f",
65                bytes: 23_338_128,
66            },
67            PinnedFile {
68                name: "debugfs",
69                sha256: "d65b062b98f7cc712e076cc9074897fa5bc808273fd3e7543b6067aefde42be2",
70                bytes: 661_800,
71            },
72            PinnedFile {
73                name: "guest-mke2fs",
74                sha256: "f2db9033e783447cdb36aefb5e64d60cffa68d3eef155cce2d9b49b501e5a3b4",
75                bytes: 737_312,
76            },
77            PinnedFile {
78                name: "guest-resize2fs",
79                sha256: "0ec5291f557eff335dc6dc4f0edcd1adac21a5f44cc15a1193fba8c1612f3524",
80                bytes: 563_872,
81            },
82            PinnedFile {
83                name: "libkrunfw.5.dylib",
84                sha256: "4735ad1eb68b8ae82222f0085fbab213ba25952d75f91f83fd7078c5c6913cd3",
85                bytes: 23_762_768,
86            },
87            PinnedFile {
88                name: "mke2fs",
89                sha256: "c1e314367f92ec668ca02644a1d7d07bf738d48b5782f3422f0629c11295f47d",
90                bytes: 577_560,
91            },
92        ],
93    },
94    PinnedRuntimeFiles {
95        target: "linux-arm64-gnu",
96        archive_sha256: "e67786ba493430bed70e992fcd7248f4a71e1eaf562ddbbb016f478d044ca4cf",
97        files: &[
98            PinnedFile {
99                name: "boxlite-guest",
100                sha256: "34982642a3a2afe7dad8f3a97dbcc951b4d94515c0dc8c35e854d2383a36a35d",
101                bytes: 20_523_288,
102            },
103            PinnedFile {
104                name: "boxlite-shim",
105                sha256: "3bc4b2182c52d36089523d1d098cec3fe88a7dbf633fbc3ed8f470cb404f8550",
106                bytes: 27_033_936,
107            },
108            PinnedFile {
109                name: "bwrap",
110                sha256: "e36661910bbb5933b42a1403b8409066471570bc99d129fb67f3399da01d03e1",
111                bytes: 307_120,
112            },
113            PinnedFile {
114                name: "debugfs",
115                sha256: "f581b714e1e282481e6521b88108ac6562edad8940e0052d5b081c8aa77f6365",
116                bytes: 3_593_336,
117            },
118            PinnedFile {
119                name: "guest-mke2fs",
120                sha256: "205fdbb6efb8234ba13967ece6c9a4098a74ca955fd784824cb004c87b02976c",
121                bytes: 645_720,
122            },
123            PinnedFile {
124                name: "guest-resize2fs",
125                sha256: "47e2659d5577bedc109de8f3427d42a26af1234669c563e50cc099961a9d0aca",
126                bytes: 472_048,
127            },
128            PinnedFile {
129                name: "libkrunfw.so.5",
130                sha256: "a47fad6c557420899b7e079c63227b4660c365bbb1c7def0428bf6352786a321",
131                bytes: 23_791_889,
132            },
133            PinnedFile {
134                name: "mke2fs",
135                sha256: "ac74dac5f83abc2bf0629e25ba39d56b8806a808b21e260ec25a527b5df55baf",
136                bytes: 3_052_784,
137            },
138        ],
139    },
140    PinnedRuntimeFiles {
141        target: "linux-x64-gnu",
142        archive_sha256: "3de43b2ca1620f7d73b71630be7f9e26f13f28497a4a692617a663dde0c8400f",
143        files: &[
144            PinnedFile {
145                name: "boxlite-guest",
146                sha256: "7eb2088aa3a5ffe51186a16bae214568e513edb4684034da0180bbed4986a479",
147                bytes: 21_145_160,
148            },
149            PinnedFile {
150                name: "boxlite-shim",
151                sha256: "27735820133cfae77056150b91c56fdcb912a62536383ba2fd1bc7025051c5d6",
152                bytes: 29_756_096,
153            },
154            PinnedFile {
155                name: "bwrap",
156                sha256: "697ad1697342ecd415addbfc91d4dfee73a4d543239e03ed854e559f137d680c",
157                bytes: 187_376,
158            },
159            PinnedFile {
160                name: "debugfs",
161                sha256: "35f189fd3a715e0bfa94e92ffb12c539a09c7b0a5b760fef902452e5e129ae57",
162                bytes: 3_374_856,
163            },
164            PinnedFile {
165                name: "guest-mke2fs",
166                sha256: "a5dfe7496d2a56da6f5060557846f9f3752e07064fcdb0ecde3906f876011aca",
167                bytes: 560_048,
168            },
169            PinnedFile {
170                name: "guest-resize2fs",
171                sha256: "0a2c15cb20fa3e369a02e9712c611037a89236bc52ad109daf02c3d33a19ee97",
172                bytes: 399_448,
173            },
174            PinnedFile {
175                name: "libkrunfw.so.5",
176                sha256: "953201c0c367070946a2f99695cb50dbb8980d97e416964bfa3fb1e9d1f15f69",
177                bytes: 21_431_992,
178            },
179            PinnedFile {
180                name: "mke2fs",
181                sha256: "76bfb9a5de67275f5275f1b65fd99d8a30d8e02c58d3532d9b96d6c99634b867",
182                bytes: 2_831_648,
183            },
184        ],
185    },
186];
187
188/// The extracted-file pins for an upstream target name.
189#[must_use]
190pub fn runtime_files_for(target: &str) -> Option<&'static PinnedRuntimeFiles> {
191    let mut index = 0;
192    // A plain loop rather than an iterator, matching `runtime_pins.rs`: this file
193    // is `include!`d into a build script, where keeping to the language core is
194    // the point.
195    while index < RUNTIME_FILES.len() {
196        if RUNTIME_FILES[index].target.as_bytes() == target.as_bytes() {
197            return Some(&RUNTIME_FILES[index]);
198        }
199        index += 1;
200    }
201    None
202}