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

Upgrade zip to 2.1.3 #6964

Merged
merged 5 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading