Add a switch for 'choco install' to stop after installing the first package
- Dominant language
- C#
- Stars
- 11.5k
- Forks
- 960
- PR merge metrics
- No merged PRs in 30d
Description
I would like the ability to tell choco.exe to exit after the first package from the dependency graph is installed.
For example, the visualstudio2017enterprise package depends on the following packages:
vcredist2012
vcredist2013
vcredist2015 (should depend on KB2919355, which in turn depends on KB2919442)
netfx-4.6.2-devpack (depends on dotnet4.6.2)
netfx-4.6.1-devpack (depends on dotnet4.6.1)
dotnet4.6-targetpack (depends on dotnet4.6)
netfx-4.5.2-devpack
netfx-4.5.1-devpack
Of the above, both KBs and dotnet4.6.2 will probably require a reboot.
When invoked repeatedly with `choco install -y --stop-after-first -pre visualstudio2017enterprise`, choco should install the first not yet installed package from the above set, naturally obeying the dependency order:
1) vcredist2012
2) vcredist2013
3) KB2919442
4) KB2919355
5) vcredist2015
6) dotnet4.6.2
7) netfx-4.6.2-devpack
(...)
14) visualstudio2017enterprise
This would make it really easy to handle reboots by invoking choco in a loop and rebooting if needed, for example using this simple workflow:
``` powershell
workflow Install-ChocolateyPackage
{
Param ([string] $PackageName)
$done = $false
do
{
$chocoOutput = InlineScript { choco install -y --stop-after-first $using:PackageName }
$shouldReboot = /* determine by parsing $chocoOutput */
if ($shouldReboot) { Restart-Computer -Wait }
$done = /* determine by parsing $chocoOutput */
}
while (-not $done)
}
```
(The package verifier could also take advantage of that.)
Contributor guide
Research direction
Start at the choco install command and trace dependency processing and command-line option handling. Define the behavior for --stop-after-first by checking that repeated invocations install only the next not-yet-installed dependency in order, then verify the final package is eventually installed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100