Skip to content

Commit

Permalink
Upgrade zip to 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
smklein committed Oct 30, 2024
1 parent ffb728d commit 60afee4
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 10 deletions.
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.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ 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"] }
zip = { version = "2.2.0", 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 60afee4

Please sign in to comment.