Merge pull request #6397 from amyspark/upgrade-bfs
breadth-first search for dependents upgrade
This commit is contained in:
commit
4822241d6f
@ -213,9 +213,15 @@ module Homebrew
|
|||||||
formulae_to_upgrade = Set.new
|
formulae_to_upgrade = Set.new
|
||||||
formulae_pinned = Set.new
|
formulae_pinned = Set.new
|
||||||
|
|
||||||
formulae.each do |formula|
|
formulae_to_check = formulae
|
||||||
|
checked_formulae = Set.new
|
||||||
|
|
||||||
|
until formulae_to_check.empty?
|
||||||
descendants = Set.new
|
descendants = Set.new
|
||||||
|
|
||||||
|
formulae_to_check.each do |formula|
|
||||||
|
next if checked_formulae.include?(formula)
|
||||||
|
|
||||||
dependents = kegs.select do |keg|
|
dependents = kegs.select do |keg|
|
||||||
keg.runtime_dependencies
|
keg.runtime_dependencies
|
||||||
.any? { |d| d["full_name"] == formula.full_name }
|
.any? { |d| d["full_name"] == formula.full_name }
|
||||||
@ -240,10 +246,10 @@ module Homebrew
|
|||||||
descendants << f
|
descendants << f
|
||||||
end
|
end
|
||||||
|
|
||||||
upgradable_descendants, pinned_descendants = upgradable_dependents(kegs, descendants)
|
checked_formulae << formula
|
||||||
|
end
|
||||||
|
|
||||||
formulae_to_upgrade.merge upgradable_descendants
|
formulae_to_check = descendants
|
||||||
formulae_pinned.merge pinned_descendants
|
|
||||||
end
|
end
|
||||||
|
|
||||||
[formulae_to_upgrade, formulae_pinned]
|
[formulae_to_upgrade, formulae_pinned]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user