choco icon indicating copy to clipboard operation
choco copied to clipboard

Upgrading Chocolatey as a dependency should be handled specially

Open jberezanski opened this issue 9 years ago • 3 comments

If a package depends on certain Chocolatey features in its scripts, it is intuitive for the package autor to specify a dependency on a minimum version of Chocolatey that contains these features. This, however, will not work as expected in all cases (and may even introduce weird issues), because only the PowerShell part of Chocolatey (the helper functions) is currently reimported during Chocolatey upgrade. (see this comment; also this issue - it was much easier to handle when all of Chocolatey was implemented in PowerShell)

I believe the upgrade of Chocolatey should be handled as a special case:

  1. before installing anything, check if the graph of packages to be installed/upgraded contains Chocolatey, 2a) in chocolatey.dll, signal it to the hosting application, e.g. by throwing a documented exception (it is the responsibility of the hosting application to upgrade itself) and stop the installation, 2b) in choco.exe, upgrade Chocolatey first (before any other package), then continue the installation by starting the upgraded choco.exe, passing all arguments from the original invocation of choco.exe.

jberezanski avatar Sep 07 '16 20:09 jberezanski

This would be interesting to accomplish...

ferventcoder avatar Sep 07 '16 20:09 ferventcoder

I think upgrading chocolatey.extension should be in the same boat

flcdrg avatar Feb 06 '18 23:02 flcdrg

Agreed. There was a locking issue we overcame recently

ferventcoder avatar Feb 07 '18 14:02 ferventcoder