chocolatey / nuget-chocolatey

NuGet Enhanced for Chocolatey
Apache License 2.0
29 stars 23 forks source link

Ensure correct order of operations when performing upgrade command #35

Closed gep13 closed 1 year ago

gep13 commented 1 year ago

What You Are Seeing?

When upgrading packages where a long dependency tree is in play, the package upgrade order doesn't respect the dependency tree that is involved. For example:

Package E depends on Package D Package D depends on Package A Package C depends on Package B and Package A Package B depends on Package A

The ideal installation order would be:

Package A Package B Package C Package D Package E

However, there are cases we have seen where Package C is upgraded first, which causes problems due to the chocolateyBeforeModify.ps1 file causing application to be restarted and then failing restart due to dependency not first being installed.

What is Expected?

The chosen order of the packages that are being upgraded should respect the dependencies of the packages that are being touched. For example, if Package B depends on Package A, then Package A should be acted on first, before anything is done with Package B. And this should be true for all packages within the dependency tree.

How Did You Get This To Happen? (Steps to Reproduce)

With the above packages in play, perform the operation choco upgrade PackageA (NOTE: This scenario really comes into play when performing an upgrade on packages which use a version range, and you are crossing the major version range when upgrading the packages. i.e. installed packages have a range similar to [1.2.0, 1.999.999] and you are attempting to upgrade to version 2.0.0 of the package.

System Details

Output Log

N/A

Related Issues

https://github.com/chocolatey/choco/issues/508