Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support newer bootleby format #499

Merged
merged 1 commit into from
Jul 30, 2024
Merged

Support newer bootleby format #499

merged 1 commit into from
Jul 30, 2024

Conversation

labbott
Copy link
Contributor

@labbott labbott commented Jul 25, 2024

Newer bootleby looks like a hubris archive

@labbott
Copy link
Contributor Author

labbott commented Jul 25, 2024

Fixes #498

@labbott labbott force-pushed the newer_bootleby branch 2 times, most recently from b1f5314 to b61ee3c Compare July 25, 2024 19:26
Newer bootleby looks like a hubris archive
@@ -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") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably do something like this (untested)

let img_bootleby = {
    let mut entry = zip
        .by_name("bootleby.bin")
        .or_else("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 binary")?;
    data
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I wanted to do something like that but or_else requires a closure FnOnce(E) -> Result<T, F>. I gave up trying to figure out the correct combinator incantation.

@labbott labbott merged commit 679758e into master Jul 30, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants