Merge pull request #4430 from MikeMcQuaid/handle-build-dep-reqs

formula_installer: correctly handle build dep reqs.
This commit is contained in:
Mike McQuaid 2018-07-05 21:35:38 +01:00 committed by GitHub
commit 9fff177844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -436,8 +436,12 @@ class FormulaInstaller
def expand_requirements def expand_requirements
unsatisfied_reqs = Hash.new { |h, k| h[k] = [] } unsatisfied_reqs = Hash.new { |h, k| h[k] = [] }
deps = [] req_deps = []
formulae = [formula] formulae = [formula]
formula_deps_map = Dependency.expand(formula)
.each_with_object({}) do |dep, hash|
hash[dep.name] = dep
end
while f = formulae.pop while f = formulae.pop
runtime_requirements = runtime_requirements(f) runtime_requirements = runtime_requirements(f)
@ -453,6 +457,8 @@ class FormulaInstaller
next next
elsif !runtime_requirements.include?(req) && install_bottle_for_dependent elsif !runtime_requirements.include?(req) && install_bottle_for_dependent
Requirement.prune Requirement.prune
elsif (dep = formula_deps_map[dependent.name]) && dep.build?
Requirement.prune
else else
unsatisfied_reqs[dependent] << req unsatisfied_reqs[dependent] << req
end end
@ -460,9 +466,9 @@ class FormulaInstaller
end end
# Merge the repeated dependencies, which may have different tags. # Merge the repeated dependencies, which may have different tags.
deps = Dependency.merge_repeats(deps) req_deps = Dependency.merge_repeats(req_deps)
[unsatisfied_reqs, deps] [unsatisfied_reqs, req_deps]
end end
def expand_dependencies(deps) def expand_dependencies(deps)