This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new 3b202c5  chore: switch dependency from xz2 to liblzma (#284)
3b202c5 is described below

commit 3b202c58f12bd1217eccf8a0028e4176ee4aadf9
Author: Tim Saucer <[email protected]>
AuthorDate: Wed Sep 10 16:45:22 2025 -0400

    chore: switch dependency from xz2 to liblzma (#284)
---
 Cargo.lock        | 42 +++++++++++++++++++++---------------------
 avro/Cargo.toml   |  4 ++--
 avro/README.md    |  2 +-
 avro/src/codec.rs |  4 ++--
 avro/src/lib.rs   |  2 +-
 5 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 3a0a44b..fe2c316 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -58,6 +58,7 @@ dependencies = [
  "criterion",
  "digest",
  "hex-literal",
+ "liblzma",
  "log",
  "md-5",
  "miniz_oxide",
@@ -78,7 +79,6 @@ dependencies = [
  "strum_macros",
  "thiserror",
  "uuid",
- "xz2",
  "zstd",
 ]
 
@@ -699,6 +699,26 @@ version = "0.2.175"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
 
+[[package]]
+name = "liblzma"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "10bf66f4598dc77ff96677c8e763655494f00ff9c1cf79e2eb5bb07bc31f807d"
+dependencies = [
+ "liblzma-sys",
+]
+
+[[package]]
+name = "liblzma-sys"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "01b9596486f6d60c3bbe644c0e1be1aa6ccc472ad630fe8927b456973d7cb736"
+dependencies = [
+ "cc",
+ "libc",
+ "pkg-config",
+]
+
 [[package]]
 name = "libm"
 version = "0.2.15"
@@ -721,17 +741,6 @@ version = "0.4.28"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
 
-[[package]]
-name = "lzma-sys"
-version = "0.1.20"
-source = "registry+https://github.com/rust-lang/crates.io-index";
-checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
-]
-
 [[package]]
 name = "md-5"
 version = "0.10.6"
@@ -1610,15 +1619,6 @@ version = "0.45.0"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 checksum = "052283831dbae3d879dc7f51f3d92703a316ca49f91540417d38591826127814"
 
-[[package]]
-name = "xz2"
-version = "0.1.7"
-source = "registry+https://github.com/rust-lang/crates.io-index";
-checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2"
-dependencies = [
- "lzma-sys",
-]
-
 [[package]]
 name = "yansi"
 version = "1.0.1"
diff --git a/avro/Cargo.toml b/avro/Cargo.toml
index adac23d..b87bfe8 100644
--- a/avro/Cargo.toml
+++ b/avro/Cargo.toml
@@ -32,7 +32,7 @@ documentation.workspace = true
 bzip = ["dep:bzip2"]
 derive = ["dep:apache-avro-derive"]
 snappy = ["dep:crc32fast", "dep:snap"]
-xz = ["dep:xz2"]
+xz = ["dep:liblzma"]
 zstandard = ["dep:zstd"]
 
 [lib]
@@ -71,7 +71,7 @@ strum = { default-features = false, version = "0.27.2" }
 strum_macros = { default-features = false, version = "0.27.2" }
 thiserror = { default-features = false, version = "2.0.16" }
 uuid = { default-features = false, version = "1.18.1", features = ["serde", 
"std"] }
-xz2 = { default-features = false, version = "0.1.7", optional = true }
+liblzma = { default-features = false, version = "0.4.4", optional = true }
 zstd = { default-features = false, version = "0.13.3", optional = true }
 
 
diff --git a/avro/README.md b/avro/README.md
index 3dd2c91..51bc88a 100644
--- a/avro/README.md
+++ b/avro/README.md
@@ -294,7 +294,7 @@ Avro supports three different compression codecs when 
encoding data:
   You must enable the `zstandard` feature to use this codec.
 * **Bzip2**: uses [BZip2](https://sourceware.org/bzip2/) compression library.
   You must enable the `bzip` feature to use this codec.
-* **Xz**: uses [xz2](https://github.com/alexcrichton/xz2-rs) compression 
library.
+* **Xz**: uses 
[liblzma](https://github.com/portable-network-archive/liblzma-rs) compression 
library.
   You must enable the `xz` feature to use this codec.
 
 To specify a codec to use to compress data, just specify it while creating a 
`Writer`:
diff --git a/avro/src/codec.rs b/avro/src/codec.rs
index 4885535..813dc15 100644
--- a/avro/src/codec.rs
+++ b/avro/src/codec.rs
@@ -123,8 +123,8 @@ impl Codec {
             }
             #[cfg(feature = "xz")]
             Codec::Xz(settings) => {
+                use liblzma::read::XzEncoder;
                 use std::io::Read;
-                use xz2::read::XzEncoder;
 
                 let mut encoder = XzEncoder::new(&stream[..], 
settings.compression_level as u32);
                 let mut buffer = Vec::new();
@@ -202,7 +202,7 @@ impl Codec {
             }
             #[cfg(feature = "xz")]
             Codec::Xz(_) => {
-                use xz2::read::XzDecoder;
+                use liblzma::read::XzDecoder;
                 use std::io::Read;
 
                 let mut decoder = XzDecoder::new(&stream[..]);
diff --git a/avro/src/lib.rs b/avro/src/lib.rs
index 36a31e6..6ec1a33 100644
--- a/avro/src/lib.rs
+++ b/avro/src/lib.rs
@@ -309,7 +309,7 @@
 //!   You must enable the `zstandard` feature to use this codec.
 //! * **Bzip2**: uses [BZip2](https://sourceware.org/bzip2/) compression 
library.
 //!   You must enable the `bzip` feature to use this codec.
-//! * **Xz**: uses [xz2](https://github.com/alexcrichton/xz2-rs) compression 
library.
+//! * **Xz**: uses 
[liblzma](https://github.com/portable-network-archive/liblzma-rs) compression 
library.
 //!   You must enable the `xz` feature to use this codec.
 //!
 //! To specify a codec to use to compress data, just specify it while creating 
a `Writer`:

Reply via email to