Skip to content

Commit 9d96196

Browse files
authored
[Prefix] Use unzip from unzip_jll (#335)
1 parent 8b86754 commit 9d96196

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ XZ_jll = "ffd25f8a-64ca-5728-b0f7-c24cf3aae800"
3434
Zstd_jll = "3161d3a3-bdf6-5164-811a-617609db77b4"
3535
p7zip_jll = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
3636
pigz_jll = "1bc43ea1-30af-5bc8-a9d4-c018457e6e3e"
37+
unzip_jll = "88f77b66-78eb-5ed0-bc16-ebba0796830d"
3738

3839
[compat]
3940
CodecZlib = "0.5, 0.6, 0.7"
@@ -46,4 +47,5 @@ ProgressMeter = "1"
4647
Scratch = "1.0"
4748
SimpleBufferStream = "1"
4849
Tar = "1.7"
50+
unzip_jll = "6.0.2"
4951
julia = "1.7"

src/Prefix.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# environment variables must be updated to, etc...
44
import Base: convert, joinpath, show
55
using SHA, CodecZlib, TOML, LibGit2_jll
6-
import Bzip2_jll, Gzip_jll, Tar_jll, XZ_jll, Zstd_jll
6+
import Bzip2_jll, Gzip_jll, Tar_jll, XZ_jll, Zstd_jll, unzip_jll
77
using JLLWrappers: pathsep, LIBPATH_env
88

99
export Prefix, bindir, libdirs, includedir, logdir, temp_prefix, package
@@ -294,9 +294,6 @@ end
294294

295295
function setup(source::SetupSource{ArchiveSource}, targetdir, verbose; tar_flags = verbose ? "xvof" : "xof")
296296
mkpath(targetdir)
297-
# Extract with host tools because it is _much_ faster on e.g. OSX.
298-
# If this becomes a compatibility problem, we'll just have to install
299-
# our own `tar` and `unzip` through BP as dependencies for BB.
300297
cd(targetdir) do
301298
if any(endswith(source.path, ext) for ext in tar_extensions)
302299
if verbose
@@ -334,7 +331,9 @@ function setup(source::SetupSource{ArchiveSource}, targetdir, verbose; tar_flags
334331
if verbose
335332
@info "Extracting zipball $(basename(source.path))..."
336333
end
337-
run(`unzip -q $(source.path)`)
334+
if unzip_jll.is_available()
335+
run(`$(unzip_jll.unzip()) -q $(source.path)`)
336+
end
338337
elseif endswith(source.path, ".conda")
339338
if verbose
340339
@info "Extracting conda package $(basename(source.path))..."
@@ -343,7 +342,9 @@ function setup(source::SetupSource{ArchiveSource}, targetdir, verbose; tar_flags
343342
# Replace initial hash with pkg, and change the file extension to obtain the name
344343
pkg_name = replace(basename(source.path), r"^[a-z0-9]{64}-" => "pkg-", ".conda" => ".tar.zst")
345344
# First unzip the pkg tarball from .conda file
346-
run(`unzip -q $(source.path) $pkg_name`)
345+
if unzip_jll.is_available()
346+
run(`$(unzip_jll.unzip()) -q $(source.path) $(pkg_name)`)
347+
end
347348
# Second untar the pkg tarball
348349
pkg_source = SetupSource{ArchiveSource}(joinpath(targetdir, pkg_name), source.hash, source.target)
349350
# Run setup again to untar the pkg binaries

0 commit comments

Comments
 (0)