diff options
| author | Mike McQuaid | 2016-10-15 13:10:35 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2016-10-15 13:10:37 +0100 |
| commit | b1a16deb190ae5ccb05b60a3dd10b53eaf1bae15 (patch) | |
| tree | 5c74a2f3425ccac27cf40cb01d171e2d34e2b821 /Library/Homebrew/download_strategy.rb | |
| parent | 13276409a9b08fcbadfed18c25b6fd11af343729 (diff) | |
| download | brew-b1a16deb190ae5ccb05b60a3dd10b53eaf1bae15.tar.bz2 | |
Use BSD tar's libarchive LZMA support if available
Avoid using an unnecessary `xz` dependency when it's not needed.
Diffstat (limited to 'Library/Homebrew/download_strategy.rb')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 4f2f1b6b0..057768246 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -222,7 +222,7 @@ end class AbstractFileDownloadStrategy < AbstractDownloadStrategy def stage - case cached_location.compression_type + case type = cached_location.compression_type when :zip with_system_path { quiet_safe_system "unzip", "-qq", cached_location } chdir @@ -230,19 +230,23 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy with_system_path { buffered_write("gunzip") } when :bzip2_only with_system_path { buffered_write("bunzip2") } - when :gzip, :bzip2, :compress, :tar + when :gzip, :bzip2, :xz, :compress, :tar tar_flags = "x" - # Older versions of tar require an explicit format flag - if cached_location.compression_type == :gzip + if type == :gzip tar_flags << "z" - elsif cached_location.compression_type == :bzip2 + elsif type == :bzip2 tar_flags << "j" + elsif type == :xz + tar_flags << "J" end tar_flags << "f" - with_system_path { safe_system "tar", tar_flags, cached_location } - chdir - when :xz - with_system_path { pipe_to_tar(xzpath) } + with_system_path do + if type == :xz && DependencyCollector.tar_needs_xz_dependency? + pipe_to_tar(xzpath) + else + safe_system "tar", tar_flags, cached_location + end + end chdir when :lzip with_system_path { pipe_to_tar(lzippath) } |
