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:
parent
7cd6706b9a
commit
79de8e9f6b
1 changed files with 9 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue