Merge pull request #19685 from botantony/bump-no-auto

dev-cmd/bump: add `--no-autobump` flag
This commit is contained in:
Mike McQuaid 2025-04-03 07:47:20 +00:00 committed by GitHub
commit e537b716e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 43 additions and 1 deletions

View File

@ -33,6 +33,8 @@ module Homebrew
switch "--auto", switch "--auto",
description: "Read the list of formulae/casks from the tap autobump list.", description: "Read the list of formulae/casks from the tap autobump list.",
hidden: true hidden: true
switch "--no-autobump",
description: "Ignore formulae/casks in autobump list (official repositories only)."
switch "--formula", "--formulae", switch "--formula", "--formulae",
description: "Check only formulae." description: "Check only formulae."
switch "--cask", "--casks", switch "--cask", "--casks",
@ -54,6 +56,7 @@ module Homebrew
conflicts "--cask", "--formula" conflicts "--cask", "--formula"
conflicts "--tap=", "--installed" conflicts "--tap=", "--installed"
conflicts "--tap=", "--no-auto"
conflicts "--eval-all", "--installed" conflicts "--eval-all", "--installed"
conflicts "--installed", "--auto" conflicts "--installed", "--auto"
conflicts "--no-pull-requests", "--open-pr" conflicts "--no-pull-requests", "--open-pr"
@ -68,6 +71,14 @@ module Homebrew
Homebrew.with_no_api_env do Homebrew.with_no_api_env do
eval_all = args.eval_all? || Homebrew::EnvConfig.eval_all? eval_all = args.eval_all? || Homebrew::EnvConfig.eval_all?
excluded_autobump = []
if args.no_autobump?
excluded_autobump.concat(autobumped_formulae_or_casks(CoreTap.instance)) if eval_all || args.formula?
if eval_all || args.cask?
excluded_autobump.concat(autobumped_formulae_or_casks(CoreCaskTap.instance, casks: true))
end
end
formulae_and_casks = if args.auto? formulae_and_casks = if args.auto?
raise UsageError, "`--formula` or `--cask` must be passed with `--auto`." if !args.formula? && !args.cask? raise UsageError, "`--formula` or `--cask` must be passed with `--auto`." if !args.formula? && !args.cask?
@ -119,6 +130,8 @@ module Homebrew
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
formulae_and_casks -= excluded_autobump
if args.repology? && !Utils::Curl.curl_supports_tls13? if args.repology? && !Utils::Curl.curl_supports_tls13?
begin begin
ensure_formula_installed!("curl", reason: "Repology queries") unless HOMEBREW_BREWED_CURL_PATH.exist? ensure_formula_installed!("curl", reason: "Repology queries") unless HOMEBREW_BREWED_CURL_PATH.exist?
@ -541,6 +554,19 @@ module Homebrew
synced_with synced_with
end end
sig { params(tap: Tap, casks: T::Boolean).returns(T::Array[T.any(Formula, Cask::Cask)]) }
def autobumped_formulae_or_casks(tap, casks: false)
autobump_list = tap.autobump
autobump_list.map do |name|
qualified_name = "#{tap.name}/#{name}"
if casks
Cask::CaskLoader.load(qualified_name)
else
Formulary.factory(qualified_name)
end
end
end
end end
end end
end end

View File

@ -14,6 +14,12 @@ class Homebrew::DevCmd::Bump::Args < Homebrew::CLI::Args
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def auto?; end def auto?; end
# `/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/bin/tapioca dsl Homebrew::DevCmd::Bump`
# didn't work for me for some reason, adding `no_auto?` flag manually.
# If you can help me with fixing the issue or `tapioca` runs perfectly, please, override this
sig { returns(T::Boolean) }
def no_autobump?; end
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def cask?; end def cask?; end

View File

@ -515,6 +515,7 @@ _brew_bump() {
--full-name --full-name
--help --help
--installed --installed
--no-autobump
--no-fork --no-fork
--no-pull-requests --no-pull-requests
--open-pr --open-pr

View File

@ -406,6 +406,7 @@ __fish_brew_complete_arg 'bump' -l formula -d 'Check only formulae'
__fish_brew_complete_arg 'bump' -l full-name -d 'Print formulae/casks with fully-qualified names' __fish_brew_complete_arg 'bump' -l full-name -d 'Print formulae/casks with fully-qualified names'
__fish_brew_complete_arg 'bump' -l help -d 'Show this message' __fish_brew_complete_arg 'bump' -l help -d 'Show this message'
__fish_brew_complete_arg 'bump' -l installed -d 'Check formulae and casks that are currently installed' __fish_brew_complete_arg 'bump' -l installed -d 'Check formulae and casks that are currently installed'
__fish_brew_complete_arg 'bump' -l no-autobump -d 'Ignore formulae/casks in autobump list (official repositories only)'
__fish_brew_complete_arg 'bump' -l no-fork -d 'Don\'t try to fork the repository' __fish_brew_complete_arg 'bump' -l no-fork -d 'Don\'t try to fork the repository'
__fish_brew_complete_arg 'bump' -l no-pull-requests -d 'Do not retrieve pull requests from GitHub' __fish_brew_complete_arg 'bump' -l no-pull-requests -d 'Do not retrieve pull requests from GitHub'
__fish_brew_complete_arg 'bump' -l open-pr -d 'Open a pull request for the new version if none have been opened yet' __fish_brew_complete_arg 'bump' -l open-pr -d 'Open a pull request for the new version if none have been opened yet'

View File

@ -539,13 +539,14 @@ _brew_bump() {
'--full-name[Print formulae/casks with fully-qualified names]' \ '--full-name[Print formulae/casks with fully-qualified names]' \
'--help[Show this message]' \ '--help[Show this message]' \
'(--tap --eval-all --auto)--installed[Check formulae and casks that are currently installed]' \ '(--tap --eval-all --auto)--installed[Check formulae and casks that are currently installed]' \
'--no-autobump[Ignore formulae/casks in autobump list (official repositories only)]' \
'--no-fork[Don'\''t try to fork the repository]' \ '--no-fork[Don'\''t try to fork the repository]' \
'(--open-pr)--no-pull-requests[Do not retrieve pull requests from GitHub]' \ '(--open-pr)--no-pull-requests[Do not retrieve pull requests from GitHub]' \
'(--no-pull-requests)--open-pr[Open a pull request for the new version if none have been opened yet]' \ '(--no-pull-requests)--open-pr[Open a pull request for the new version if none have been opened yet]' \
'--quiet[Make some output more quiet]' \ '--quiet[Make some output more quiet]' \
'--repology[Use Repology to check for outdated packages]' \ '--repology[Use Repology to check for outdated packages]' \
'--start-with[Letter or word that the list of package results should alphabetically follow]' \ '--start-with[Letter or word that the list of package results should alphabetically follow]' \
'(--installed)--tap[Check formulae and casks within the given tap, specified as user`/`repo]' \ '(--installed --no-auto)--tap[Check formulae and casks within the given tap, specified as user`/`repo]' \
'--verbose[Make some output more verbose]' \ '--verbose[Make some output more verbose]' \
- formula \ - formula \
'(--cask)--formula[Check only formulae]' \ '(--cask)--formula[Check only formulae]' \

View File

@ -2095,6 +2095,10 @@ displays whether a pull request has been opened with the URL.
: Do not retrieve pull requests from GitHub. : Do not retrieve pull requests from GitHub.
`--no-autobump`
: Ignore formulae/casks in autobump list (official repositories only).
`--formula` `--formula`
: Check only formulae. : Check only formulae.

View File

@ -1313,6 +1313,9 @@ Print formulae/casks with fully\-qualified names\.
\fB\-\-no\-pull\-requests\fP \fB\-\-no\-pull\-requests\fP
Do not retrieve pull requests from GitHub\. Do not retrieve pull requests from GitHub\.
.TP .TP
\fB\-\-no\-autobump\fP
Ignore formulae/casks in autobump list (official repositories only)\.
.TP
\fB\-\-formula\fP \fB\-\-formula\fP
Check only formulae\. Check only formulae\.
.TP .TP