Skip to content

Allow pinning casks #213583

Open
Open
@Nowaker

Description

@Nowaker

Verification

Description of issue

I'd like to re-raise #49127 and other tickets filed for this. I believe the original justification given doesn't address the problems that pinning would solve. Therefore, the topic requires a reconsideration.

@vitorgalvao

A huge chunk of casks auto-update and we can’t stop that. So pin would at best be inconsistent and not work in a lot of cases.

If you do a search you’ll see we’ve discussed this in the past, especially in the upgrade issues on brew’s repository.

Argument 1: a counter-argument to "pin would at best be inconsistent and not work in a lot of cases"

Casks with auto_updates are effectively pinned. brew upgrade will not update them, unless --greedy-auto-updates is passed. They may be upgraded externally by the application itself, and Homebrew won't know the actual version installed over time or what files were modified...

...so how is this different from an explicit pin on the package? auto_updates and latest markers are pins. Permanent ones that prevent them from being upgraded on brew upgrade - but still pins. They just can't be arbitrarily removed or added by the user to achieve their own goals.

Argument 2: auto-update feature is often optional, let brew do it

Out of all my auto_updates casks listed with brew info --json=v2 --installed --casks | jq -r '.casks[] | select(.auto_updates) | .token', most have optional auto-updates:

  • Check optional: iterm2, menumeters, nextcloud, orbstack, teamviewer, visual-studio-code, vlc, wireshark, witch
  • Check mandatory but update optional: firefox, imageoptim, macfuse, pika, sublime-text, xee, spectacle
  • Check and update mandatory: adobe-acrobat-reader, discord, dropbox, google-chrome, onedrive, signal

How do I update all packages except these listed in "Check and update mandatory" category, without this kind of trickery? brew upgrade --cask --greedy-auto-updates $(brew info --json=v2 --installed --casks | jq -r '.casks[] | select(.auto_updates) | .token' | grep -vE '^(adobe-acrobat-reader|discord|dropbox|onedrive|signal)$')

There is absolutely nothing wrong about brew pin adobe-acrobat-reader discord dropbox google-chrome onedrive signal so we can brew update --greedy-auto-updates and get everything up-to-date except the ones we pinned.

Argument 3: the fundamental issue

All package manager in existence - except pkgin/pksrc and Homebrew (for casks) - allow their users to "upgrade all except these":

  • pacman -Syu --ignore <pkg1>,<pkg2>
  • apt-mark hold <pkg1> <pkg2>; apt upgrade; apt-mark unhold <pkg1> <pkg2>
  • dnf upgrade --refresh --exclude=<pkg1>,<pkg2>
    • or dnf versionlock add <pkg1> <pkg2>; dnf upgrade --refresh; dnf versionlock delete <pkg1> <pkg2>
  • yum update --exclude=<pkg1>,<pkg2>
    • or yum versionlock add <pkg1>-* <pkg2>-*; yum update; yum versionlock delete <pkg1>-* <pkg2>-*
  • zypper up --exclude <pkg1>,<pkg2>
    • or zypper addlock <pkg>; zypper up; zypper removelock <pkg>
  • emerge -avuD --exclude <pkg1>,<pkg2> @world
    • or add =<pkg>-* to /etc/portage/package.mask
  • choco upgrade all --except=<pkg1>,<pkg2>
    • or choco pin add -n=<pkg>; choco upgrade all; choco pin remove -n=<pkg>
  • winget pin add --id <PackageID>; winget upgrade --all; winget pin remove --id <PackageID>
  • scoop hold <pkg1> <pkg2>; scoop update *; scoop unhold <pkg1> <pkg2>
  • port upgrade outdated and not <port>
  • brew pin something; brew upgrade; brew unpin something
    • (except for casks)

Why would one want to "upgrade all except these"? Every user has their own reasons. For me:

  1. I do it to skip large packages when my download speed is limited at that time. I tend to run pacman -Syu --ignore libreoffice-fresh,signal quite a bit.
  2. There are certain packages that I update myself. On Arch, I never update linux and linux-lts packages at the same time. linux-lts stays in IgnorePkg (it's pinned).
  3. For Homebrew specifically, I'd like to execute brew update --greedy-auto-updates and get everything upgraded except for those that perform mandatory updates. Whether that's via a permanent pin brew pin signal; brew update --greedy-auto-updates, or a one-time exclusion brew update --greedy-auto-updates --ignore pkg1,pkg2, it's all good.
  4. ...But most importantly: why not? All other package manager do it, and there must be many good reasons why.

Argument 4: by popular vote

Users have been requesting it all the time:

Users simply want this feature.


Thank you in advance for reconsidering this.

Command that failed

brew pin nextcloud

Output of command with --verbose --debug

nowaker@nwkr-m1pro ~ % brew pin nextcloud --verbose --debug
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::NullLoader): loading nextcloud
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::NullLoader): loading nextcloud
Error: No available formula with the name "nextcloud".
/opt/homebrew/Library/Homebrew/formulary.rb:826:in 'Formulary::NullLoader#get_formula'
/opt/homebrew/Library/Homebrew/formulary.rb:931:in 'Formulary.factory'
...not relevant

Output of brew doctor and brew config

irrelevant

Output of brew tap

homebrew/cask-versions
homebrew/services

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions