aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-12-08 16:17:11 -0600
committerJack Nagel2013-12-08 16:18:12 -0600
commit3d8bf53187ee2320857976656e86582d7db2c576 (patch)
treec4d8ba9ff3a00bf8342da7b60a03793fce5e3162 /Library
parent0f7ae176997cafe5ff1a7fa9ee94ff370b5b76b9 (diff)
downloadbrew-3d8bf53187ee2320857976656e86582d7db2c576.tar.bz2
bottle: don't repeat output for hardlinked files
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/bottle.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb
index 71ed7dad6..d3eac90fa 100644
--- a/Library/Homebrew/cmd/bottle.rb
+++ b/Library/Homebrew/cmd/bottle.rb
@@ -43,6 +43,15 @@ module Homebrew extend self
include Utils::Inreplace
end
+ def uniq_by_ino(list)
+ h = {}
+ list.each do |e|
+ ino = e.stat.ino
+ h[ino] = e unless h.key? ino
+ end
+ h.values
+ end
+
def keg_contains string, keg
if not ARGV.homebrew_developer?
return quiet_system 'fgrep', '--recursive', '--quiet', '--max-count=1', string, keg
@@ -52,6 +61,9 @@ module Homebrew extend self
keg_ref_files = `/usr/bin/fgrep --files-with-matches --recursive "#{string}" "#{keg}" 2>/dev/null`.split("\n")
keg_ref_files.map! { |file| Pathname.new(file) }.reject!(&:symlink?)
+ # If files are hardlinked, only check one of them
+ keg_ref_files = uniq_by_ino(keg_ref_files)
+
# If there are no files with that string found, return immediately
return false if keg_ref_files.empty?