aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/download_strategy.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/download_strategy.rb')
-rw-r--r--Library/Homebrew/download_strategy.rb22
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) }