aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorAdam Vandenberg2013-06-08 10:27:47 -0700
committerAdam Vandenberg2013-06-08 15:37:32 -0700
commitebc38db960ffef4eee24dd12c082b45ae55c2402 (patch)
tree0fbe77bfc47648d8804f96b637f6b4f261872fe8 /Library/Homebrew
parentc1452946cec7772bb8bb7889025d47d0279ee0e5 (diff)
downloadhomebrew-ebc38db960ffef4eee24dd12c082b45ae55c2402.tar.bz2
Sniff for non-tarred gzips
Don't try to untar non-tarred gzips.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/download_strategy.rb16
-rw-r--r--Library/Homebrew/extend/pathname.rb4
2 files changed, 9 insertions, 11 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 5bdc7ebd0..8e3bd8139 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -102,6 +102,8 @@ class CurlDownloadStrategy < AbstractDownloadStrategy
when :zip
with_system_path { quiet_safe_system 'unzip', {:quiet_flag => '-qq'}, @tarball_path }
chdir
+ when :gzip_only
+ with_system_path { safe_system 'gunzip', '-f', @tarball_path }
when :gzip, :bzip2, :compress, :tar
# Assume these are also tarred
# TODO check if it's really a tar archive
@@ -197,17 +199,9 @@ class NoUnzipCurlDownloadStrategy < CurlDownloadStrategy
end
end
-# Normal strategy tries to untar as well
-class GzipOnlyDownloadStrategy < CurlDownloadStrategy
- def stage
- 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.
+# This 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
def _fetch
curl @url, '--insecure', '-C', downloaded_size, '-o', @temporary_path
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index 25bb1e537..b6a47d520 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -177,6 +177,10 @@ class Pathname
# OS X installer package
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
# POSIX tar magic has a 257 byte offset
# magic numbers stolen from /usr/share/file/magic/