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
@ -285,15 +285,21 @@ class Downloader
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.save_cache(cache, file, name)
|
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
|
begin
|
||||||
file.rename(cache)
|
file.rename(cache)
|
||||||
rescue
|
rescue
|
||||||
|
return
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
return unless st.mtime > file.lstat.mtime
|
||||||
|
file.unlink
|
||||||
|
end
|
||||||
link_cache(cache, file, name)
|
link_cache(cache, file, name)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.with_retry(max_times, &block)
|
def self.with_retry(max_times, &block)
|
||||||
times = 0
|
times = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user