bottle: fix output for absolute symlinks

Closes Homebrew/homebrew#43816.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-09-11 16:49:39 +08:00
parent 5241932b45
commit fe204fdf4b

View File

@ -76,15 +76,12 @@ module Homebrew
Utils.popen_read("strings", "-t", "x", "-", file.to_s) do |io| Utils.popen_read("strings", "-t", "x", "-", file.to_s) do |io|
until io.eof? until io.eof?
str = io.readline.chomp str = io.readline.chomp
next if ignores.any? { |i| i =~ str } next if ignores.any? { |i| i =~ str }
next unless str.include? string next unless str.include? string
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
result ||= true
result = true
if ARGV.verbose? if ARGV.verbose?
print_filename string, file print_filename string, file
@ -94,19 +91,36 @@ module Homebrew
end end
end end
put_symlink_header = false absolute_symlinks_start_with_string = []
absolute_symlinks_rest = []
keg.find do |pn| keg.find do |pn|
if pn.symlink? && (link = pn.readlink).absolute? if pn.symlink? && (link = pn.readlink).absolute?
if !put_symlink_header && link.to_s.start_with?(string) if link.to_s.start_with?(string)
opoo "Absolute symlink starting with #{string}:" absolute_symlinks_start_with_string << pn
puts " #{pn} -> #{pn.resolved_path}" else
put_symlink_header = true absolute_symlinks_rest << pn
end end
result = true result = true
end end
end end
if ARGV.verbose?
if absolute_symlinks_start_with_string.any?
opoo "Absolute symlink starting with #{string}:"
absolute_symlinks_start_with_string.each do |pn|
puts " #{pn} -> #{pn.resolved_path}"
end
end
if absolute_symlinks_rest.any?
opoo "Absolute symlink:"
absolute_symlinks_rest.each do |pn|
puts " #{pn} -> #{pn.resolved_path}"
end
end
end
result result
end end