From fe204fdf4b5e7c10f88cf19e099b5bbedd67c600 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Fri, 11 Sep 2015 16:49:39 +0800 Subject: [PATCH] bottle: fix output for absolute symlinks Closes Homebrew/homebrew#43816. Signed-off-by: Xu Cheng --- Library/Homebrew/cmd/bottle.rb | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index 4400d84702..653d403aa9 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -76,15 +76,12 @@ module Homebrew Utils.popen_read("strings", "-t", "x", "-", file.to_s) do |io| until io.eof? str = io.readline.chomp - next if ignores.any? { |i| i =~ str } - next unless str.include? string - offset, match = str.split(" ", 2) - 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? print_filename string, file @@ -94,19 +91,36 @@ module Homebrew end end - put_symlink_header = false + absolute_symlinks_start_with_string = [] + absolute_symlinks_rest = [] keg.find do |pn| if pn.symlink? && (link = pn.readlink).absolute? - if !put_symlink_header && link.to_s.start_with?(string) - opoo "Absolute symlink starting with #{string}:" - puts " #{pn} -> #{pn.resolved_path}" - put_symlink_header = true + if link.to_s.start_with?(string) + absolute_symlinks_start_with_string << pn + else + absolute_symlinks_rest << pn end result = true 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 end