choco icon indicating copy to clipboard operation
choco copied to clipboard

upgrade: Add a switch to disable pin when upgrade

Open CookieHCl opened this issue 5 years ago • 7 comments

Motivation

I've pinned powershell-core because you mess up if you upgrade PowerShell Core in PowerShell Core.
So when I have to upgrade PowerShell Core, I have to remove pin and upgrade and add pin again. Specifically, I follow this procedure:

  1. choco upgrade all in PowerShell Core
  2. Checks Powershell Core has an upgrade (with this package is pinned warning message)
  3. Go to safer terminal (such as PowerShell 5.1)
  4. choco pin remove -n=powershell-core in Powershell
  5. choco upgrade powershell-core in Powershell
  6. choco pin add -n=powershell-core in Powershell

The point is someone uses pin for delay upgrades, not to block upgrades forever.

Solution

Add a switch --disable-pin to upgrade. When this switch is enabled, pinned packages will be upgraded. choco upgrade powershell-core --disable-pin has same effect with the above procedure 4-6.

Other suggestions

Switch name could be

  • --ignore-pin
  • --exclude-pin
  • --disable-pin-once

CookieHCl avatar May 16 '20 06:05 CookieHCl

I think this may already be an issue? Or at least something related like install with pin.

ferventcoder avatar May 19 '20 17:05 ferventcoder

Hear, Hear! I could not agree more. I asked this exact question on StackExchange Super User.

At the least, it would be nice if the documentation for pinning explicitly stated that there is no way to temporarily bypass the pin. One can only manually remove the pin, upgrade and repin.

Notwithstanding my asking for more, Chocolatey is really good. Thank you.

FarrelBuch avatar Sep 03 '20 00:09 FarrelBuch

I think this may already be an issue? Or at least something related like install with pin.

@ferventcoder is there any progress with that feature ?

nkrepo avatar May 28 '21 06:05 nkrepo

The Chocolatey docs specifically recommend using pin as a solution for auto-updating apps like Firefox and Chrome, as apparently auto synching doesn't work for package updates. Yet that leaves no way to manually roll out packages updates to the hosts that don't keep those auto-updating applications constantly open.

I don't understand why pinning doesn't just only prevent "choco upgrade all", or hide the package in "choco outdated". Preventing the package from updating at all is a poor solution especially when there's no administrative way to just issue a package upgrade without fiddling around with toggling the pin off and on again.

nascentt avatar Aug 31 '21 07:08 nascentt

no administrative way to just issue a package upgrade without fiddling around with toggling the pin off and on again.

@nascentt how about using upgradeAllExceptions instead of pins? See choco config -h for more info on the setting.

TheCakeIsNaOH avatar Sep 01 '21 22:09 TheCakeIsNaOH

no administrative way to just issue a package upgrade without fiddling around with toggling the pin off and on again.

@nascentt how about using upgradeAllExceptions instead of pins? See choco config -h for more info on the setting.

strange, I don't see upgradeAllExceptions mentioned at all in choco config -h. Additionally, I don't see it documented anywhere, only getting 7 results in google. Playing around with both methods, I'm unsure of the main use case for one over the other. both require chocolatey admin knowledge to bypassed, and both can be bypassed, neither prevent apps showing up in choco outdated by default, although there is a switch to ignore pinned in choco outdated it's not default. But upgradeAllExceptions is good because it completely hides packages by default, but that's only for upgrade and not outdated so can still confuse users. Also upgradeAllExceptions can be set before/regardless of whether the pack is installed yet (so can be set at build time) whereas pin can only be set after the package has been installed (which is a major limitation) apparently there's yet another issue for fixing this which is outstanding.

I guess neither solution really fixes the underlying issue that choco sync doesn't work for version changes, which should really be fixed.

I do still believe choco upgrade should have a switch to ignore pins the same way choco outdated does though. For both preventing hacky workaround like disable;upgrade;enable, but also consistency.

regarding the name, as choco upgrade has -ignore-pinned I feel the name of the switch on choco upgrade should be the same

choco upgrade --ignore-pinned

nascentt avatar Sep 02 '21 08:09 nascentt

Whoops, sorry that should be choco config -l

TheCakeIsNaOH avatar Sep 02 '21 14:09 TheCakeIsNaOH