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
commitf93964c1594bd4d26b8034f90d1d2f0ffab8eaf4 (patch)
treefa27520353b439e8afbc53b3b8da08f0417bad53 /Library
parent5d3be1e671868cb5652126fbac862fe441ccbb73 (diff)
downloadhomebrew-f93964c1594bd4d26b8034f90d1d2f0ffab8eaf4.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?