Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev-cmd/livecheck: Skip autobumped formulae #18984

Merged
merged 6 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Library/Homebrew/dev-cmd/livecheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class LivecheckCmd < AbstractCommand
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"
Expand Down Expand Up @@ -90,6 +92,31 @@ def run
end
end

if skip_autobump?
autobump_files = {}
issyl0 marked this conversation as resolved.
Show resolved Hide resolved

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_files[tap].include?(name)
odebug "Skipping #{name} as it is autobumped in #{tap}."
true
end
end
issyl0 marked this conversation as resolved.
Show resolved Hide resolved
end

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
end
Expand Down Expand Up @@ -117,6 +144,11 @@ def run
def watchlist_path
@watchlist_path ||= T.let(File.expand_path(Homebrew::EnvConfig.livecheck_watchlist), T.nilable(String))
end

sig { returns(T::Boolean) }
def skip_autobump?
!(args.autobump? || Homebrew::EnvConfig.livecheck_autobump?)
end
end
end
end
4 changes: 4 additions & 0 deletions Library/Homebrew/env_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ module EnvConfig
"or `$HOME/.homebrew/livecheck_watchlist.txt` otherwise.",
default: "#{ENV.fetch("HOMEBREW_USER_CONFIG_HOME")}/livecheck_watchlist.txt",
},
HOMEBREW_LIVECHECK_AUTOBUMP: {
issyl0 marked this conversation as resolved.
Show resolved Hide resolved
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.",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading