From 7958343f1694a72c8f15b7bf0e00a888fa321996 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Thu, 14 Jan 2016 19:01:31 +0800 Subject: [PATCH] bottle: read source modified time from tabfile * Avoid unnecessary stage overhead * Support different download strategy, e.g. `git`. --- Library/Homebrew/cmd/bottle.rb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index c2ea0941d7..b6c10b35b7 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -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