Skip to content

Commit

Permalink
Support newer bootleby format
Browse files Browse the repository at this point in the history
Newer bootleby looks like a hubris archive
  • Loading branch information
labbott committed Jul 25, 2024
1 parent 9948f3f commit b1f5314
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
edition = "2018"
license = "MPL-2.0"
Expand Down
24 changes: 16 additions & 8 deletions cmd/rebootleby/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,22 @@ fn rebootleby(context: &mut ExecutionContext) -> Result<()> {
let mut zip =
ZipArchive::new(bundle_reader).context("opening bundle file as ZIP")?;

let img_bootleby = {
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
};
let img_bootleby =
if zip.file_names().find(|&x| x == "bootleby.bin").is_some() {

Check failure on line 46 in cmd/rebootleby/src/lib.rs

View workflow job for this annotation

GitHub Actions / Clippy

called `is_some()` after searching an `Iterator` with `find`
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 =
zip.by_name("cmpa.bin").context("can't find cmpa.bin in bundle")?;
Expand Down
4 changes: 2 additions & 2 deletions tests/cli_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
}
Expand Down Expand Up @@ -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!(
Expand Down
4 changes: 2 additions & 2 deletions tests/cmd/chip.trycmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For more information try --help

```
$ humility --chip this-can-be-anything -V
humility 0.11.9
humility 0.11.10

```

Expand All @@ -28,7 +28,7 @@ For more information try --help

```
$ humility -c apx432 -V
humility 0.11.9
humility 0.11.10

```

4 changes: 2 additions & 2 deletions tests/cmd/version.trycmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ Long version flag:

```
$ humility --version
humility 0.11.9
humility 0.11.10

```

Short version flag:

```
$ humility -V
humility 0.11.9
humility 0.11.10

```

0 comments on commit b1f5314

Please sign in to comment.