Error when removing dependencies in new version of a package
- Dominant language
- C#
- Stars
- 11.5k
- Forks
- 960
- PR merge metrics
- No merged PRs in 30d
Description
An installed package A have a dependencie with a package B. If the new version of package A does not have the dependencie with B when upgrading A package B does no appear in choco list --local-only but the chocouninstall.ps1 file is not executed
### What You Are Seeing?
An uninstalled package but no chocobeformodify or chocouninstall are executed
### What is Expected?
That chocobeforemodify and chocouninstall are executed
### How Did You Get This To Happen? (Steps to Reproduce)
- create three packages: father, son1, son2
- in chocoinstall of each one just create a file with the name of the package (new-item ....)
- in chocouninstall of each just delete the file created
- set version of all packages to 1.0.0.0
- set a dependencie from father to son1 1.0.0.0
- generate all packages
- install father package
- modify the dependencies of father package to son2
- modify the father version to 2.0.0.0
- modify the new-item of father to be different
- generate father 2.0.0.0 package
- upgrade father package to 2.0.0.0
### Output Log
~~~sh
2021-04-16 14:10:13,333 3284 [INFO ] - [NuGet] Attempting to resolve dependency 'son2 (= 1.0.0.0)'.
2021-04-16 14:10:13,403 3284 [INFO ] - [NuGet] Uninstalling 'father 1.0.0.0'.
2021-04-16 14:10:13,414 3284 [DEBUG] - [NuGet] Removed file 'LICENSE.txt' to folder 'C:\ProgramData\chocolatey\lib\father\tools'.
2021-04-16 14:10:13,414 3284 [DEBUG] - [NuGet] Removed file 'VERIFICATION.txt' to folder 'C:\ProgramData\chocolatey\lib\father\tools'.
2021-04-16 14:10:13,416 3284 [DEBUG] - [NuGet] Removed folder 'C:\ProgramData\chocolatey\lib\father\tools'.
2021-04-16 14:10:13,417 3284 [DEBUG] - [NuGet] Removed file 'father.nuspec' to folder 'C:\ProgramData\chocolatey\lib\father'.
2021-04-16 14:10:13,417 3284 [DEBUG] - [NuGet] Removed file 'father.nupkg' to folder 'C:\ProgramData\chocolatey\lib\father'.
2021-04-16 14:10:13,418 3284 [DEBUG] - [NuGet] Removed folder 'C:\ProgramData\chocolatey\lib\father'.
2021-04-16 14:10:13,418 3284 [INFO ] - [NuGet] Successfully uninstalled 'father 1.0.0.0'.
2021-04-16 14:10:13,419 3284 [INFO ] - [NuGet] Uninstalling 'son1 1.0.0.0'.
2021-04-16 14:10:13,457 3284 [DEBUG] - [NuGet] Removed file 'chocolateybeforemodify.ps1' to folder 'C:\ProgramData\chocolatey\lib\son1\tools'.
2021-04-16 14:10:13,459 3284 [DEBUG] - [NuGet] Removed file 'chocolateyinstall.ps1' to folder 'C:\ProgramData\chocolatey\lib\son1\tools'.
2021-04-16 14:10:13,459 3284 [DEBUG] - [NuGet] Removed file 'chocolateyuninstall.ps1' to folder 'C:\ProgramData\chocolatey\lib\son1\tools'.
2021-04-16 14:10:13,460 3284 [DEBUG] - [NuGet] Removed file 'LICENSE.txt' to folder 'C:\ProgramData\chocolatey\lib\son1\tools'.
2021-04-16 14:10:13,460 3284 [DEBUG] - [NuGet] Removed file 'VERIFICATION.txt' to folder 'C:\ProgramData\chocolatey\lib\son1\tools'.
2021-04-16 14:10:13,461 3284 [DEBUG] - [NuGet] Removed folder 'C:\ProgramData\chocolatey\lib\son1\tools'.
2021-04-16 14:10:13,461 3284 [DEBUG] - [NuGet] Removed file 'son1.nuspec' to folder 'C:\ProgramData\chocolatey\lib\son1'.
2021-04-16 14:10:13,462 3284 [DEBUG] - [NuGet] Removed file 'son1.nupkg' to folder 'C:\ProgramData\chocolatey\lib\son1'.
2021-04-16 14:10:13,462 3284 [DEBUG] - [NuGet] Removed folder 'C:\ProgramData\chocolatey\lib\son1'.
2021-04-16 14:10:13,463 3284 [INFO ] - [NuGet] Successfully uninstalled 'son1 1.0.0.0'.
2021-04-16 14:10:13,467 3284 [INFO ] - [NuGet] Installing 'son2 1.0.0.0'.
2021-04-16 14:10:13,471 3284 [DEBUG] - [NuGet] Added file 'chocolateybeforemodify.ps1' to folder 'son2\tools'.
2021-04-16 14:10:13,471 3284 [DEBUG] - [NuGet] Added file 'chocolateyinstall.ps1' to folder 'son2\tools'.
2021-04-16 14:10:13,472 3284 [DEBUG] - [NuGet] Added file 'chocolateyuninstall.ps1' to folder 'son2\tools'.
2021-04-16 14:10:13,473 3284 [DEBUG] - [NuGet] Added file 'LICENSE.txt' to folder 'son2\tools'.
2021-04-16 14:10:13,473 3284 [DEBUG] - [NuGet] Added file 'VERIFICATION.txt' to folder 'son2\tools'.
2021-04-16 14:10:13,475 3284 [DEBUG] - [NuGet] Added file 'son2.nupkg' to folder 'son2'.
2021-04-16 14:10:13,713 3284 [DEBUG] - [NuGet] Added file 'son2.nuspec' to folder 'son2'.
2021-04-16 14:10:13,714 3284 [INFO ] - [NuGet] Successfully installed 'son2 1.0.0.0'.
2021-04-16 14:10:13,715 3284 [INFO ] -
son2 v1.0.0.0
2021-04-16 14:10:14,223 3284 [INFO ] - son2 package files upgrade completed. Performing other installation steps.
2021-04-16 14:10:14,870 3284 [DEBUG] - Contents of 'C:\ProgramData\chocolatey\lib\son2\tools\chocolateyinstall.ps1':
~~~
Contributor guide
Research direction
Reproduce the father/son1/son2 upgrade described in the issue and compare the dependency-removal path with execution of chocolateybeforemodify.ps1 and chocolateyuninstall.ps1. Trace the upgrade handling shown in the NuGet log and add a regression test for removed dependencies; done means the expected lifecycle scripts run and the local package state is correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100