diff options
| author | Mike McQuaid | 2012-03-18 15:14:14 +1300 |
|---|---|---|
| committer | Mike McQuaid | 2012-03-18 15:16:57 +1300 |
| commit | d2ad0d02326634d5ff9b92899b60190271e45786 (patch) | |
| tree | 2d6448df5d90b465057131badda3d49177d077f5 | |
| parent | ab571e4d725d45ddf78cacb59377348902c13c39 (diff) | |
| download | homebrew-d2ad0d02326634d5ff9b92899b60190271e45786.tar.bz2 | |
Use fetch for downloading bottles.
Fixes #10958.
| -rw-r--r-- | Library/Homebrew/cmd/fetch.rb | 14 | ||||
| -rw-r--r-- | Library/Homebrew/formula.rb | 12 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 6 |
3 files changed, 18 insertions, 14 deletions
diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 5d1bec529..28f51f71a 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -29,21 +29,23 @@ module Homebrew extend self the_tarball, _ = f.fetch next unless the_tarball.kind_of? Pathname - previous_md5 = f.instance_variable_get(:@md5).to_s.downcase + bottle = install_bottle? f + + previous_md5 = f.instance_variable_get(:@md5).to_s.downcase unless bottle previous_sha1 = f.instance_variable_get(:@sha1).to_s.downcase - previous_sha2 = f.instance_variable_get(:@sha256).to_s.downcase + previous_sha2 = f.instance_variable_get(:@sha256).to_s.downcase unless bottle - puts "MD5: #{the_tarball.md5}" + puts "MD5: #{the_tarball.md5}" unless bottle puts "SHA1: #{the_tarball.sha1}" - puts "SHA256: #{the_tarball.sha2}" + puts "SHA256: #{the_tarball.sha2}" unless bottle - unless previous_md5.nil? or previous_md5.empty? or the_tarball.md5 == previous_md5 + unless previous_md5.nil? or previous_md5.empty? or the_tarball.md5 == previous_md5 or bottle opoo "Formula reports different MD5: #{previous_md5}" end unless previous_sha1.nil? or previous_sha1.empty? or the_tarball.sha1 == previous_sha1 opoo "Formula reports different SHA1: #{previous_sha1}" end - unless previous_sha2.nil? or previous_sha2.empty? or the_tarball.sha2 == previous_sha2 + unless previous_sha2.nil? or previous_sha2.empty? or the_tarball.sha2 == previous_sha2 or bottle opoo "Formula reports different SHA256: #{previous_sha2}" end end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 880316604..c26f0b319 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -443,10 +443,14 @@ public # For brew-fetch and others. def fetch - downloader = @downloader - # Don't attempt mirrors if this install is not pointed at a "stable" URL. - # This can happen when options like `--HEAD` are invoked. - mirror_list = @spec_to_use == @standard ? mirrors : [] + if install_bottle? self + downloader = CurlBottleDownloadStrategy.new bottle_url, name, version, nil + else + downloader = @downloader + # Don't attempt mirrors if this install is not pointed at a "stable" URL. + # This can happen when options like `--HEAD` are invoked. + mirror_list = @spec_to_use == @standard ? mirrors : [] + end # Ensure the cache exists HOMEBREW_CACHE.mkpath diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 76618ad0c..cd911b959 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -253,10 +253,8 @@ class FormulaInstaller end def pour - HOMEBREW_CACHE.mkpath - downloader = CurlBottleDownloadStrategy.new f.bottle_url, f.name, f.version, nil - downloader.fetch - f.verify_download_integrity downloader.tarball_path, f.bottle_sha1, "SHA1" + fetched, downloader = f.fetch + f.verify_download_integrity fetched, f.bottle_sha1, "SHA1" HOMEBREW_CELLAR.cd do downloader.stage end |
