Handle untarred bzip2 files

Fixes Homebrew/homebrew#28187.
This commit is contained in:
Jack Nagel 2014-04-06 11:19:30 -05:00
parent 607605dd8f
commit cb5da28b5c
2 changed files with 13 additions and 0 deletions

View File

@ -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

View File

@ -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