chocolatey / chocolatey/choco

Upgrading Chocolatey as a dependency should be handled specially

Open
#951 3 comments 0 reactions 0 assignees View on GitHub
0 - Backlog Enhancement
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/chocolatey/choco/issues/932#issuecomment-243273155); also [this issue](https://github.com/chocolatey/chocolatey/issues/460) - 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.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the package installation and upgrade flow in chocolatey.dll and choco.exe, including how PowerShell helper functions are reimported. Review the package graph check and the hosting application's upgrade boundary. Done means Chocolatey upgrades are handled first, with the hosting application signaled or the upgraded choco.exe restarted with the original arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.