formula_installer: reduce dependency expansion computations

This commit is contained in:
Bo Anderson 2021-03-06 00:42:26 +00:00
parent 344ab02f18
commit 96670cedb2
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65

View File

@ -517,9 +517,11 @@ class FormulaInstaller
# Compute and collect the dependencies needed by the formula currently # Compute and collect the dependencies needed by the formula currently
# being installed. # being installed.
def compute_dependencies def compute_dependencies
req_map, req_deps = expand_requirements @compute_dependencies ||= begin
check_requirements(req_map) req_map, req_deps = expand_requirements
expand_dependencies(req_deps + formula.deps) check_requirements(req_map)
expand_dependencies(req_deps + formula.deps)
end
end end
def unbottled_dependencies(deps) def unbottled_dependencies(deps)
@ -1232,10 +1234,9 @@ class FormulaInstaller
end end
return if forbidden_licenses.blank? return if forbidden_licenses.blank?
return if ignore_deps?
compute_dependencies.each do |dep, _| compute_dependencies.each do |dep, _|
next if @ignore_deps
dep_f = dep.to_formula dep_f = dep.to_formula
next unless SPDX.licenses_forbid_installation? dep_f.license, forbidden_licenses next unless SPDX.licenses_forbid_installation? dep_f.license, forbidden_licenses
@ -1244,7 +1245,8 @@ class FormulaInstaller
#{SPDX.license_expression_to_string dep_f.license}. #{SPDX.license_expression_to_string dep_f.license}.
EOS EOS
end end
return if @only_deps
return if only_deps?
return unless SPDX.licenses_forbid_installation? formula.license, forbidden_licenses return unless SPDX.licenses_forbid_installation? formula.license, forbidden_licenses