aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/cmd/bottle.rb19
1 files changed, 15 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb
index 7774a568f..c63c5ae06 100644
--- a/Library/Homebrew/cmd/bottle.rb
+++ b/Library/Homebrew/cmd/bottle.rb
@@ -32,6 +32,8 @@ BOTTLE_ERB = <<-EOS
end
EOS
+MAXIMUM_STRING_MATCHES = 100
+
module Homebrew
def keg_contains(string, keg, ignores)
@put_string_exists_header, @put_filenames = nil
@@ -72,6 +74,8 @@ module Homebrew
end
end
+ text_matches = []
+
# Use strings to search through the file for each string
Utils.popen_read("strings", "-t", "x", "-", file.to_s) do |io|
until io.eof?
@@ -82,11 +86,18 @@ module Homebrew
next if linked_libraries.include? match # Don't bother reporting a string if it was found by otool
result = true
+ text_matches << [match, offset]
+ end
+ end
- if ARGV.verbose?
- print_filename string, file
- puts " #{Tty.gray}-->#{Tty.reset} match '#{match}' at offset #{Tty.em}0x#{offset}#{Tty.reset}"
- end
+ if ARGV.verbose? && text_matches.any?
+ print_filename string, file
+ text_matches.first(MAXIMUM_STRING_MATCHES).each do |match, offset|
+ puts " #{Tty.gray}-->#{Tty.reset} match '#{match}' at offset #{Tty.em}0x#{offset}#{Tty.reset}"
+ end
+
+ if text_matches.size > MAXIMUM_STRING_MATCHES
+ puts "Only the first #{MAXIMUM_STRING_MATCHES} matches were output"
end
end
end