summaryrefslogtreecommitdiff
path: root/tool/downloader.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-12-03 01:28:34 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-12-03 01:28:34 +0900
commite558c374b7975f9923228cdf325f767eef97a725 (patch)
treeee3b8260c140b1b2b5ce346163d52abc7d6362a7 /tool/downloader.rb
parentf28e79caaa592e6198a2af66ac4d55719383b67c (diff)
downloadruby-e558c374b7975f9923228cdf325f767eef97a725.tar.gz
downloader.rb: Fix link to absolute cache path
Diffstat (limited to 'tool/downloader.rb')
-rw-r--r--tool/downloader.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/tool/downloader.rb b/tool/downloader.rb
index 3020322a98..59225ecfbd 100644
--- a/tool/downloader.rb
+++ b/tool/downloader.rb
@@ -64,7 +64,8 @@ class Downloader
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"
+ m1, m2 = e.message.split("\n", 2)
+ STDERR.puts "Download failed (#{m1}), try another URL\n#{m2}"
super("https://raw.githubusercontent.com/gcc-mirror/gcc/master/#{name}", name, *rest)
end
else
@@ -312,7 +313,16 @@ class Downloader
return true if cache.eql?(file)
if /cygwin/ !~ RUBY_PLATFORM or /winsymlink:nativestrict/ =~ ENV['CYGWIN']
begin
- file.make_symlink(cache.relative_path_from(file.parent))
+ link = cache.relative_path_from(file.parent)
+ rescue ArgumentError
+ abs = cache.expand_path
+ link = abs.relative_path_from(file.parent.expand_path)
+ if link.to_s.size > abs.to_s.size
+ link = abs
+ end
+ end
+ begin
+ file.make_symlink(link)
rescue SystemCallError
else
if verbose