aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorUladzislau Shablinski2016-05-24 12:19:18 +0300
committerXu Cheng2016-05-24 17:19:18 +0800
commit5703ebf49667e21f81564dd29be3e68f1df9e7c4 (patch)
treef9faf1bc563009a9d364015f70e21e1a900ce615 /Library/Homebrew
parent8ecfab8a598be15e7aa66e334b0ff92700943d1d (diff)
downloadbrew-5703ebf49667e21f81564dd29be3e68f1df9e7c4.tar.bz2
download_strategy: cvs source_modified_time (#268)
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/download_strategy.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 0de9bf8c2..1ac1dbcb4 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -713,6 +713,21 @@ class CVSDownloadStrategy < VCSDownloadStrategy
end
end
+ def source_modified_time
+ # Look for the file timestamps under {#cached_location} because
+ # newly-unpacked directory can have timestamps of the moment of copying.
+ # Filter CVS's files because the timestamp for each of them is the moment
+ # of clone.
+ max_mtime = Time.at(0)
+ cached_location.find do |f|
+ Find.prune if f.directory? && f.basename.to_s == "CVS"
+ next unless f.file?
+ mtime = f.mtime
+ max_mtime = mtime if mtime > max_mtime
+ end
+ max_mtime
+ end
+
def stage
cp_r File.join(cached_location, "."), Dir.pwd
end