aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dev-cmd/pull.rb
diff options
context:
space:
mode:
authorZhiming Wang2017-03-05 15:01:28 -0500
committerZhiming Wang2017-03-07 20:45:08 -0500
commit10a235d6abfed687236b14577a02df13a9b5adca (patch)
tree650c9436a6fc84a471c00b9873439076c93be946 /Library/Homebrew/dev-cmd/pull.rb
parent475cade1a35c7a10b4c7e50a3a8a08bdea39d98b (diff)
downloadbrew-10a235d6abfed687236b14577a02df13a9b5adca.tar.bz2
pull: check Bintray mirror URLs
Diffstat (limited to 'Library/Homebrew/dev-cmd/pull.rb')
-rw-r--r--Library/Homebrew/dev-cmd/pull.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb
index 98a62e578..1bc87add1 100644
--- a/Library/Homebrew/dev-cmd/pull.rb
+++ b/Library/Homebrew/dev-cmd/pull.rb
@@ -155,6 +155,13 @@ module Homebrew
next
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 f.bottle_unneeded?
ohai "#{f}: skipping unneeded bottle."
@@ -588,4 +595,12 @@ module Homebrew
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