Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bottle: Skip matches to files in build deps #5366

Merged
merged 1 commit into from Dec 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 17 additions & 3 deletions Library/Homebrew/dev-cmd/bottle.rb
Expand Up @@ -134,7 +134,7 @@ def ensure_relocation_formulae_installed!
end
end

def keg_contain?(string, keg, ignores)
def keg_contain?(string, keg, ignores, formula_and_runtime_deps_names = nil)
@put_string_exists_header, @put_filenames = nil

print_filename = lambda do |str, filename|
Expand Down Expand Up @@ -178,6 +178,19 @@ def keg_contain?(string, keg, ignores)
offset, match = str.split(" ", 2)
next if linked_libraries.include? match # Don't bother reporting a string if it was found by otool

# Do not report matches to files that do not exist.
next unless File.exist? match

# Do not report matches to build dependencies.
if formula_and_runtime_deps_names.present?
begin
keg_name = Keg.for(Pathname.new(match)).name
next unless formula_and_runtime_deps_names.include? keg_name
rescue NotAKegError
nil
end
end

result = true
text_matches << [match, offset]
end
Expand Down Expand Up @@ -272,6 +285,7 @@ def bottle_formula(f)

ohai "Bottling #{filename}..."

formula_and_runtime_deps_names = [f.name] + f.runtime_dependencies.map(&:name)
keg = Keg.new(f.prefix)
relocatable = false
skip_relocation = false
Expand Down Expand Up @@ -342,9 +356,9 @@ def bottle_formula(f)
if args.skip_relocation?
skip_relocation = true
else
relocatable = false if keg_contain?(prefix_check, keg, ignores)
relocatable = false if keg_contain?(prefix_check, keg, ignores, formula_and_runtime_deps_names)
relocatable = false if keg_contain?(repository, keg, ignores)
relocatable = false if keg_contain?(cellar, keg, ignores)
relocatable = false if keg_contain?(cellar, keg, ignores, formula_and_runtime_deps_names)
if prefix != prefix_check
relocatable = false if keg_contain_absolute_symlink_starting_with?(prefix, keg)
relocatable = false if keg_contain?("#{prefix}/etc", keg, ignores)
Expand Down