Skip to content

Commit

Permalink
Merge branch 'main' into range-requests
Browse files Browse the repository at this point in the history
  • Loading branch information
smklein committed Nov 4, 2024
2 parents c195b03 + 122eccf commit 2c66da4
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/hakari.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
toolchain: stable
- name: Install cargo-hakari
uses: taiki-e/install-action@939f4af9602e15ef93b3329722569cb907a004ff # v2
uses: taiki-e/install-action@4b40a9728e3c110fabe8850443d8bbe69daddb22 # v2
with:
tool: cargo-hakari
- name: Check workspace-hack Cargo.toml is up-to-date
Expand Down
82 changes: 79 additions & 3 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,8 @@ wicket-common = { path = "wicket-common" }
wicketd-api = { path = "wicketd-api" }
wicketd-client = { path = "clients/wicketd-client" }
zeroize = { version = "1.8.1", features = ["zeroize_derive", "std"] }
zip = { version = "0.6.6", default-features = false, features = ["deflate","bzip2"] }
# NOTE: Avoid upgrading zip until https://github.com/zip-rs/zip2/issues/231 is resolved
zip = { version = "=2.1.3", default-features = false, features = ["deflate","bzip2"] }
zone = { version = "0.3", default-features = false, features = ["async"] }

# newtype-uuid is set to default-features = false because we don't want to
Expand Down
17 changes: 11 additions & 6 deletions tufaceous-lib/src/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ use std::{
fmt,
io::{BufReader, BufWriter, Cursor, Read, Seek},
};
use zip::{write::FileOptions, CompressionMethod, ZipArchive, ZipWriter};
use zip::{
write::{FileOptions, SimpleFileOptions},
CompressionMethod, ZipArchive, ZipWriter,
};

/// A builder for TUF repo archives.
#[derive(Debug)]
Expand Down Expand Up @@ -65,18 +68,20 @@ impl ArchiveBuilder {
Ok(())
}

pub fn finish(mut self) -> Result<()> {
let zip_file = self.writer.finish().with_context(|| {
format!("error finalizing archive at `{}`", self.output_path)
pub fn finish(self) -> Result<()> {
let Self { writer, output_path } = self;

let zip_file = writer.0.finish().with_context(|| {
format!("error finalizing archive at `{}`", output_path)
})?;
zip_file.into_inner().with_context(|| {
format!("error writing archive at `{}`", self.output_path)
format!("error writing archive at `{}`", output_path)
})?;

Ok(())
}

fn file_options() -> FileOptions {
fn file_options() -> SimpleFileOptions {
// The main purpose of the zip archive is to transmit archives that are
// already compressed, so there's no point trying to re-compress them.
FileOptions::default().compression_method(CompressionMethod::Stored)
Expand Down
2 changes: 2 additions & 0 deletions workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ uuid = { version = "1.10.0", features = ["serde", "v4"] }
x509-cert = { version = "0.2.5" }
zerocopy = { version = "0.7.35", features = ["derive", "simd"] }
zeroize = { version = "1.8.1", features = ["std", "zeroize_derive"] }
zip = { version = "0.6.6", default-features = false, features = ["bzip2", "deflate"] }

[build-dependencies]
ahash = { version = "0.8.11" }
Expand Down Expand Up @@ -250,6 +251,7 @@ uuid = { version = "1.10.0", features = ["serde", "v4"] }
x509-cert = { version = "0.2.5" }
zerocopy = { version = "0.7.35", features = ["derive", "simd"] }
zeroize = { version = "1.8.1", features = ["std", "zeroize_derive"] }
zip = { version = "0.6.6", default-features = false, features = ["bzip2", "deflate"] }

[target.x86_64-unknown-linux-gnu.dependencies]
cookie = { version = "0.18.1", default-features = false, features = ["percent-encode"] }
Expand Down

0 comments on commit 2c66da4

Please sign in to comment.