Flag and envvar to include autobumped formulae

- This is useful for maintainers to check the full range of livecheck functionality.
This commit is contained in:
Issy Long 2025-01-02 17:20:32 +00:00
parent 4b94bbb4d4
commit a71786a332
No known key found for this signature in database
4 changed files with 21 additions and 4 deletions

View File

@ -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

View File

@ -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.",

View File

@ -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

View File

@ -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