bottle: only print relocations with --verbose.

This commit is contained in:
Mike McQuaid 2014-01-20 15:26:18 -08:00
parent f4cd66a88f
commit cb024e222c

View File

@ -51,9 +51,10 @@ module Homebrew extend self
index = 0 index = 0
keg.each_unique_file_matching(string) do |file| keg.each_unique_file_matching(string) do |file|
if ARGV.verbose?
opoo "String '#{string}' still exists in these files:" if index.zero? opoo "String '#{string}' still exists in these files:" if index.zero?
puts "#{Tty.red}#{file}#{Tty.reset}" puts "#{Tty.red}#{file}#{Tty.reset}"
end
# Check dynamic library linkage. Importantly, do not run otool on static # Check dynamic library linkage. Importantly, do not run otool on static
# libraries, which will falsely report "linkage" to themselves. # libraries, which will falsely report "linkage" to themselves.
@ -64,9 +65,11 @@ module Homebrew extend self
linked_libraries = [] linked_libraries = []
end end
if ARGV.verbose?
linked_libraries.each do |lib| linked_libraries.each do |lib|
puts " #{Tty.gray}-->#{Tty.reset} links to #{lib}" puts " #{Tty.gray}-->#{Tty.reset} links to #{lib}"
end end
end
# Use strings to search through the file for each string # Use strings to search through the file for each string
IO.popen("strings -t x - '#{file}'") do |io| IO.popen("strings -t x - '#{file}'") do |io|
@ -78,9 +81,11 @@ module Homebrew extend self
offset, match = str.split(" ", 2) offset, match = str.split(" ", 2)
next if linked_libraries.include? match # Don't bother reporting a string if it was found by otool next if linked_libraries.include? match # Don't bother reporting a string if it was found by otool
if ARGV.verbose?
puts " #{Tty.gray}-->#{Tty.reset} match '#{match}' at offset #{Tty.em}0x#{offset}#{Tty.reset}" puts " #{Tty.gray}-->#{Tty.reset} match '#{match}' at offset #{Tty.em}0x#{offset}#{Tty.reset}"
end end
end end
end
index += 1 index += 1
result = true result = true
@ -149,7 +154,7 @@ module Homebrew extend self
relocatable = !keg_contains(prefix_check, keg) relocatable = !keg_contains(prefix_check, keg)
relocatable = !keg_contains(HOMEBREW_CELLAR, keg) && relocatable relocatable = !keg_contains(HOMEBREW_CELLAR, keg) && relocatable
puts unless relocatable puts if !relocatable && ARGV.verbose?
rescue Interrupt rescue Interrupt
ignore_interrupts { bottle_path.unlink if bottle_path.exist? } ignore_interrupts { bottle_path.unlink if bottle_path.exist? }
raise raise