Merge pull request #18984 from Homebrew/livecheck-skip-autobumped-formulae

dev-cmd/livecheck: Skip autobumped formulae
This commit is contained in:
Issy Long 2025-01-04 15:27:16 +00:00 committed by GitHub
commit 683f85f4b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 37 additions and 1 deletions

View File

@ -38,6 +38,8 @@ module Homebrew
description: "Only check casks." description: "Only check casks."
switch "--extract-plist", switch "--extract-plist",
description: "Enable checking multiple casks with ExtractPlist strategy." 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 "--debug", "--json"
conflicts "--tap=", "--eval-all", "--installed" conflicts "--tap=", "--eval-all", "--installed"
@ -90,6 +92,26 @@ module Homebrew
end end
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| 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 formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name
end end
@ -117,6 +139,11 @@ module Homebrew
def watchlist_path def watchlist_path
@watchlist_path ||= T.let(File.expand_path(Homebrew::EnvConfig.livecheck_watchlist), T.nilable(String)) @watchlist_path ||= T.let(File.expand_path(Homebrew::EnvConfig.livecheck_watchlist), T.nilable(String))
end end
sig { returns(T::Boolean) }
def skip_autobump?
!(args.autobump? || Homebrew::EnvConfig.livecheck_autobump?)
end
end end
end end
end end

View File

@ -296,6 +296,10 @@ module Homebrew
default_text: 'The "Beer Mug" emoji.', default_text: 'The "Beer Mug" emoji.',
default: "🍺", default: "🍺",
}, },
HOMEBREW_LIVECHECK_AUTOBUMP: {
description: "If set, `brew livecheck` will include data for packages that are autobumped by BrewTestBot.",
boolean: true,
},
HOMEBREW_LIVECHECK_WATCHLIST: { HOMEBREW_LIVECHECK_WATCHLIST: {
description: "Consult this file for the list of formulae to check by default when no formula argument " \ description: "Consult this file for the list of formulae to check by default when no formula argument " \
"is passed to `brew livecheck`.", "is passed to `brew livecheck`.",

View File

@ -4,13 +4,15 @@
# This is an autogenerated file for dynamic methods in `Homebrew::DevCmd::LivecheckCmd`. # 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`. # Please instead update this file by running `bin/tapioca dsl Homebrew::DevCmd::LivecheckCmd`.
class Homebrew::DevCmd::LivecheckCmd class Homebrew::DevCmd::LivecheckCmd
sig { returns(Homebrew::DevCmd::LivecheckCmd::Args) } sig { returns(Homebrew::DevCmd::LivecheckCmd::Args) }
def args; end def args; end
end end
class Homebrew::DevCmd::LivecheckCmd::Args < Homebrew::CLI::Args class Homebrew::DevCmd::LivecheckCmd::Args < Homebrew::CLI::Args
sig { returns(T::Boolean) }
def autobump?; end
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def cask?; end def cask?; end

View File

@ -196,6 +196,9 @@ module Homebrew::EnvConfig
sig { returns(String) } sig { returns(String) }
def livecheck_watchlist; end def livecheck_watchlist; end
sig { returns(T::Boolean) }
def livecheck_autobump?; end
sig { returns(T.nilable(::String)) } sig { returns(T.nilable(::String)) }
def lock_context; end def lock_context; end