download_strategy: use tar xf.

The flags and separate `-` aren't required on 10.5 which is the oldest
version of macOS we support (and it looks nicer this way).
This commit is contained in:
Mike McQuaid 2018-07-05 20:58:35 +01:00
parent adcef59bd9
commit d9f90deb7c

View File

@ -194,15 +194,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
if type == :xz && DependencyCollector.tar_needs_xz_dependency? if type == :xz && DependencyCollector.tar_needs_xz_dependency?
pipe_to_tar "#{HOMEBREW_PREFIX}/opt/xz/bin/xz", unpack_dir pipe_to_tar "#{HOMEBREW_PREFIX}/opt/xz/bin/xz", unpack_dir
else else
flags = if type == :gzip safe_system "tar", "xf", path, "-C", unpack_dir
["-z"]
elsif type == :bzip2
["-j"]
elsif type == :xz
["-J"]
end
safe_system "tar", "-x", *flags, "-f", path, "-C", unpack_dir
end end
chdir chdir
when :lzip when :lzip
@ -239,7 +231,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
path = cached_location path = cached_location
Utils.popen_read(tool, "-dc", path) do |rd| Utils.popen_read(tool, "-dc", path) do |rd|
Utils.popen_write("tar", "-x", "-f", "-", "-C", unpack_dir) do |wr| Utils.popen_write("tar", "xf", "-", "-C", unpack_dir) do |wr|
buf = "" buf = ""
wr.write(buf) while rd.read(16384, buf) wr.write(buf) while rd.read(16384, buf)
end end