From a71786a332e8f4b050af29f351348e1d8e0c3c05 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 2 Jan 2025 17:20:32 +0000 Subject: [PATCH] Flag and envvar to include autobumped formulae - This is useful for maintainers to check the full range of livecheck functionality. --- Library/Homebrew/dev-cmd/livecheck.rb | 14 +++++++++++--- Library/Homebrew/env_config.rb | 4 ++++ .../rbi/dsl/homebrew/dev_cmd/livecheck_cmd.rbi | 4 +++- .../sorbet/rbi/dsl/homebrew/env_config.rbi | 3 +++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/dev-cmd/livecheck.rb b/Library/Homebrew/dev-cmd/livecheck.rb index 2746145a23..814415eb7e 100644 --- a/Library/Homebrew/dev-cmd/livecheck.rb +++ b/Library/Homebrew/dev-cmd/livecheck.rb @@ -14,7 +14,7 @@ module Homebrew Check for newer versions of formulae and/or casks from upstream. If no formula or cask argument is passed, the list of formulae and casks to check is taken from `HOMEBREW_LIVECHECK_WATCHLIST` or - `~/.homebrew/livecheck_watchlist.txt`, excluding autobumped formulae. + `~/.homebrew/livecheck_watchlist.txt`. EOS switch "--full-name", description: "Print formulae and casks with fully-qualified names." @@ -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,8 +92,9 @@ module Homebrew end end - # Skip packages that are autobumped by BrewTestBot, if there are any. - if autobump_core_path.exist? && autobump_cask_path.exist? + # Skip packages that are autobumped by BrewTestBot, unless `--autobump` + # or `HOMEBREW_LIVECHECK_AUTOBUMP` are set. + if skip_autobump? && autobump_core_path.exist? && autobump_cask_path.exist? autobump_core = File.read(autobump_core_path).lines.map(&:strip) autobump_cask = File.read(autobump_cask_path).lines.map(&:strip) @@ -141,6 +144,11 @@ module Homebrew def autobump_cask_path @autobump_cask_path ||= T.let(Tap.fetch("homebrew/cask").path/".github/autobump.txt", T.nilable(Pathname)) 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 e201d22398..f781de80ce 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -303,6 +303,10 @@ module Homebrew "or `$HOME/.homebrew/livecheck_watchlist.txt` otherwise.", default: "#{ENV.fetch("HOMEBREW_USER_CONFIG_HOME")}/livecheck_watchlist.txt", }, + HOMEBREW_LIVECHECK_AUTOBUMP: { + description: "If set, `brew livecheck` will include data for packages that are autobumped by BrewTestBot.", + boolean: true, + }, HOMEBREW_LOCK_CONTEXT: { description: "If set, Homebrew will add this output as additional context for locking errors. " \ "This is useful when running `brew` in the background.", 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