From 17cfa3d83147ca1207d8681d7e3c8ce2a60c6acf Mon Sep 17 00:00:00 2001 From: Michka Popoff Date: Mon, 16 Oct 2023 22:20:48 +0200 Subject: [PATCH] brew unbottled: allow to skip deprecated and change format - Display if a formula is deprecated (helps focusing on the more important ones first when bottling) - Allows to skip deprecated formuale for a more curated list --- Library/Homebrew/dev-cmd/unbottled.rb | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/dev-cmd/unbottled.rb b/Library/Homebrew/dev-cmd/unbottled.rb index 0d3e6201f94a5e..27f025df862fc3 100644 --- a/Library/Homebrew/dev-cmd/unbottled.rb +++ b/Library/Homebrew/dev-cmd/unbottled.rb @@ -24,6 +24,8 @@ def unbottled_args switch "--eval-all", description: "Evaluate all available formulae and casks, whether installed or not, to check them. " \ "Implied if `HOMEBREW_EVAL_ALL` is set." + switch "--skip-deprecated", + description: "Don't check deprecated formulae" conflicts "--dependents", "--total" @@ -137,6 +139,12 @@ def formulae_all_installs_from_args(args, all) all_formulae = Formula.all(eval_all: args.eval_all?) end + if args.skip_deprecated? + formulae = formulae&.select {|formula| !(formula.deprecated?)} + all_formulae = all_formulae&.select {|formula| !(formula.deprecated?)} + formula_installs = formula_installs&.select {|formula| !(formula.deprecated?)} + end + [formulae, all_formulae, formula_installs] end @@ -180,6 +188,7 @@ def output_unbottled(formulae, deps_hash, noun, hash, any_named_args) formulae.each do |f| name = f.name.downcase + deprecated = "(deprecated)" if f.deprecated? if f.disabled? puts "#{Tty.bold}#{Tty.green}#{name}#{Tty.reset}: formula disabled" if any_named_args @@ -189,11 +198,11 @@ def output_unbottled(formulae, deps_hash, noun, hash, any_named_args) requirements = f.recursive_requirements if @bottle_tag.linux? if requirements.any? { |r| r.is_a?(MacOSRequirement) && !r.version } - puts "#{Tty.bold}#{Tty.red}#{name}#{Tty.reset}: requires macOS" if any_named_args + puts "#{Tty.bold}#{Tty.red}#{name}#{Tty.reset} #{deprecated}: requires macOS" if any_named_args next end elsif requirements.any?(LinuxRequirement) - puts "#{Tty.bold}#{Tty.red}#{name}#{Tty.reset}: requires Linux" if any_named_args + puts "#{Tty.bold}#{Tty.red}#{name}#{Tty.reset} #{deprecated}: requires Linux" if any_named_args next else macos_version = @bottle_tag.to_macos_version @@ -214,13 +223,13 @@ def output_unbottled(formulae, deps_hash, noun, hash, any_named_args) end end unless macos_satisfied - puts "#{Tty.bold}#{Tty.red}#{name}#{Tty.reset}: doesn't support this macOS" if any_named_args + puts "#{Tty.bold}#{Tty.red}#{name}#{Tty.reset} #{deprecated}: doesn't support this macOS" if any_named_args next end end if f.bottle_specification.tag?(@bottle_tag, no_older_versions: true) - puts "#{Tty.bold}#{Tty.green}#{name}#{Tty.reset}: already bottled" if any_named_args + puts "#{Tty.bold}#{Tty.green}#{name}#{Tty.reset} #{deprecated}: already bottled" if any_named_args next end @@ -230,13 +239,13 @@ def output_unbottled(formulae, deps_hash, noun, hash, any_named_args) if deps.blank? count = " (#{hash[f.name]} #{noun})" if noun - puts "#{Tty.bold}#{Tty.green}#{name}#{Tty.reset}#{count}: ready to bottle" + puts "#{Tty.bold}#{Tty.green}#{name}#{Tty.reset}#{count} #{deprecated}: ready to bottle" next end any_found ||= true count = " (#{hash[f.name]} #{noun})" if noun - puts "#{Tty.bold}#{Tty.yellow}#{name}#{Tty.reset}#{count}: unbottled deps: #{deps.join(" ")}" + puts "#{Tty.bold}#{Tty.yellow}#{name}#{Tty.reset}#{count} #{deprecated}: unbottled deps: #{deps.join(" ")}" end return if any_found return if any_named_args