diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-02 08:08:29 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-02 08:08:29 +0000 |
commit | 79de8e9f6ba093da4d792294f1675083634c9e3b (patch) | |
tree | e69d4e4bd2196c8c997cafae327a86d50f52a50b /tool | |
parent | 7cd6706b9ab901b0b710a087b5aeb5654f219b09 (diff) | |
download | ruby-79de8e9f6ba093da4d792294f1675083634c9e3b.tar.gz |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rw-r--r-- | tool/downloader.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tool/downloader.rb b/tool/downloader.rb index 9c72856484..0386fe273b 100644 --- a/tool/downloader.rb +++ b/tool/downloader.rb @@ -285,14 +285,20 @@ class Downloader 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) |