diff --git a/Library/Homebrew/dev-cmd/livecheck.rb b/Library/Homebrew/dev-cmd/livecheck.rb index b811ad4fe6..04cb4d0f5a 100644 --- a/Library/Homebrew/dev-cmd/livecheck.rb +++ b/Library/Homebrew/dev-cmd/livecheck.rb @@ -38,6 +38,8 @@ module Homebrew description: "Only check casks." switch "--extract-plist", description: "Enable checking multiple casks with ExtractPlist strategy." + switch "--autobump", + description: "Include packages that are autobumped by BrewTestBot. By default these are skipped." conflicts "--debug", "--json" conflicts "--tap=", "--eval-all", "--installed" @@ -90,6 +92,26 @@ module Homebrew end end + if skip_autobump? + autobump_lists = {} + + formulae_and_casks_to_check = formulae_and_casks_to_check.reject do |formula_or_cask| + tap = formula_or_cask.tap + next false if tap.nil? + + autobump_lists[tap] ||= begin + autobump_path = tap.path/".github/autobump.txt" + autobump_path.exist? ? autobump_path.readlines.map(&:strip) : [] + end + + name = formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name + if autobump_lists[tap].include?(name) + odebug "Skipping #{name} as it is autobumped in #{tap}." + true + end + end + end + formulae_and_casks_to_check = formulae_and_casks_to_check.sort_by do |formula_or_cask| formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name end @@ -117,6 +139,11 @@ module Homebrew def watchlist_path @watchlist_path ||= T.let(File.expand_path(Homebrew::EnvConfig.livecheck_watchlist), T.nilable(String)) end + + sig { returns(T::Boolean) } + def skip_autobump? + !(args.autobump? || Homebrew::EnvConfig.livecheck_autobump?) + end end end end diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index d2441eb672..44a23c4f37 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -296,6 +296,10 @@ module Homebrew default_text: 'The "Beer Mug" emoji.', default: "🍺", }, + HOMEBREW_LIVECHECK_AUTOBUMP: { + description: "If set, `brew livecheck` will include data for packages that are autobumped by BrewTestBot.", + boolean: true, + }, HOMEBREW_LIVECHECK_WATCHLIST: { description: "Consult this file for the list of formulae to check by default when no formula argument " \ "is passed to `brew livecheck`.", diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/livecheck_cmd.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/livecheck_cmd.rbi index 0729c85370..18ead85de8 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/livecheck_cmd.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/livecheck_cmd.rbi @@ -4,13 +4,15 @@ # This is an autogenerated file for dynamic methods in `Homebrew::DevCmd::LivecheckCmd`. # Please instead update this file by running `bin/tapioca dsl Homebrew::DevCmd::LivecheckCmd`. - class Homebrew::DevCmd::LivecheckCmd sig { returns(Homebrew::DevCmd::LivecheckCmd::Args) } def args; end end class Homebrew::DevCmd::LivecheckCmd::Args < Homebrew::CLI::Args + sig { returns(T::Boolean) } + def autobump?; end + sig { returns(T::Boolean) } def cask?; end diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi index 31f11f8b65..c15fda7c20 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi @@ -196,6 +196,9 @@ module Homebrew::EnvConfig sig { returns(String) } def livecheck_watchlist; end + sig { returns(T::Boolean) } + def livecheck_autobump?; end + sig { returns(T.nilable(::String)) } def lock_context; end