diff --git a/Cargo.lock b/Cargo.lock index 282082b..b59b75b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -383,6 +383,11 @@ name = "lazycell" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "libc" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "libc" version = "0.2.43" @@ -414,7 +419,6 @@ dependencies = [ "number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-lzma 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.71 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.71 (registry+https://github.com/rust-lang/crates.io-index)", @@ -425,6 +429,7 @@ dependencies = [ "walkdir 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "web-view 0.2.1 (git+https://github.com/Boscop/web-view.git?rev=555f422d09cbb94e82a728d47e9e07ca91963f6e)", "winres 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "xz-decom 0.2.0 (git+https://github.com/j-selby/xz-decom.git?rev=f5e9576)", "zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -806,14 +811,6 @@ dependencies = [ "uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rust-lzma" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "pkg-config 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "safemem" version = "0.2.0" @@ -1391,6 +1388,23 @@ dependencies = [ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "xz-decom" +version = "0.2.0" +source = "git+https://github.com/j-selby/xz-decom.git?rev=f5e9576#f5e9576c71b7476689821991f51fcf0cdc93aa96" +dependencies = [ + "xz-embedded-sys 0.1.1 (git+https://github.com/j-selby/xz-decom.git?rev=f5e9576)", +] + +[[package]] +name = "xz-embedded-sys" +version = "0.1.1" +source = "git+https://github.com/j-selby/xz-decom.git?rev=f5e9576#f5e9576c71b7476689821991f51fcf0cdc93aa96" +dependencies = [ + "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "zip" version = "0.4.2" @@ -1452,6 +1466,7 @@ dependencies = [ "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" "checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef" +"checksum libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "e32a70cf75e5846d53a673923498228bbec6a8624708a9ea5645f075d6276122" "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" "checksum libflate 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "7d4b4c7aff5bac19b956f693d0ea0eade8066deb092186ae954fa6ba14daab98" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" @@ -1496,7 +1511,6 @@ dependencies = [ "checksum relay 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1576e382688d7e9deecea24417e350d3062d97e32e45d70b1cde65994ff1489a" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" "checksum reqwest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e237e32c3bfa55c95e29af872c8f481471d70b8a5ec15d85f4d274ffd92dd9" -"checksum rust-lzma 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "032cc29d0d39e6a19bd34b9ef9f23bbcf010d5572d1a4f6b6ed101ba492163f2" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637" "checksum schannel 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "dc1fabf2a7b6483a141426e1afd09ad543520a77ac49bd03c286e7696ccfd77f" @@ -1567,4 +1581,6 @@ dependencies = [ "checksum winres 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f07dabda4e79413ecac65bc9a2234ad3d85dc49f9d289f868cd9d8611d88f28d" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" +"checksum xz-decom 0.2.0 (git+https://github.com/j-selby/xz-decom.git?rev=f5e9576)" = "" +"checksum xz-embedded-sys 0.1.1 (git+https://github.com/j-selby/xz-decom.git?rev=f5e9576)" = "" "checksum zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "36b9e08fb518a65cf7e08a1e482573eb87a2f4f8c6619316612a3c1f162fe822" diff --git a/Cargo.toml b/Cargo.toml index 90ee281..a1bbf24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ regex = "0.2" dirs = "1.0" zip = "0.4.2" -rust-lzma = "0.3" +xz-decom = {git = "https://github.com/j-selby/xz-decom.git", rev = "f5e9576"} tar = "0.4" log = "0.4" diff --git a/src/archives/mod.rs b/src/archives/mod.rs index 97955ff..f3a1198 100644 --- a/src/archives/mod.rs +++ b/src/archives/mod.rs @@ -10,7 +10,7 @@ use std::io::Read; use std::iter::Iterator; use std::path::PathBuf; -use lzma::LzmaReader; +use xz_decom; pub trait Archive<'a> { /// func: iterator value, max size, file name, file contents @@ -92,10 +92,10 @@ pub fn read_archive<'a>(name: &str, data: &'a [u8]) -> Result + Ok(Box::new(ZipArchive { archive })) } else if name.ends_with(".tar.xz") { // Decompress a .tar.xz file - let decompressed_contents: Box = Box::new( - LzmaReader::new_decompressor(Cursor::new(data)) - .map_err(|x| format!("Failed to build decompressor: {:?}", x))?, - ); + let decompressed_data = xz_decom::decompress(data) + .map_err(|x| format!("Failed to build decompressor: {:?}", x))?; + + let decompressed_contents: Box = Box::new(Cursor::new(decompressed_data)); let tar = UpstreamTarArchive::new(decompressed_contents); diff --git a/src/main.rs b/src/main.rs index 8f080fe..d003028 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,8 +29,8 @@ extern crate regex; extern crate semver; extern crate dirs; -extern crate lzma; extern crate tar; +extern crate xz_decom; extern crate zip; extern crate fern;