pass brew typecheck, brew style and brew tests

This commit is contained in:
thibhero 2025-02-16 00:06:23 -05:00
parent 97678708db
commit 8299c59801

View File

@ -331,33 +331,29 @@ module Homebrew
sized_formulae = f.flat_map do |formula| sized_formulae = f.flat_map do |formula|
# Always include the formula itself. # Always include the formula itself.
formula_list = [formula] formula_list = [formula]
next unless upgrade
deps = args.build_from_source? ? formula.deps.build : formula.deps.required
# If there are dependencies, try to gather outdated, bottled ones. # If there are dependencies, try to gather outdated, bottled ones.
if formula.deps.any? && check_dep if deps.any? && check_dep
outdated_dependents = formula.recursive_dependencies do |_, dep| outdated_dependents = deps.map(&:to_formula).reject(&:pinned?).select do |dep|
dep_formula = dep.to_formula dep.installed_kegs.empty? || (dep.bottled? && dep.outdated?)
next :prune if dep_formula.deps.empty? end
next :prune if !upgrade || !dep_formula.outdated?
next :prune unless dep_formula.bottled?
end.flatten
# Convert each dependency to its formula. formula_list.concat(outdated_dependents)
formula_list.concat(outdated_dependents.flat_map { |dep| Array(dep.to_formula) })
end end
formula_list formula_list
end end
# Add any installed formula that depends on one of the sized formulae and is outdated. # Add any installed formula that depends on one of the sized formulae and is outdated.
if !Homebrew::EnvConfig.no_installed_dependents_check? && check_dep if check_dep && !Homebrew::EnvConfig.no_installed_dependents_check?
installed_outdated = Formula.installed.select do |installed_formula| sized_formulae.concat(Formula.installed.select do |installed_formula|
installed_formula.outdated? && installed_formula.outdated? &&
installed_formula.deps.any? { |dep| sized_formulae.include?(dep.to_formula) } installed_formula.deps.required.any? { |dep| sized_formulae.include?(dep.to_formula) }
end end)
sized_formulae.concat(installed_outdated)
end end
# Uniquify based on a string representation (or any unique identifier)
sized_formulae.uniq(&:to_s) sized_formulae.uniq(&:to_s)
} }
@ -389,11 +385,10 @@ module Homebrew
} }
# Main block: if asking the user is enabled, show dependency and size information. # Main block: if asking the user is enabled, show dependency and size information.
# This part should be
if args.ask? if args.ask?
ohai "Looking for bottles..." ohai "Looking for bottles..."
sized_formulae = compute_sized_formulae.call(installed_formulae, check_dep: true, upgrade: false) sized_formulae = compute_sized_formulae.call(formulae, check_dep: false, upgrade: false)
sizes = compute_total_sizes.call(sized_formulae, debug: args.debug?) sizes = compute_total_sizes.call(sized_formulae, debug: args.debug?)
puts "Formulae: #{sized_formulae.join(", ")}\n\n" puts "Formulae: #{sized_formulae.join(", ")}\n\n"