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