tab: set runtime_dependencies consistently.

This commit is contained in:
Mike McQuaid 2018-06-01 19:53:26 +01:00
parent 6b817f775f
commit 42e5ef9f89
3 changed files with 16 additions and 7 deletions

View File

@ -1523,8 +1523,9 @@ class Formula
(keg = opt_or_installed_prefix_keg) &&
(tab_deps = keg.runtime_dependencies)
return tab_deps.map do |d|
next unless d["full_name"]
Dependency.new d["full_name"]
full_name = d["full_name"]
next unless full_name
Dependency.new full_name
end.compact
end

View File

@ -613,7 +613,7 @@ class FormulaInstaller
# Update tab with actual runtime dependencies
tab = Tab.for_keg(keg)
Tab.clear_cache
tab.runtime_dependencies =
tab.runtime_dependency_objects =
formula.runtime_dependencies(read_from_tab: false)
tab.write

View File

@ -33,10 +33,7 @@ class Tab < OpenStruct
"compiler" => compiler,
"stdlib" => stdlib,
"aliases" => formula.aliases,
"runtime_dependencies" => runtime_deps.map do |dep|
f = dep.to_formula
{ "full_name" => f.full_name, "version" => f.version.to_s }
end,
"runtime_dependencies" => Tab.runtime_deps_hash(runtime_deps),
"source" => {
"path" => formula.specified_path.to_s,
"tap" => formula.tap&.name,
@ -203,6 +200,13 @@ class Tab < OpenStruct
new(attributes)
end
def self.runtime_deps_hash(deps)
deps.map do |dep|
f = dep.to_formula
{ "full_name" => f.full_name, "version" => f.version.to_s }
end
end
def with?(val)
option_names = val.respond_to?(:option_names) ? val.option_names : [val]
@ -262,6 +266,10 @@ class Tab < OpenStruct
super unless parsed_homebrew_version < "1.1.6"
end
def runtime_dependency_objects=(deps)
source["runtime_dependencies"] = Tab.runtime_deps_hash(deps)
end
def cxxstdlib
# Older tabs won't have these values, so provide sensible defaults
lib = stdlib.to_sym if stdlib