brew icon indicating copy to clipboard operation
brew copied to clipboard

Add HOMEBREW_UPGRADE_GREEDY="auto-updates" and "latest"

Open jck112 opened this issue 1 year ago • 4 comments

Verification

  • [X] This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

Provide a detailed description of the proposed feature

Many users, myself included, prefer to always run brew upgrade --greedy-auto-updates in order to upgrade all of our formulas and casks. Adding support for --greedy, --greedy-latest, and --greedy-auto-updates to the HOMEBREW_CASK_OPTS environment variable enables users to run brew upgrade more easily with their preferred cask upgrade options.

What is the motivation for the feature?

Pull request #15160 added support for the HOMEBREW_UPGRADE_GREEDY environment variable, but deferred adding support for the --greedy-latest and --greedy-auto-updates options. I believe adding support for these additional options via HOMEBREW_CASK_OPTS provides a potentially simpler and more streamlined solution.

How will the feature be relevant to at least 90% of Homebrew users?

As discussed in #15097, there are many users using the --greedy-auto-updates option in particular.

What alternatives to the feature have been considered?

Alternatively new environment variables could be added, e.g. HOMEBREW_UPGRADE_GREEDY_LATEST and HOMEBREW_UPGRADE_GREEDY_AUTO_UPDATES.

jck112 avatar Feb 23 '24 18:02 jck112

Given we already have HOMEBREW_UPGRADE_GREEDY, I think it would be better to support HOMEBREW_UPGRADE_GREEDY=auto-updates or HOMEBREW_UPGRADE_GREEDY_AUTO_UPDATES as you already mentioned.

Also, I think we should deprecate HOMEBREW_CASK_OPTS at some point and split it into separate variables for each supported option.

reitermarkus avatar Feb 23 '24 18:02 reitermarkus

I'm happy to update my pull request with any preferred approach. Do you have a preference between adding HOMEBREW_UPGRADE_GREEDY_AUTO_UPDATES or modifying HOMEBREW_UPGRADE_GREEDY? If the latter, would it be backwards compatible to convert the value to a string and have any value != "auto-updates" imply the --greedy option?

jck112 avatar Feb 23 '24 19:02 jck112

Let's modify HOMEBREW_UPGRADE_GREEDY to allow auto-updates. This way also only one of the options can be set at a time.

reitermarkus avatar Feb 24 '24 16:02 reitermarkus

Updated #16736 to modify HOMEBREW_UPGRADE_GREEDY as requested.

jck112 avatar Feb 24 '24 17:02 jck112

Closing this out as we don't need an issue and PR from same author at same time and to keep conversation in one place. Thanks for the PR @jck112!

MikeMcQuaid avatar Feb 25 '24 19:02 MikeMcQuaid