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

formulae_dependents: traverse dep tree when linking dependencies #721

Merged
merged 7 commits into from
Nov 19, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions lib/tests/formulae_dependents.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,18 @@ def install_dependent(dependent, testable_dependents, args:, build_from_source:
if testable_dependents.include? dependent
test "brew", "install", "--only-dependencies", "--include-test", dependent.full_name

dependent.recursive_dependencies.each do |dependency|
next if dependency.build? && !dependency.test?

# Traverse the dependency tree to check for formulae we need to link
dependencies_to_link = Dependency.expand(dependent, cache_key: "test-bot-link-#{dependent.full_name}-#{Time.now.to_f}") do |dep_dependent, dependency|
Dependency.prune if dependency.build? && !dependency.test?
Dependency.prune if dependency.test? && dep_dependent != dependent
dependency_f = dependency.to_formula
carlocab marked this conversation as resolved.
Show resolved Hide resolved
# We don't want to attempt to link runtime deps of build deps.
next unless dependency_f.any_version_installed?
next if dependency_f.keg_only?
next if dependency_f.linked_keg.exist?
Dependency.skip if dependency_f.keg_only?
carlocab marked this conversation as resolved.
Show resolved Hide resolved
Dependency.skip if dependency_f.linked?
end.map(&:to_formula)
carlocab marked this conversation as resolved.
Show resolved Hide resolved

unlink_conflicts dependency_f
test "brew", "link", dependency_f.full_name
dependencies_to_link.each do |f|
unlink_conflicts f
test "brew", "link", f.full_name
carlocab marked this conversation as resolved.
Show resolved Hide resolved
end

env = {}
Expand Down