Skip to content

Commit

Permalink
[rust] Replace crate bzip2-rs with bzip2
Browse files Browse the repository at this point in the history
  • Loading branch information
bonigarcia committed Aug 21, 2023
1 parent cc55427 commit d3ccde7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 68 deletions.
55 changes: 3 additions & 52 deletions rust/Cargo.Bazel.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "b50f15009b9d7188b2c56599e319668c3625e3e8f8fdd64797cf1e22f3a73b44",
"checksum": "caaba3929b24d3586b1f404473cca35425c3804bee5f3ec0431f8ddef02c1a7e",
"crates": {
"addr2line 0.19.0": {
"name": "addr2line",
Expand Down Expand Up @@ -1129,55 +1129,6 @@
},
"license": "MIT/Apache-2.0"
},
"bzip2-rs 0.1.2": {
"name": "bzip2-rs",
"version": "0.1.2",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/bzip2-rs/0.1.2/download",
"sha256": "beeb59e7e4c811ab37cc73680c798c7a5da77fc9989c62b09138e31ee740f735"
}
},
"targets": [
{
"Library": {
"crate_name": "bzip2_rs",
"crate_root": "src/lib.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "bzip2_rs",
"common_attrs": {
"compile_data_glob": [
"**"
],
"crate_features": {
"common": [
"default"
],
"selects": {}
},
"deps": {
"common": [
{
"id": "crc32fast 1.3.2",
"target": "crc32fast"
},
{
"id": "tinyvec 1.6.0",
"target": "tinyvec"
}
],
"selects": {}
},
"edition": "2018",
"version": "0.1.2"
},
"license": "MIT/Apache-2.0"
},
"bzip2-sys 0.1.11+1.0.8": {
"name": "bzip2-sys",
"version": "0.1.11+1.0.8",
Expand Down Expand Up @@ -7688,8 +7639,8 @@
"deps": {
"common": [
{
"id": "bzip2-rs 0.1.2",
"target": "bzip2_rs"
"id": "bzip2 0.4.4",
"target": "bzip2"
},
{
"id": "clap 4.3.19",
Expand Down
12 changes: 1 addition & 11 deletions rust/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 rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ infer = "0.14.0"
exitcode = "1.1.2"
is_executable = "1.0.1"
toml = "0.7.6"
bzip2-rs = "0.1.2"
bzip2 = "0.4.4"
sevenz-rust = "0.5.0"

[dev-dependencies]
Expand Down
9 changes: 5 additions & 4 deletions rust/src/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::fs::File;
use std::io;
use std::io::{BufReader, Cursor, Read};

use bzip2_rs::DecoderReader;
use bzip2::read::BzDecoder;
use std::path::{Path, PathBuf};

use crate::config::OS;
Expand Down Expand Up @@ -288,9 +288,10 @@ pub fn uncompress_bz2(
compressed_file,
target.display()
));
let file = File::open(compressed_file)?;
let tar = DecoderReader::new(file);
let mut archive = Archive::new(tar);
let mut bz_decoder = BzDecoder::new(File::open(compressed_file)?);
let mut buffer: Vec<u8> = Vec::new();
bz_decoder.read_to_end(&mut buffer)?;
let mut archive = Archive::new(Cursor::new(buffer));
if !target.exists() {
for entry in archive.entries()? {
let mut entry_decoder = entry?;
Expand Down

0 comments on commit d3ccde7

Please sign in to comment.