diff options
| author | Misty De Meo | 2013-06-27 12:23:35 -0500 |
|---|---|---|
| committer | Misty De Meo | 2013-06-27 12:24:58 -0500 |
| commit | ecfb175cdccec867c918e44e5f4e0fb3731566d1 (patch) | |
| tree | f84cae313951e7e210f95a80bca345108ae327ba /Library | |
| parent | 49acf708134e9dff8b8f87a2be1835138e1fb106 (diff) | |
| download | brew-ecfb175cdccec867c918e44e5f4e0fb3731566d1.tar.bz2 | |
Fix :gzip_only extraction
gunzip can only extract files in-place, so just shelling out to
gunzip was actually leaving the uncompressed file in Homebrew's cache,
not in the temporary directory. (It also destroyed the original
compressed file.)
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index c7d6aeefb..2d2fe1c28 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -103,7 +103,15 @@ class CurlDownloadStrategy < AbstractDownloadStrategy 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 } + # gunzip writes the compressed data in the location of the original, + # regardless of the current working directory; the only way to + # write elsewhere is to use the stdout + with_system_path do + data = `gunzip -f "#{@tarball_path}" -c` + File.open(File.basename(basename_without_params, '.gz'), 'w') do |f| + f.write data + end + end when :gzip, :bzip2, :compress, :tar # Assume these are also tarred # TODO check if it's really a tar archive |
