diff --git a/Library/Homebrew/dev-cmd/bump.rb b/Library/Homebrew/dev-cmd/bump.rb index 8e4245a91a..cfca2b2087 100644 --- a/Library/Homebrew/dev-cmd/bump.rb +++ b/Library/Homebrew/dev-cmd/bump.rb @@ -33,6 +33,8 @@ module Homebrew switch "--auto", description: "Read the list of formulae/casks from the tap autobump list.", hidden: true + switch "--no-autobump", + description: "Ignore formulae/casks in autobump list (official repositories only)." switch "--formula", "--formulae", description: "Check only formulae." switch "--cask", "--casks", @@ -54,6 +56,7 @@ module Homebrew conflicts "--cask", "--formula" conflicts "--tap=", "--installed" + conflicts "--tap=", "--no-auto" conflicts "--eval-all", "--installed" conflicts "--installed", "--auto" conflicts "--no-pull-requests", "--open-pr" @@ -68,6 +71,14 @@ module Homebrew Homebrew.with_no_api_env do 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? 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 end + formulae_and_casks -= excluded_autobump + if args.repology? && !Utils::Curl.curl_supports_tls13? begin ensure_formula_installed!("curl", reason: "Repology queries") unless HOMEBREW_BREWED_CURL_PATH.exist? @@ -541,6 +554,19 @@ module Homebrew synced_with 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 diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/bump.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/bump.rbi index 1e750628c4..827cad9b54 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/bump.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/bump.rbi @@ -14,6 +14,12 @@ class Homebrew::DevCmd::Bump::Args < Homebrew::CLI::Args sig { returns(T::Boolean) } 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) } def cask?; end diff --git a/completions/bash/brew b/completions/bash/brew index 2a71586da3..1dbeb403f6 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -515,6 +515,7 @@ _brew_bump() { --full-name --help --installed + --no-autobump --no-fork --no-pull-requests --open-pr diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index df9158b520..ea3a706122 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -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 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 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-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' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 3ed2d825b3..11164f1f25 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -539,13 +539,14 @@ _brew_bump() { '--full-name[Print formulae/casks with fully-qualified names]' \ '--help[Show this message]' \ '(--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]' \ '(--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]' \ '--quiet[Make some output more quiet]' \ '--repology[Use Repology to check for outdated packages]' \ '--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]' \ - formula \ '(--cask)--formula[Check only formulae]' \ diff --git a/docs/Manpage.md b/docs/Manpage.md index dd959193cb..12c8545e40 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -2095,6 +2095,10 @@ displays whether a pull request has been opened with the URL. : Do not retrieve pull requests from GitHub. +`--no-autobump` + +: Ignore formulae/casks in autobump list (official repositories only). + `--formula` : Check only formulae. diff --git a/manpages/brew.1 b/manpages/brew.1 index dde94aff4f..532002c932 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1313,6 +1313,9 @@ Print formulae/casks with fully\-qualified names\. \fB\-\-no\-pull\-requests\fP Do not retrieve pull requests from GitHub\. .TP +\fB\-\-no\-autobump\fP +Ignore formulae/casks in autobump list (official repositories only)\. +.TP \fB\-\-formula\fP Check only formulae\. .TP