support .lz archives

Closes Homebrew/homebrew#24775.
This commit is contained in:
Adam Vandenberg 2013-11-29 10:10:28 -08:00
parent 06bf1c0f02
commit 268feffae4
3 changed files with 10 additions and 1 deletions

View File

@ -178,6 +178,7 @@ class DependencyCollector
def parse_url_spec(url, tags)
case File.extname(url)
when '.xz' then Dependency.new('xz', tags)
when '.lz' then Dependency.new('lzip', tags)
when '.rar' then Dependency.new('unrar', tags)
when '.7z' then Dependency.new('p7zip', tags)
end

View File

@ -162,6 +162,9 @@ class CurlDownloadStrategy < AbstractDownloadStrategy
when :xz
with_system_path { safe_system "#{xzpath} -dc \"#{tarball_path}\" | tar xf -" }
chdir
when :lzip
with_system_path { safe_system "#{lzippath} -dc \"#{tarball_path}\" | tar xf -" }
chdir
when :pkg
safe_system '/usr/sbin/pkgutil', '--expand', tarball_path, basename_without_params
chdir
@ -185,6 +188,10 @@ class CurlDownloadStrategy < AbstractDownloadStrategy
"#{HOMEBREW_PREFIX}/opt/xz/bin/xz"
end
def lzippath
"#{HOMEBREW_PREFIX}/opt/lzip/bin/lzip"
end
def chdir
entries = Dir['*']
case entries.length

View File

@ -141,7 +141,7 @@ class Pathname
def extname(path=to_s)
BOTTLE_EXTNAME_RX.match(path)
return $1 if $1
/(\.(tar|cpio|pax)\.(gz|bz2|xz|Z))$/.match(path)
/(\.(tar|cpio|pax)\.(gz|bz2|lz|xz|Z))$/.match(path)
return $1 if $1
return File.extname(path)
end
@ -207,6 +207,7 @@ class Pathname
when /^\037\235/n then :compress
when /^.{257}ustar/n then :tar
when /^\xFD7zXZ\x00/n then :xz
when /^LZIP/n then :lzip
when /^Rar!/n then :rar
when /^7z\xBC\xAF\x27\x1C/n then :p7zip
else