linkage: fix output of optional dependencies.

Check the runtime dependencies from the tab when outputting the
`brew linkage` declared vs. undeclared dependencies.
This commit is contained in:
Mike McQuaid 2018-07-05 20:29:19 +01:00
parent 15ac935ed6
commit f5fbb74aaf
2 changed files with 4 additions and 2 deletions

View File

@ -1518,7 +1518,7 @@ class Formula
# Returns a list of Dependency objects that are required at runtime.
# @private
def runtime_dependencies(read_from_tab: true)
def runtime_dependencies(read_from_tab: true, undeclared: true)
if read_from_tab &&
(keg = opt_or_installed_prefix_keg) &&
(tab_deps = keg.runtime_dependencies)
@ -1529,6 +1529,7 @@ class Formula
end.compact
end
return declared_runtime_dependencies unless undeclared
declared_runtime_dependencies | undeclared_runtime_dependencies
end

View File

@ -149,7 +149,8 @@ class LinkageChecker
declared_deps_names = declared_deps_full_names.map do |dep|
dep.split("/").last
end
recursive_deps = formula.declared_runtime_dependencies.map do |dep|
recursive_deps = formula.runtime_dependencies(undeclared: false)
.map do |dep|
begin
dep.to_formula.name
rescue FormulaUnavailableError