Be smarter about finding a tap's autobump.txt

- Livecheck blocks can exist in taps other than Core and Cask.
- And packages can have the same name in multiple taps.
This commit is contained in:
Issy Long 2025-01-02 17:41:45 +00:00
parent a71786a332
commit 296c2b9f3f
No known key found for this signature in database

View File

@ -92,16 +92,26 @@ module Homebrew
end end
end end
# Skip packages that are autobumped by BrewTestBot, unless `--autobump` if skip_autobump?
# or `HOMEBREW_LIVECHECK_AUTOBUMP` are set. autobump_files = {}
if skip_autobump? && autobump_core_path.exist? && autobump_cask_path.exist?
autobump_core = File.read(autobump_core_path).lines.map(&:strip) formulae_and_casks_to_check.each do |formula_or_cask|
autobump_cask = File.read(autobump_cask_path).lines.map(&:strip) tap = formula_or_cask.tap
next if tap.nil?
autobump_files[tap] ||= begin
autobump_path = tap.path/".github/autobump.txt"
autobump_path.exist? ? File.read(autobump_path).lines.map(&:strip) : []
end
end
formulae_and_casks_to_check = formulae_and_casks_to_check.reject do |formula_or_cask| 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?
name = formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name name = formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name
if (autobump_core + autobump_cask).include?(name) if autobump_files[tap].include?(name)
odebug "Skipping #{name} as it is autobumped." odebug "Skipping #{name} as it is autobumped in #{tap}."
true true
end end
end end
@ -135,16 +145,6 @@ module Homebrew
@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(Pathname) }
def autobump_core_path
@autobump_core_path ||= T.let(Tap.fetch("homebrew/core").path/".github/autobump.txt", T.nilable(Pathname))
end
sig { returns(Pathname) }
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) } sig { returns(T::Boolean) }
def skip_autobump? def skip_autobump?
!(args.autobump? || Homebrew::EnvConfig.livecheck_autobump?) !(args.autobump? || Homebrew::EnvConfig.livecheck_autobump?)