pull: check Bintray mirror URLs

This commit is contained in:
Zhiming Wang 2017-03-05 15:01:28 -05:00
parent 475cade1a3
commit 10a235d6ab
No known key found for this signature in database
GPG Key ID: 5B58F95EC95965D8

View File

@ -155,6 +155,13 @@ module Homebrew
next next
end end
if f.stable
stable_urls = [f.stable.url] + f.stable.mirrors
stable_urls.grep(%r{^https://dl.bintray.com/homebrew/mirror/}) do |mirror_url|
check_bintray_mirror(f.full_name, mirror_url)
end
end
if ARGV.include? "--bottle" if ARGV.include? "--bottle"
if f.bottle_unneeded? if f.bottle_unneeded?
ohai "#{f}: skipping unneeded bottle." ohai "#{f}: skipping unneeded bottle."
@ -588,4 +595,12 @@ module Homebrew
end end
end end
end end
def check_bintray_mirror(name, url)
headers = curl_output("--connect-timeout", "15", "--head", url)[0]
status_code = headers.scan(%r{^HTTP\/.* (\d+)}).last.first
return if status_code.start_with?("3")
opoo "The Bintray mirror #{url} is not reachable (HTTP status code #{status_code})."
opoo "Do you need to upload it with `brew mirror #{name}`?"
end
end end