Use fetch for downloading bottles.

Fixes Homebrew/homebrew#10958.
This commit is contained in:
Mike McQuaid 2012-03-18 15:14:14 +13:00
parent 059727a9e8
commit d47cf55f68
3 changed files with 18 additions and 14 deletions

View File

@ -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

View File

@ -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

View File

@ -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