Skip to content

Commit

Permalink
Replace xz2 crate with liblzma crate
Browse files Browse the repository at this point in the history
  • Loading branch information
dralley authored and drahnr committed Feb 17, 2025
1 parent e6845b1 commit 31e5d28
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Bump `pgp` to 0.14.0
- Replaced unmaintained `xz2` dependency with the maintained `liblzma` fork

### Breaking Changes

Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ log = "0.4"
itertools = "0.13"
hex = { version = "0.4", features = ["std"] }
zstd = { version = "0.13", optional = true }
xz2 = { version = "0.1", optional = true }
liblzma = { version = "0.3", optional = true }
bzip2 = { version = "0.5.0", optional = true }

[dev-dependencies]
Expand All @@ -72,7 +72,7 @@ default = [

gzip-compression = ["flate2"]
zstd-compression = ["zstd"]
xz-compression = ["xz2"]
xz-compression = ["liblzma"]
bzip2-compression = ["bzip2"]

signature-pgp = ["signature-meta", "pgp", "chrono"]
Expand Down
6 changes: 3 additions & 3 deletions src/rpm/compressor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub enum Compressor {
#[cfg(feature = "zstd-compression")]
Zstd(zstd::stream::Encoder<'static, Vec<u8>>),
#[cfg(feature = "xz-compression")]
Xz(xz2::write::XzEncoder<Vec<u8>>),
Xz(liblzma::write::XzEncoder<Vec<u8>>),
#[cfg(feature = "bzip2-compression")]
Bzip2(bzip2::write::BzEncoder<Vec<u8>>),
}
Expand Down Expand Up @@ -77,7 +77,7 @@ impl TryFrom<CompressionWithLevel> for Compressor {
Ok(Compressor::Zstd(stream))
}
#[cfg(feature = "xz-compression")]
CompressionWithLevel::Xz(level) => Ok(Compressor::Xz(xz2::write::XzEncoder::new(
CompressionWithLevel::Xz(level) => Ok(Compressor::Xz(liblzma::write::XzEncoder::new(
Vec::new(),
level,
))),
Expand Down Expand Up @@ -216,7 +216,7 @@ pub(crate) fn decompress_stream(
#[cfg(feature = "zstd-compression")]
CompressionType::Zstd => Ok(Box::new(zstd::stream::Decoder::new(reader)?)),
#[cfg(feature = "xz-compression")]
CompressionType::Xz => Ok(Box::new(xz2::bufread::XzDecoder::new(reader))),
CompressionType::Xz => Ok(Box::new(liblzma::bufread::XzDecoder::new(reader))),
#[cfg(feature = "bzip2-compression")]
CompressionType::Bzip2 => Ok(Box::new(bzip2::bufread::BzDecoder::new(reader))),
// This is an issue when building with all compression types enabled
Expand Down

0 comments on commit 31e5d28

Please sign in to comment.