Skip to content

Commit

Permalink
Refactor xz/lzma decompression code
Browse files Browse the repository at this point in the history
  • Loading branch information
kpcyrd committed Nov 11, 2024
1 parent e024e74 commit 053ce85
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 48 deletions.
46 changes: 4 additions & 42 deletions Cargo.lock

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

5 changes: 2 additions & 3 deletions tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ structopt = "0.3.26"
env_logger = "0.9.0"
reqwest = { version="0.11.11", features=["json"] }
chrono = { version = "0.4.19", features=["serde"] }
rust-lzma = "0.5.1"
tar = "0.4.38"
flate2 = "1.0.24"
serde = { version="1.0.137", features=["derive"] }
Expand All @@ -35,8 +34,8 @@ tokio = { version="1.19.2", features=["macros", "rt-multi-thread", "io-std", "io
atty = "0.2.14"
tree_magic_mini = "3.0.3"
bzip2 = "0.4.3"
xz = "0.1.0"
zstd = { version = "0.11.2", features = ["pkg-config"] }
xz2 = "0.1"
zstd = { version = "0.13", features = ["pkg-config"] }
regex = "1.5.6"
url = "2.2.2"

Expand Down
2 changes: 1 addition & 1 deletion tools/src/decompress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use rebuilderd_common::errors::*;
use std::io::Read;
use flate2::read::GzDecoder;
use bzip2::read::BzDecoder;
use xz::read::XzDecoder;
use xz2::read::XzDecoder;

#[derive(Debug, PartialEq, Eq)]
pub enum CompressedWith {
Expand Down
4 changes: 2 additions & 2 deletions tools/src/schedule/debian.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::args::PkgsSync;
use crate::schedule::{Pkg, fetch_url_or_path};
use lzma::LzmaReader;
use xz2::read::XzDecoder;
use rebuilderd_common::{PkgGroup, PkgArtifact};
use rebuilderd_common::errors::*;
use std::collections::HashMap;
Expand Down Expand Up @@ -194,7 +194,7 @@ impl AnyhowTryFrom<NewPkg> for DebianBinPkg {
}

pub fn extract_pkg<T: AnyhowTryFrom<NewPkg>>(bytes: &[u8]) -> Result<Vec<T>> {
let r = LzmaReader::new_decompressor(bytes)?;
let r = XzDecoder::new(bytes);
let r = BufReader::new(r);
extract_pkgs_uncompressed(r)
}
Expand Down

0 comments on commit 053ce85

Please sign in to comment.