ruby-changes:47070
From: nobu <ko1@a...>
Date: Wed, 28 Jun 2017 02:11:03 +0900 (JST)
Subject: [ruby-changes:47070] nobu:r59185 (trunk): downloader.rb: get rid of symlinks
nobu 2017-06-28 02:10:56 +0900 (Wed, 28 Jun 2017) New Revision: 59185 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59185 Log: downloader.rb: get rid of symlinks * tool/downloader.rb: do not save downloaded files to cache. [ruby-core:81780] [Bug #13684] Modified files: trunk/tool/downloader.rb trunk/tool/make-snapshot Index: tool/downloader.rb =================================================================== --- tool/downloader.rb (revision 59184) +++ tool/downloader.rb (revision 59185) @@ -129,6 +129,9 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L129 else name = File.basename(url.path) end + cache_save = options.delete(:cache_save) { + ENV["CACHE_SAVE"] != "no" + } cache = cache_file(url, name, options.delete(:cache_dir)) file ||= cache if since.nil? and file.exist? @@ -136,7 +139,9 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L139 $stdout.puts "#{file} already exists" $stdout.flush end - save_cache(cache, file, name) + if cache_save + save_cache(cache, file, name) + end return file.to_path end if dryrun @@ -197,7 +202,7 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L202 end if dest.eql?(cache) link_cache(cache, file, name) - else + elsif cache_save save_cache(cache, file, name) end return file.to_path @@ -282,6 +287,11 @@ if $0 == __FILE__ https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L287 since = false when '-n', '--dryrun' options[:dryrun] = true + when '--cache-dir' + options[:cache_dir] = ARGV[1] + ARGV.shift + when /\A--cache-dir=(.*)/m + options[:cache_dir] = $1 when /\A-/ abort "#{$0}: unknown option #{ARGV[0]}" else Index: tool/make-snapshot =================================================================== --- tool/make-snapshot (revision 59184) +++ tool/make-snapshot (revision 59185) @@ -208,8 +208,13 @@ def package(vcs, rev, destdir, tmp = nil https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L208 FileUtils.mkpath(File.dirname(dest)) begin FileUtils.ln(file, dest, force: true) + next unless File.symlink?(dest) + File.unlink(dest) + rescue SystemCallError + end + begin + FileUtils.cp_r(file, dest, preserve: true) rescue SystemCallError - FileUtils.cp(file, dest, preserve: true) end end end @@ -334,11 +339,10 @@ def package(vcs, rev, destdir, tmp = nil https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L339 mk << <<-'APPEND' prereq: clean-cache $(CLEAN_CACHE) -clean-cache $(CLEAN_CACHE): after-update +clean-cache $(CLEAN_CACHE): extract-gems touch-unicode-files: update-download:: touch-unicode-files update-download:: update-gems -after-update:: extract-gems extract-gems: update-gems update-gems: APPEND @@ -346,6 +350,7 @@ update-gems: https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L350 f.puts "prereq: update-download" f.puts mk end + ENV["CACHE_SAVE"] = "no" system(ENV["MAKE"] || ENV["make"] || "make", "prereq", *args.map {|arg| arg.join("=")}) clean.push("rbconfig.rb", ".rbconfig.time", "enc.mk") print "prerequisites" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/