aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-04-06 11:19:30 -0500
committerJack Nagel2014-04-06 11:33:50 -0500
commitcb5da28b5cdf7a76e9e1220e6701b4b905ce04a3 (patch)
treed58f8030c77de95f7fefbcd5d8fc6b049c9b9e8b
parent607605dd8fef262b5c382a78eedef43edbdba27e (diff)
downloadbrew-cb5da28b5cdf7a76e9e1220e6701b4b905ce04a3.tar.bz2
Handle untarred bzip2 files
Fixes Homebrew/homebrew#28187.
-rw-r--r--Library/Homebrew/download_strategy.rb11
-rw-r--r--Library/Homebrew/extend/pathname.rb2
2 files changed, 13 insertions, 0 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 479365c98..116d53b79 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -157,6 +157,17 @@ class CurlDownloadStrategy < AbstractDownloadStrategy
end
end
end
+ when :bzip2_only
+ with_system_path do
+ target = File.basename(basename_without_params, ".bz2")
+
+ IO.popen("bunzip2 -f '#{tarball_path}' -c") do |pipe|
+ File.open(target, "wb") do |f|
+ buf = ""
+ f.write(buf) while pipe.read(1024, buf)
+ end
+ end
+ end
when :gzip, :bzip2, :compress, :tar
# Assume these are also tarred
# TODO check if it's really a tar archive
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index 337afbfc9..b8868adfe 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -213,6 +213,8 @@ class Pathname
# If the filename ends with .gz not preceded by .tar
# then we want to gunzip but not tar
return :gzip_only
+ when ".bz2"
+ return :bzip2_only
end
# Get enough of the file to detect common file types