summaryrefslogtreecommitdiff
path: root/tool/downloader.rb
diff options
context:
space:
mode:
authorKazuhiro NISHIYAMA <zn@mbf.nifty.com>2020-11-20 13:11:05 +0900
committerKazuhiro NISHIYAMA <znz@users.noreply.github.com>2020-11-20 14:18:14 +0900
commit4b899f91647b7da1174492f891de3d6ee8128458 (patch)
treed682611e7a15b0c9b4c7081189475358f037d1b3 /tool/downloader.rb
parent8cbd5f218ba126591a2248dafda66883b260d58d (diff)
Try to fix download error
https://github.com/ruby/ruby/runs/1428320660?check_suite_focus=true#step:9:10 ``` tool/downloader.rb:243:in `rescue in download': failed to download config.guess (RuntimeError) OpenURI::HTTPError: 403 Forbidden: https://cdn.jsdelivr.net/gh/gcc-mirror/gcc@master/config.guess ```
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3794
Diffstat (limited to 'tool/downloader.rb')
-rw-r--r--tool/downloader.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/tool/downloader.rb b/tool/downloader.rb
index d0cf52e4e5..21f4aab3c3 100644
--- a/tool/downloader.rb
+++ b/tool/downloader.rb
@@ -51,7 +51,12 @@ class Downloader
class GNU < self
def self.download(name, *rest)
if https?
- super("https://cdn.jsdelivr.net/gh/gcc-mirror/gcc@master/#{name}", name, *rest)
+ begin
+ super("https://cdn.jsdelivr.net/gh/gcc-mirror/gcc@master/#{name}", name, *rest)
+ rescue => e
+ STDERR.puts "Download failed (#{e.message}), try another URL"
+ super("https://raw.githubusercontent.com/gcc-mirror/gcc/master/#{name}", name, *rest)
+ end
else
super("https://repo.or.cz/official-gcc.git/blob_plain/HEAD:/#{name}", name, *rest)
end