ruby-changes:55321
From: naruse <ko1@a...>
Date: Sun, 14 Apr 2019 07:04:59 +0900 (JST)
Subject: [ruby-changes:55321] naruse:r67528 (ruby_2_6): merge revision(s) 66737, 66738, 67413, 67445, 67446, 67447, 67448, 67450, 67451, 67454:
naruse 2019-04-14 07:04:51 +0900 (Sun, 14 Apr 2019) New Revision: 67528 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67528 Log: merge revision(s) 66737,66738,67413,67445,67446,67447,67448,67450,67451,67454: add logic to handle Unicode beta period file names In downloader.rb, add logic to handle file names of the form UnicodeData-12.0.0d6.txt. To find the right file, we download the index of the directory. Then we download the files by finding the file names from the index. Files are always checked for changes, because changes might be frequent during the beta period. We also check whether any index.html files are left when we are not in the beta period. This would indicate that we might have stale data from the beta period rather than the actual release data. simplify filename-related code (Thanks to Nobuyoshi Nakada for the hint!) downloader.rb: keep linked file newer than cached file * tool/downloader.rb (Downloader.save_cache): keep linked file newer than cached file, so that GNU make triggers when the content is updated. it uses the timestamp of symlink itself instead of the target. add puts statements to debug Unicode file download (temporary) Unicode file download doesn't work with Visual Studio, see e.g. https://ci.appveyor.com/project/ruby/ruby/builds/23614399/job/f8vya2l7fjdfcye4 We temporarily produce more output for debugging. * remove trailing spaces. output more debug information in downloader.rb (temporary) Unicode file download doesn't work with Visual Studio, we need more debug output. downloader.rb: quote base name downloader.rb: fix typo, extra % revert r67445, (r67446,) r67447 Debugging output is no longer needed because the problem has been fixed with r67449. appveyor.yml: Use pre-generated headers and tables Modified directories: branches/ruby_2_6/ Modified files: branches/ruby_2_6/tool/downloader.rb branches/ruby_2_6/version.h Index: ruby_2_6/tool/downloader.rb =================================================================== --- ruby_2_6/tool/downloader.rb (revision 67527) +++ ruby_2_6/tool/downloader.rb (revision 67528) @@ -70,8 +70,35 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/ruby_2_6/tool/downloader.rb#L70 Gems = RubyGems class Unicode < self - def self.download(name, *rest) - super("http://www.unicode.org/Public/#{name}", name, *rest) + INDEX = {} # cache index file information across files in the same directory + UNICODE_PUBLIC = "http://www.unicode.org/Public/" + + def self.download(name, dir = nil, since = true, options = {}) + options = options.dup + unicode_beta = options.delete(:unicode_beta) + name_dir_part = name.sub(/[^\/]+$/, '') + if unicode_beta == 'YES' + if INDEX.size == 0 + index_options = options.dup + index_options[:cache_save] = false # TODO: make sure caching really doesn't work for index file + index_file = super(UNICODE_PUBLIC+name_dir_part, "#{name_dir_part}index.html", dir, true, index_options) + INDEX[:index] = IO.read index_file + end + file_base = File.basename(name, '.txt') + return if file_base == '.' # Use pre-generated headers and tables + beta_name = INDEX[:index][/#{Regexp.quote(file_base)}(-[0-9.]+d\d+)?\.txt/] + # make sure we always check for new versions of files, + # because they can easily change in the beta period + super(UNICODE_PUBLIC+name_dir_part+beta_name, name, dir, true, options) + else + index_file = Pathname.new(under(dir, name_dir_part+'index.html')) + if index_file.exist? + raise "Although Unicode is not in beta, file #{index_file} exists. " + + "Remove all files in this directory and in .downloaded-cache/ " + + "because they may be leftovers from the beta period." + end + super(UNICODE_PUBLIC+name, name, dir, since, options) + end end end @@ -124,10 +151,7 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/ruby_2_6/tool/downloader.rb#L151 options = options.dup url = URI(url) dryrun = options.delete(:dryrun) - - # remove from options (future use, see r66448), see L166 - unicode_beta = options.delete(:unicode_beta) - puts "never" if unicode_beta == 'assigned but unused variable...' + options.delete(:unicode_beta) # just to be on the safe side for gems and gcc if name file = Pathname.new(under(dir, name)) @@ -262,14 +286,20 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/ruby_2_6/tool/downloader.rb#L286 end def self.save_cache(cache, file, name) - if cache and !cache.eql?(file) and !cache.exist? + return unless cache or cache.eql?(file) + begin + st = cache.stat + rescue begin file.rename(cache) rescue - else - link_cache(cache, file, name) + return end + else + return unless st.mtime > file.lstat.mtime + file.unlink end + link_cache(cache, file, name) end def self.with_retry(max_times, &block) @@ -318,12 +348,6 @@ if $0 == __FILE__ https://github.com/ruby/ruby/blob/trunk/ruby_2_6/tool/downloader.rb#L348 when '--unicode-beta' options[:unicode_beta] = ARGV[1] ARGV.shift - # TODO: Move this code further down - if options[:unicode_beta]=='YES' - raise "Not yet able to deal with Unicode Data beta versions." - else - # TODO: deal with the case that we just switched from beta to 'regular' - end when /\A--cache-dir=(.*)/m options[:cache_dir] = $1 when /\A-/ Index: ruby_2_6/version.h =================================================================== --- ruby_2_6/version.h (revision 67527) +++ ruby_2_6/version.h (revision 67528) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_6/version.h#L1 #define RUBY_VERSION "2.6.3" #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 57 +#define RUBY_PATCHLEVEL 58 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 4 Index: ruby_2_6 =================================================================== --- ruby_2_6 (revision 67527) +++ ruby_2_6 (revision 67528) Property changes on: ruby_2_6 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r66737-66738,67413,67445-67448,67450-67451,67454 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/