-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Knowledge about how to construct a Hubris archive and how to access the components within should be centralized into the hubtools repo.
This would improve our ability to maintain the code, test the code and our understanding of archive behavior, and make changes without breaking other repos. Any code found outside of hubtools that knows about the zip file contents is a candidate for refactoring into a hubtools function.
As an example, knowledge about the "img/final.bin" and "img/final.elf" files is distributed between several crates. When the archive is first constructed, care is taken to make sure that the executable contained in "img/final.elf" matches the contents of "img/final.bin". "img/final.bin" is essentially a cached copy of that part of "img/final.elf". Note the code in MGS that checks that the two files match. It doesn't seem right that this check is outside of hubtools.
facade/mfgtool/src/main.rs: let mut af = match archive.by_name("img/final.bin") {
hubris/master/build/xtask/src/dist.rs: .extract_file("img/final.bin")
humility/cmd/gdb/src/lib.rs: .extract_file_to("img/final.elf", &work_dir.path().join("final.elf"))?;
humility/cmd/rebootleby/src/lib.rs: .by_name("img/final.bin")
humility/cmd/rebootleby/src/lib.rs: .context("can't find bootleby.bin or img/final.bin in bundle")?;
humility/humility-core/src/hubris.rs: .by_name("img/final.elf")
humility/humility-core/src/hubris.rs: .by_name("img/final.elf")
humility/humility-core/src/hubris.rs: elf: slurp!("img/final.elf"),
management-gateway-service/gateway-sp-comms/src/single_sp/update.rs: "hubtools `image.to_binary()` DOES NOT MATCH `img/final.bin`",
management-gateway-service/gateway-sp-comms/src/single_sp/update.rs: "hubtools `image.to_binary()` DOES NOT MATCH `img/final.bin`",
management-gateway-service/gateway-sp-comms/src/single_sp/update.rs: if let Ok(final_bin) = archive.extract_file("img/final.bin")
management-gateway-service/gateway-sp-comms/src/single_sp/update.rs: if let Ok(final_bin) = archive.extract_file("img/final.bin") {
management-gateway-service/gateway-sp-comms/src/single_sp/update.rs: // would manually extract `img/final.bin` from the archive