tab: remove #reliable_runtime_dependencies?
See https://github.com/Homebrew/brew/pull/1750#discussion_r94243825 for discussion. Removes Tab#reliable_runtime_dependencies? in favour of returning nil from Tab#runtime_dependencies if the list is unreliable. Because Homebrew 1.1.6 hasn't been tagged yet, tabs created in tests aren't created with a homebrew_version that marks the runtime_dependencies in the Tab as reliable, so there are some tests that fail. To work around this, I've had to add a line to some tests that explicitly overrides the homebrew_version in the Tab. This is really ugly though, so they should be removed as soon as possible after 1.1.6 is released.
This commit is contained in:
parent
4322c1c562
commit
d998a3fcce
@ -104,10 +104,8 @@ class Keg
|
|||||||
# so need them to be calculated now.
|
# so need them to be calculated now.
|
||||||
#
|
#
|
||||||
# This happens after the initial dependency check because it's sloooow.
|
# This happens after the initial dependency check because it's sloooow.
|
||||||
remaining_formulae = Formula.installed.reject do |f|
|
remaining_formulae = Formula.installed.select do |f|
|
||||||
f.installed_kegs.all? do |k|
|
f.installed_kegs.any? { |k| Tab.for_keg(k).runtime_dependencies.nil? }
|
||||||
Tab.for_keg(k).reliable_runtime_dependencies?
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
keg_names = kegs.map(&:name)
|
keg_names = kegs.map(&:name)
|
||||||
@ -362,7 +360,7 @@ class Keg
|
|||||||
tap = Tab.for_keg(self).source["tap"]
|
tap = Tab.for_keg(self).source["tap"]
|
||||||
Keg.all.select do |keg|
|
Keg.all.select do |keg|
|
||||||
tab = Tab.for_keg(keg)
|
tab = Tab.for_keg(keg)
|
||||||
next unless tab.reliable_runtime_dependencies?
|
next if tab.runtime_dependencies.nil?
|
||||||
tab.runtime_dependencies.any? do |dep|
|
tab.runtime_dependencies.any? do |dep|
|
||||||
# Resolve formula rather than directly comparing names
|
# Resolve formula rather than directly comparing names
|
||||||
# in case of conflicts between formulae from different taps.
|
# in case of conflicts between formulae from different taps.
|
||||||
|
@ -247,15 +247,10 @@ class Tab < OpenStruct
|
|||||||
Version.new(homebrew_version)
|
Version.new(homebrew_version)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Whether there is reliable runtime dependency information in the receipt.
|
def runtime_dependencies
|
||||||
def reliable_runtime_dependencies?
|
|
||||||
return false if runtime_dependencies.nil?
|
|
||||||
|
|
||||||
# Homebrew versions prior to 1.1.6 generated incorrect runtime dependency
|
# Homebrew versions prior to 1.1.6 generated incorrect runtime dependency
|
||||||
# lists.
|
# lists.
|
||||||
return false if parsed_homebrew_version < "1.1.6"
|
super unless parsed_homebrew_version < "1.1.6"
|
||||||
|
|
||||||
true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def cxxstdlib
|
def cxxstdlib
|
||||||
|
@ -32,6 +32,11 @@ class TabTests < Homebrew::TestCase
|
|||||||
|
|
||||||
def test_defaults
|
def test_defaults
|
||||||
tab = Tab.empty
|
tab = Tab.empty
|
||||||
|
|
||||||
|
# FIXME: remove this line after Homebrew 1.1.6 is released.
|
||||||
|
# See https://github.com/Homebrew/brew/pull/1750#discussion_r94254622
|
||||||
|
tab.homebrew_version = "1.1.6"
|
||||||
|
|
||||||
assert_empty tab.unused_options
|
assert_empty tab.unused_options
|
||||||
assert_empty tab.used_options
|
assert_empty tab.used_options
|
||||||
assert_nil tab.changed_files
|
assert_nil tab.changed_files
|
||||||
@ -89,27 +94,27 @@ class TabTests < Homebrew::TestCase
|
|||||||
assert tab.parsed_homebrew_version < "2.0.0-135-g01789abdf"
|
assert tab.parsed_homebrew_version < "2.0.0-135-g01789abdf"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_reliable_runtime_dependencies?
|
def test_runtime_dependencies
|
||||||
tab = Tab.new
|
tab = Tab.new
|
||||||
refute_predicate tab, :reliable_runtime_dependencies?
|
assert_nil tab.runtime_dependencies
|
||||||
|
|
||||||
tab.homebrew_version = "1.1.6"
|
tab.homebrew_version = "1.1.6"
|
||||||
refute_predicate tab, :reliable_runtime_dependencies?
|
assert_nil tab.runtime_dependencies
|
||||||
|
|
||||||
tab.runtime_dependencies = []
|
tab.runtime_dependencies = []
|
||||||
assert_predicate tab, :reliable_runtime_dependencies?
|
refute_nil tab.runtime_dependencies
|
||||||
|
|
||||||
tab.homebrew_version = "1.1.5"
|
tab.homebrew_version = "1.1.5"
|
||||||
refute_predicate tab, :reliable_runtime_dependencies?
|
assert_nil tab.runtime_dependencies
|
||||||
|
|
||||||
tab.homebrew_version = "1.1.7"
|
tab.homebrew_version = "1.1.7"
|
||||||
assert_predicate tab, :reliable_runtime_dependencies?
|
refute_nil tab.runtime_dependencies
|
||||||
|
|
||||||
tab.homebrew_version = "1.1.10"
|
tab.homebrew_version = "1.1.10"
|
||||||
assert_predicate tab, :reliable_runtime_dependencies?
|
refute_nil tab.runtime_dependencies
|
||||||
|
|
||||||
tab.runtime_dependencies = [{ "full_name" => "foo", "version" => "1.0" }]
|
tab.runtime_dependencies = [{ "full_name" => "foo", "version" => "1.0" }]
|
||||||
assert_predicate tab, :reliable_runtime_dependencies?
|
refute_nil tab.runtime_dependencies
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_cxxstdlib
|
def test_cxxstdlib
|
||||||
@ -194,6 +199,10 @@ class TabTests < Homebrew::TestCase
|
|||||||
stdlib = :libcxx
|
stdlib = :libcxx
|
||||||
tab = Tab.create(f, compiler, stdlib)
|
tab = Tab.create(f, compiler, stdlib)
|
||||||
|
|
||||||
|
# FIXME: remove this line after Homebrew 1.1.6 is released.
|
||||||
|
# See https://github.com/Homebrew/brew/pull/1750#discussion_r94254622
|
||||||
|
tab.homebrew_version = "1.1.6"
|
||||||
|
|
||||||
runtime_dependencies = [
|
runtime_dependencies = [
|
||||||
{ "full_name" => "bar", "version" => "2.0" },
|
{ "full_name" => "bar", "version" => "2.0" },
|
||||||
{ "full_name" => "user/repo/from_tap", "version" => "1.0" },
|
{ "full_name" => "user/repo/from_tap", "version" => "1.0" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user