From 0a42351bc63ac6da4cea0a6c2b63f91806952d5e Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Thu, 25 Jul 2024 15:00:42 -0400 Subject: [PATCH] Support newer bootleby format Newer bootleby looks like a hubris archive --- Cargo.lock | 2 +- Cargo.toml | 2 +- cmd/rebootleby/src/lib.rs | 9 ++++++++- tests/cli_tests.rs | 4 ++-- tests/cmd/chip.trycmd | 4 ++-- tests/cmd/version.trycmd | 4 ++-- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a1418f34c..668a07cdc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "humility" -version = "0.11.9" +version = "0.11.10" dependencies = [ "anyhow", "bitfield", diff --git a/Cargo.toml b/Cargo.toml index 8ed0b19b4..0e0cf2091 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ name = "humility" # # Be sure to check in and push all of the files that change. Happy versioning! # -version = "0.11.9" +version = "0.11.10" authors = ["Bryan Cantrill "] edition = "2018" license = "MPL-2.0" diff --git a/cmd/rebootleby/src/lib.rs b/cmd/rebootleby/src/lib.rs index 70626ab40..61c3ca0b6 100644 --- a/cmd/rebootleby/src/lib.rs +++ b/cmd/rebootleby/src/lib.rs @@ -42,13 +42,20 @@ fn rebootleby(context: &mut ExecutionContext) -> Result<()> { let mut zip = ZipArchive::new(bundle_reader).context("opening bundle file as ZIP")?; - let img_bootleby = { + let img_bootleby = if zip.file_names().any(|x| x == "bootleby.bin") { let mut entry = zip .by_name("bootleby.bin") .context("can't find bootleby.bin in bundle")?; let mut data = vec![]; entry.read_to_end(&mut data).context("reading bootleby.bin")?; data + } else { + let mut entry = zip + .by_name("img/final.bin") + .context("can't find bootleby.bin or img/final.bin in bundle")?; + let mut data = vec![]; + entry.read_to_end(&mut data).context("reading bootleby.bin")?; + data }; let img_cmpa = { let mut entry = diff --git a/tests/cli_tests.rs b/tests/cli_tests.rs index 49031ad5a..d8c2bb5b9 100644 --- a/tests/cli_tests.rs +++ b/tests/cli_tests.rs @@ -76,7 +76,7 @@ fn make_tests(tests: &[Test], kind: Kind) -> Result<()> { if let Some(f) = path.file_name() { if let Some(s) = f.to_str() { - if let Some(name) = s.strip_prefix(&kind.prefix()) { + if let Some(name) = s.strip_prefix(kind.prefix()) { input.push((name.to_string(), s.to_string())); } } @@ -112,7 +112,7 @@ fn make_tests(tests: &[Test], kind: Kind) -> Result<()> { let testcmd = if let Some(arg) = test.arg { format!("{} {arg}", test.cmd) } else { - format!("{}", test.cmd) + test.cmd.to_string() }; writeln!( diff --git a/tests/cmd/chip.trycmd b/tests/cmd/chip.trycmd index 3b6c69ccd..eba6ffdd4 100644 --- a/tests/cmd/chip.trycmd +++ b/tests/cmd/chip.trycmd @@ -13,7 +13,7 @@ For more information try --help ``` $ humility --chip this-can-be-anything -V -humility 0.11.9 +humility 0.11.10 ``` @@ -28,7 +28,7 @@ For more information try --help ``` $ humility -c apx432 -V -humility 0.11.9 +humility 0.11.10 ``` diff --git a/tests/cmd/version.trycmd b/tests/cmd/version.trycmd index 73553d411..5ec37fa4c 100644 --- a/tests/cmd/version.trycmd +++ b/tests/cmd/version.trycmd @@ -2,7 +2,7 @@ Long version flag: ``` $ humility --version -humility 0.11.9 +humility 0.11.10 ``` @@ -10,6 +10,6 @@ Short version flag: ``` $ humility -V -humility 0.11.9 +humility 0.11.10 ```