build: ignore non-explicit build-time dependencies
Given the following dependency tree: foo bar (bottled) baz (build-time only) We skip installing baz because it is a build-time dependency of something that is bottled. However, during the build of foo, this filter is not applied because the dependent-dep relationship is not considered at this stage. If baz wasn't installed prior to this build, fixopt(baz) will fail. Further, build-time deps are tightly coupled to the formula they are specified by, and we shouldn't rely on them coming from dependencies several levels down. Fixes Homebrew/homebrew#17697.
This commit is contained in:
parent
1e47298456
commit
97f9f93f25
@ -69,8 +69,18 @@ def pre_superenv_hacks f
|
||||
not ARGV.include? '--env=super'
|
||||
end
|
||||
|
||||
def expand_deps f
|
||||
f.recursive_dependencies do |dependent, dep|
|
||||
if dep.optional? || dep.recommended?
|
||||
Dependency.prune unless dependent.build.with?(dep.name)
|
||||
elsif dep.build?
|
||||
Dependency.prune unless dependent == f
|
||||
end
|
||||
end.map(&:to_formula)
|
||||
end
|
||||
|
||||
def install f
|
||||
deps = f.recursive_dependencies.map(&:to_formula)
|
||||
deps = expand_deps(f)
|
||||
keg_only_deps = deps.select(&:keg_only?)
|
||||
|
||||
pre_superenv_hacks(f)
|
||||
@ -83,7 +93,7 @@ def install f
|
||||
|
||||
if superenv?
|
||||
ENV.deps = keg_only_deps.map(&:to_s)
|
||||
ENV.all_deps = f.recursive_dependencies.map(&:to_s)
|
||||
ENV.all_deps = deps.map(&:to_s)
|
||||
ENV.x11 = f.recursive_requirements.detect { |rq| rq.kind_of?(X11Dependency) }
|
||||
ENV.setup_build_environment
|
||||
post_superenv_hacks(f)
|
||||
|
Loading…
x
Reference in New Issue
Block a user