Merge pull request #4429 from MikeMcQuaid/linkage-optional-deps

linkage: fix output of optional dependencies.
This commit is contained in:
Mike McQuaid 2018-07-06 08:12:03 +01:00 committed by GitHub
commit 4840b688e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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. # Returns a list of Dependency objects that are required at runtime.
# @private # @private
def runtime_dependencies(read_from_tab: true) def runtime_dependencies(read_from_tab: true, undeclared: true)
if read_from_tab && if read_from_tab &&
(keg = opt_or_installed_prefix_keg) && (keg = opt_or_installed_prefix_keg) &&
(tab_deps = keg.runtime_dependencies) (tab_deps = keg.runtime_dependencies)
@ -1529,6 +1529,7 @@ class Formula
end.compact end.compact
end end
return declared_runtime_dependencies unless undeclared
declared_runtime_dependencies | undeclared_runtime_dependencies declared_runtime_dependencies | undeclared_runtime_dependencies
end end

View File

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