bottle: ignore go libexec path for stuff using go.

These paths cannot be removed and are just used for debug stacktraces so seem
to not be harmful for us to selectively ignore.

Closes Homebrew/homebrew#36894.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Mike McQuaid 2015-02-20 14:29:43 +00:00
parent 15bebd6e7e
commit f60396f64a

View File

@ -33,30 +33,37 @@ BOTTLE_ERB = <<-EOS
EOS EOS
module Homebrew module Homebrew
def keg_contains string, keg def print_filename string, filename
if not ARGV.homebrew_developer? unless @put_string_exists_header
return quiet_system 'fgrep', '--recursive', '--quiet', '--max-count=1', string, keg.to_s opoo "String '#{string}' still exists in these files:"
@put_string_exists_header = true
end end
@put_filenames ||= []
unless @put_filenames.include? filename
puts "#{Tty.red}#{filename}#{Tty.reset}"
@put_filenames << filename
end
end
def keg_contains string, keg, ignores
result = false result = false
index = 0
keg.each_unique_file_matching(string) do |file| keg.each_unique_file_matching(string) do |file|
if ARGV.verbose? put_filename = false
opoo "String '#{string}' still exists in these files:" if index.zero?
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.
if file.mach_o_executable? or file.dylib? or file.mach_o_bundle? if file.mach_o_executable? or file.dylib? or file.mach_o_bundle?
linked_libraries = file.dynamically_linked_libraries linked_libraries = file.dynamically_linked_libraries
linked_libraries = linked_libraries.select { |lib| lib.include? string } linked_libraries = linked_libraries.select { |lib| lib.include? string }
result ||= linked_libraries.any?
else else
linked_libraries = [] linked_libraries = []
end end
if ARGV.verbose? if ARGV.verbose?
print_filename(string, file) if linked_libraries.any?
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
@ -67,30 +74,32 @@ module Homebrew
until io.eof? until io.eof?
str = io.readline.chomp str = io.readline.chomp
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
if ARGV.verbose? if ARGV.verbose?
print_filename string, file
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 end
index += 1
result = true
end end
index = 0 put_symlink_header = false
keg.find do |pn| keg.find do |pn|
if pn.symlink? && (link = pn.readlink).absolute? if pn.symlink? && (link = pn.readlink).absolute?
if link.to_s.start_with?(string) if !put_symlink_header && link.to_s.start_with?(string)
opoo "Absolute symlink starting with #{string}:" if index.zero? opoo "Absolute symlink starting with #{string}:"
puts " #{pn} -> #{pn.resolved_path}" puts " #{pn} -> #{pn.resolved_path}"
put_symlink_header = true
end end
index += 1
result = true result = true
end end
end end
@ -163,8 +172,13 @@ module Homebrew
prefix_check = prefix prefix_check = prefix
end end
relocatable = !keg_contains(prefix_check, keg) ignores = []
relocatable = !keg_contains(cellar, keg) && relocatable if f.deps.any? { |dep| dep.name == "go" }
ignores << %r{#{HOMEBREW_CELLAR}/go/[\d\.]+/libexec}
end
relocatable = !keg_contains(prefix_check, keg, ignores)
relocatable = !keg_contains(cellar, keg, ignores) && relocatable
puts if !relocatable && ARGV.verbose? 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? }