1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2019-04-02 08:08:29 +00:00
parent 7cd6706b9a
commit 79de8e9f6b

View file

@ -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)