Sniff for non-tarred gzips
Don't try to untar non-tarred gzips.
This commit is contained in:
parent
f848a08344
commit
aff66c3b86
@ -102,6 +102,8 @@ class CurlDownloadStrategy < AbstractDownloadStrategy
|
|||||||
when :zip
|
when :zip
|
||||||
with_system_path { quiet_safe_system 'unzip', {:quiet_flag => '-qq'}, @tarball_path }
|
with_system_path { quiet_safe_system 'unzip', {:quiet_flag => '-qq'}, @tarball_path }
|
||||||
chdir
|
chdir
|
||||||
|
when :gzip_only
|
||||||
|
with_system_path { safe_system 'gunzip', '-f', @tarball_path }
|
||||||
when :gzip, :bzip2, :compress, :tar
|
when :gzip, :bzip2, :compress, :tar
|
||||||
# Assume these are also tarred
|
# Assume these are also tarred
|
||||||
# TODO check if it's really a tar archive
|
# TODO check if it's really a tar archive
|
||||||
@ -197,17 +199,9 @@ class NoUnzipCurlDownloadStrategy < CurlDownloadStrategy
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Normal strategy tries to untar as well
|
# This strategy is provided for use with sites that only provide HTTPS and
|
||||||
class GzipOnlyDownloadStrategy < CurlDownloadStrategy
|
# also have a broken cert. Try not to need this, as we probably won't accept
|
||||||
def stage
|
# the formula.
|
||||||
FileUtils.mv @tarball_path, basename
|
|
||||||
with_system_path { safe_system 'gunzip', '-f', basename_without_params }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# This Download Strategy is provided for use with sites that
|
|
||||||
# only provide HTTPS and also have a broken cert.
|
|
||||||
# Try not to need this, as we probably won't accept the formula.
|
|
||||||
class CurlUnsafeDownloadStrategy < CurlDownloadStrategy
|
class CurlUnsafeDownloadStrategy < CurlDownloadStrategy
|
||||||
def _fetch
|
def _fetch
|
||||||
curl @url, '--insecure', '-C', downloaded_size, '-o', @temporary_path
|
curl @url, '--insecure', '-C', downloaded_size, '-o', @temporary_path
|
||||||
|
|||||||
@ -177,6 +177,10 @@ class Pathname
|
|||||||
# OS X installer package
|
# OS X installer package
|
||||||
return :pkg if self.extname == '.pkg'
|
return :pkg if self.extname == '.pkg'
|
||||||
|
|
||||||
|
# If the filename ends with .gz not preceded by .tar
|
||||||
|
# then we want to gunzip but not tar
|
||||||
|
return :gzip_only if self.extname == '.gz'
|
||||||
|
|
||||||
# Get enough of the file to detect common file types
|
# Get enough of the file to detect common file types
|
||||||
# POSIX tar magic has a 257 byte offset
|
# POSIX tar magic has a 257 byte offset
|
||||||
# magic numbers stolen from /usr/share/file/magic/
|
# magic numbers stolen from /usr/share/file/magic/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user