Further tweak :test dependency handling

- ensure that cases where `:build` and `:test` both apply to a
  dependency that we handle it appropriately
- fix reintroduced regression
  (https://github.com/Homebrew/brew/pull/6471#issuecomment-533414923).
  Fixes #6470.
This commit is contained in:
Mike McQuaid 2020-05-19 14:23:49 +01:00
parent 731c723c4a
commit 8b98ed1f47
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
2 changed files with 9 additions and 4 deletions

View File

@ -52,6 +52,8 @@ class Build
Requirement.prune
elsif req.prune_if_build_and_not_dependent?(dependent, formula)
Requirement.prune
elsif req.test?
Requirement.prune
end
end
end
@ -65,6 +67,8 @@ class Build
Dependency.prune
elsif dep.build?
Dependency.keep_but_prune_recursive_deps
elsif dep.test?
Dependency.prune
end
end
end

View File

@ -488,10 +488,11 @@ class FormulaInstaller
if dep.prune_from_option?(build)
Dependency.prune
elsif dep.test? && !dep.build? && !include_test?
Dependency.prune
elsif dep.build? && !dep.test? && install_bottle_for?(dependent, build)
Dependency.prune
elsif dep.test? || (dep.build? && install_bottle_for?(dependent, build))
keep = false
keep ||= dep.test? && include_test? && dependent == formula
keep ||= dep.build? && !install_bottle_for?(dependent, build)
Dependency.prune unless keep
elsif dep.prune_if_build_and_not_dependent?(dependent)
Dependency.prune
elsif dep.satisfied?(inherited_options[dep.name])