modifying ask function as it didn't find the whole hierarchy for parents

This commit is contained in:
thibhero 2025-05-31 12:53:38 -04:00
parent 3963af774a
commit 3f1341eb6a

View File

@ -428,7 +428,11 @@ module Homebrew
dep.installed_kegs.empty? || (dep.bottled? && dep.outdated?)
end
deps.map(&:to_formula).each do |f|
outdated_dependents.concat(f.recursive_dependencies.map(&:to_formula).reject(&:pinned?).select do |dep|
prune_build = f.recursive_dependencies do |_, dep|
:prune if dep.build?
end
# select the outdated one or not installed
outdated_dependents.concat(prune_build.map(&:to_formula).reject(&:pinned?).select do |dep|
dep.installed_kegs.empty? || (dep.bottled? && dep.outdated?)
end)
end
@ -436,13 +440,23 @@ module Homebrew
formula_list
end
# Add any installed formula that depends on one of the sized formulae and is outdated.
unless Homebrew::EnvConfig.no_installed_dependents_check?
sized_formulae.concat(Formula.installed.select do |installed_formula|
installed_formula.bottled? && installed_formula.outdated? &&
installed_formula.deps.required.map(&:to_formula).intersect?(sized_formulae)
end)
loop do
new_parents = Formula.installed.select do |installed_formula|
next unless installed_formula.bottled?
next unless installed_formula.outdated?
required_deps = installed_formula.deps.required.map(&:to_formula)
required_deps.intersect?(sized_formulae)
end
# Exclude anything already in sized_formulae
new_parents -= sized_formulae
break if new_parents.empty?
sized_formulae.concat(new_parents)
end
end
sized_formulae.uniq(&:to_s).compact