aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dev-cmd
diff options
context:
space:
mode:
authorMike McQuaid2017-03-08 09:32:37 +0000
committerGitHub2017-03-08 09:32:37 +0000
commitc4c3588de8f35124e135d1b679bc5cfc9428b845 (patch)
tree8a37cddf1c9e16a7f91e94db0a7958823facea54 /Library/Homebrew/dev-cmd
parent9105acab6bc6a04d01c49a32ec27f8ab16fd40b7 (diff)
parent10a235d6abfed687236b14577a02df13a9b5adca (diff)
downloadbrew-c4c3588de8f35124e135d1b679bc5cfc9428b845.tar.bz2
Merge pull request #2252 from zmwangx/audit-no-warn-brew-mirror-url
audit: do not warn about reachability of `brew mirror`ed URL
Diffstat (limited to 'Library/Homebrew/dev-cmd')
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb3
-rw-r--r--Library/Homebrew/dev-cmd/pull.rb15
2 files changed, 18 insertions, 0 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index 457df5fc7..cd55cdf4c 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -1565,6 +1565,9 @@ class ResourceAuditor
strategy = DownloadStrategyDetector.detect(url, using)
if strategy <= CurlDownloadStrategy && !url.start_with?("file")
+ # A `brew mirror`'ed URL is usually not yet reachable at the time of
+ # pull request.
+ next if url =~ %r{^https://dl.bintray.com/homebrew/mirror/}
if http_content_problem = FormulaAuditor.check_http_content(url)
problem http_content_problem
end
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