Remove unpack zip functionality from unpack_tar_gz

This commit is contained in:
Felix Schütt
2022-11-16 13:58:37 +01:00
parent 6375a8d19b
commit aafd57ca9e
5 changed files with 17 additions and 83 deletions

72
Cargo.lock generated
View File

@@ -270,27 +270,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c58ec36aac5066d5ca17df51b3e70279f5670a72102f5752cb7e7c856adfc70" checksum = "6c58ec36aac5066d5ca17df51b3e70279f5670a72102f5752cb7e7c856adfc70"
[[package]]
name = "bzip2"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0"
dependencies = [
"bzip2-sys",
"libc",
]
[[package]]
name = "bzip2-sys"
version = "0.1.11+1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc"
dependencies = [
"cc",
"libc",
"pkg-config",
]
[[package]] [[package]]
name = "cast" name = "cast"
version = "0.3.0" version = "0.3.0"
@@ -1278,7 +1257,7 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"js-sys", "js-sys",
"libc", "libc",
"wasi 0.11.0+wasi-snapshot-preview1", "wasi",
"wasm-bindgen", "wasm-bindgen",
] ]
@@ -1956,7 +1935,7 @@ checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
"wasi 0.11.0+wasi-snapshot-preview1", "wasi",
"windows-sys 0.42.0", "windows-sys 0.42.0",
] ]
@@ -3317,17 +3296,6 @@ dependencies = [
"once_cell", "once_cell",
] ]
[[package]]
name = "time"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi",
]
[[package]] [[package]]
name = "time" name = "time"
version = "0.2.27" version = "0.2.27"
@@ -3710,12 +3678,6 @@ dependencies = [
"toml", "toml",
] ]
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.11.0+wasi-snapshot-preview1" version = "0.11.0+wasi-snapshot-preview1"
@@ -4144,7 +4106,7 @@ dependencies = [
"lazy_static", "lazy_static",
"libc", "libc",
"log", "log",
"time 0.2.27", "time",
"wasmer", "wasmer",
"wasmer-types", "wasmer-types",
] ]
@@ -4231,7 +4193,6 @@ dependencies = [
"url", "url",
"wapm-toml", "wapm-toml",
"whoami", "whoami",
"zip-extract",
] ]
[[package]] [[package]]
@@ -4366,7 +4327,7 @@ dependencies = [
"byteorder", "byteorder",
"pretty_assertions", "pretty_assertions",
"serde", "serde",
"time 0.2.27", "time",
"wasmer", "wasmer",
"wasmer-derive", "wasmer-derive",
"wasmer-types", "wasmer-types",
@@ -4897,28 +4858,3 @@ name = "yansi"
version = "0.5.1" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
[[package]]
name = "zip"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815"
dependencies = [
"byteorder",
"bzip2",
"crc32fast",
"flate2",
"thiserror",
"time 0.1.44",
]
[[package]]
name = "zip-extract"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c5cc0309f6e81ab96c2b43d5e935025f8732c886690be8f78f68e06bad1d274"
dependencies = [
"log",
"thiserror",
"zip",
]

View File

@@ -1579,6 +1579,17 @@ fn untar(tarball: std::path::PathBuf, target: std::path::PathBuf) -> Result<Vec<
.collect()) .collect())
} }
fn get_zig_exe_str() -> &'static str {
#[cfg(target_os = "windows")]
{
"zig.exe"
}
#[cfg(not(target_os = "windows"))]
{
"zig"
}
}
fn find_zig_binary(path: Option<PathBuf>) -> Result<PathBuf> { fn find_zig_binary(path: Option<PathBuf>) -> Result<PathBuf> {
use std::env::split_paths; use std::env::split_paths;
use std::ffi::OsStr; use std::ffi::OsStr;

View File

@@ -21,5 +21,4 @@ tar = "0.4.38"
flate2 = "1.0.24" flate2 = "1.0.24"
semver = "1.0.14" semver = "1.0.14"
lzma-rs = "0.2.0" lzma-rs = "0.2.0"
zip-extract = "0.1.1"
tempdir = "0.3.7" tempdir = "0.3.7"

View File

@@ -960,16 +960,6 @@ pub fn try_unpack_targz<P: AsRef<Path>>(
.map_err(|e| anyhow::anyhow!("failed to open {}: {e}", target_targz_path.display())) .map_err(|e| anyhow::anyhow!("failed to open {}: {e}", target_targz_path.display()))
}; };
let try_decode_zip = || {
let file = open_file()?;
zip_extract::extract(file, target_targz_path, strip_toplevel).map_err(|e| {
anyhow::anyhow!(
"could not extract zip file {}: {e}",
target_targz_path.display()
)
})
};
let try_decode_gz = || { let try_decode_gz = || {
let file = open_file()?; let file = open_file()?;
let gz_decoded = flate2::read::GzDecoder::new(&file); let gz_decoded = flate2::read::GzDecoder::new(&file);
@@ -1006,9 +996,7 @@ pub fn try_unpack_targz<P: AsRef<Path>>(
} }
}; };
try_decode_gz() try_decode_gz().or_else(|_| try_decode_xz())?;
.or_else(|_| try_decode_xz())
.or_else(|_| try_decode_zip())?;
Ok(target_targz_path.to_path_buf()) Ok(target_targz_path.to_path_buf())
} }