tab: add declared_directly field for runtime deps
This commit is contained in:
parent
8004deccd2
commit
a5cb621fb8
@ -805,7 +805,7 @@ class FormulaInstaller
|
||||
tab = Tab.for_keg(keg)
|
||||
Tab.clear_cache
|
||||
f_runtime_deps = formula.runtime_dependencies(read_from_tab: false)
|
||||
tab.runtime_dependencies = Tab.runtime_deps_hash(f_runtime_deps)
|
||||
tab.runtime_dependencies = Tab.runtime_deps_hash(formula, f_runtime_deps)
|
||||
tab.write
|
||||
|
||||
# let's reset Utils::Git.available? if we just installed git
|
||||
|
@ -36,7 +36,7 @@ class Tab < OpenStruct
|
||||
"compiler" => compiler,
|
||||
"stdlib" => stdlib,
|
||||
"aliases" => formula.aliases,
|
||||
"runtime_dependencies" => Tab.runtime_deps_hash(runtime_deps),
|
||||
"runtime_dependencies" => Tab.runtime_deps_hash(formula, runtime_deps),
|
||||
"arch" => Hardware::CPU.arch,
|
||||
"source" => {
|
||||
"path" => formula.specified_path.to_s,
|
||||
@ -210,10 +210,14 @@ class Tab < OpenStruct
|
||||
new(attributes)
|
||||
end
|
||||
|
||||
def self.runtime_deps_hash(deps)
|
||||
def self.runtime_deps_hash(formula, deps)
|
||||
deps.map do |dep|
|
||||
f = dep.to_formula
|
||||
{ "full_name" => f.full_name, "version" => f.version.to_s }
|
||||
{
|
||||
"full_name" => f.full_name,
|
||||
"version" => f.version.to_s,
|
||||
"declared_directly" => formula.deps.include?(dep),
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -137,13 +137,14 @@ describe Tab do
|
||||
|
||||
specify "::runtime_deps_hash" do
|
||||
runtime_deps = [Dependency.new("foo")]
|
||||
stub_formula_loader formula("foo") { url "foo-1.0" }
|
||||
runtime_deps_hash = described_class.runtime_deps_hash(runtime_deps)
|
||||
foo = formula("foo") { url "foo-1.0" }
|
||||
stub_formula_loader foo
|
||||
runtime_deps_hash = described_class.runtime_deps_hash(foo, runtime_deps)
|
||||
tab = described_class.new
|
||||
tab.homebrew_version = "1.1.6"
|
||||
tab.runtime_dependencies = runtime_deps_hash
|
||||
expect(tab.runtime_dependencies).to eql(
|
||||
[{ "full_name" => "foo", "version" => "1.0" }],
|
||||
[{ "full_name" => "foo", "version" => "1.0", "declared_directly" => false }],
|
||||
)
|
||||
end
|
||||
|
||||
@ -268,8 +269,8 @@ describe Tab do
|
||||
tab = described_class.create(f, compiler, stdlib)
|
||||
|
||||
runtime_dependencies = [
|
||||
{ "full_name" => "bar", "version" => "2.0" },
|
||||
{ "full_name" => "user/repo/from_tap", "version" => "1.0" },
|
||||
{ "full_name" => "bar", "version" => "2.0", "declared_directly" => true },
|
||||
{ "full_name" => "user/repo/from_tap", "version" => "1.0", "declared_directly" => true },
|
||||
]
|
||||
expect(tab.runtime_dependencies).to eq(runtime_dependencies)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user