bottle: read source modified time from tabfile

* Avoid unnecessary stage overhead
* Support different download strategy, e.g. `git`.
This commit is contained in:
Xu Cheng 2016-01-14 19:01:31 +08:00
parent 6c8c56a689
commit 7958343f16

View File

@ -140,10 +140,6 @@ module Homebrew
erb.result(bottle.instance_eval { binding }).gsub(/^\s*$\n/, "")
end
def most_recent_mtime(pathname)
pathname.to_enum(:find).select(&:exist?).map(&:mtime).max
end
def bottle_formula(f)
unless f.installed?
return ofail "Formula not installed or up-to-date: #{f.full_name}"
@ -194,10 +190,6 @@ module Homebrew
relocatable = false
skip_relocation = false
formula_source_time = f.stable.stage do
most_recent_mtime(Pathname.pwd)
end
keg.lock do
original_tab = nil
@ -216,11 +208,11 @@ module Homebrew
tab.time = nil
tab.write
keg.find {|k| File.utime(File.atime(k), formula_source_time, k) }
keg.find {|k| File.utime(File.atime(k), tab.source_modified_time, k) }
cd cellar do
safe_system "tar", "cf", tar_path, "#{f.name}/#{f.pkg_version}"
File.utime(File.atime(tar_path), formula_source_time, tar_path)
File.utime(File.atime(tar_path), tab.source_modified_time, tar_path)
relocatable_tar_path = "#{f}-bottle.tar"
mv tar_path, relocatable_tar_path
# Use gzip, faster to compress than bzip2, faster to uncompress than bzip2