[前][次][番号順一覧][スレッド一覧]

ruby-changes:55206

From: nobu <ko1@a...>
Date: Tue, 2 Apr 2019 17:08:40 +0900 (JST)
Subject: [ruby-changes:55206] nobu:r67413 (trunk): downloader.rb: keep linked file newer than cached file

nobu	2019-04-02 17:08:29 +0900 (Tue, 02 Apr 2019)

  New Revision: 67413

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67413

  Log:
    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.

  Modified files:
    trunk/tool/downloader.rb
Index: tool/downloader.rb
===================================================================
--- tool/downloader.rb	(revision 67412)
+++ tool/downloader.rb	(revision 67413)
@@ -285,14 +285,20 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L285
   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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]