From 296c2b9f3fc4760cac5eb516394fa16b9c9bf0d6 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 2 Jan 2025 17:41:45 +0000 Subject: [PATCH] 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. --- Library/Homebrew/dev-cmd/livecheck.rb | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Library/Homebrew/dev-cmd/livecheck.rb b/Library/Homebrew/dev-cmd/livecheck.rb index 814415eb7e..2b62b037a5 100644 --- a/Library/Homebrew/dev-cmd/livecheck.rb +++ b/Library/Homebrew/dev-cmd/livecheck.rb @@ -92,16 +92,26 @@ module Homebrew end end - # 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) + if skip_autobump? + autobump_files = {} + + formulae_and_casks_to_check.each do |formula_or_cask| + 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| + 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 - if (autobump_core + autobump_cask).include?(name) - odebug "Skipping #{name} as it is autobumped." + if autobump_files[tap].include?(name) + odebug "Skipping #{name} as it is autobumped in #{tap}." true end end @@ -135,16 +145,6 @@ module Homebrew @watchlist_path ||= T.let(File.expand_path(Homebrew::EnvConfig.livecheck_watchlist), T.nilable(String)) 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) } def skip_autobump? !(args.autobump? || Homebrew::EnvConfig.livecheck_autobump?)