chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.04k stars 890 forks source link

(#3433) Optimize queries used when resolving dependencies of exact versions #3435

Closed AdmiringWorm closed 2 months ago

AdmiringWorm commented 2 months ago

Description Of Changes

This updates the NuGetCommon class to better handle lookups of package dependencies when an exact version range is used as the dependency.

Additionally, some optimizations when looking up valid packages are also implemented, by only look up the dependencies of a dependency that is inside of the valid version range that the package specifies.

Motivation and Context

Some optimizations, and better handling of exact version ranges. Additionally, without this change users of CCR will not be able to install a meta package and its dependency until both have been approved or exempted.

Testing

Testing have been performed against an internal testing repository which will be called out as hermes.

  1. choco install hasbetadependency --version 1.1.0-beta --ignore-http-cache --verbose --source hermes
  2. Verify queries used for hasbetadependency and isexactversiondependency is looked up using a specific version.
  3. Repeat 1 and 2, using --pre instead of --version.
  4. Run choco install toplevelhasexactversiondependency --ignore-http-cache --verbose --source hermes
  5. Verify queries used for toplevelhasexactversiondependency and childdependencywithlooserversiondependency is looked up using a specific verison.
  6. Run choco install toplevelwithnesteddependencies --ignore-http-cache --verbose --source hermes
  7. Verify queries used for toplevelwithnesteddependencies and childdependencywithlooserversiondependency is looked up using a specific version.
  8. Run choco install hasoutofrangedependency --version 2.0.2 --ignore-http-cache --verbose --source hermes
  9. Verify queries used for hasoutofrangedependency and hasdependency is looked up using a specific version.
  10. Verify the query for hasdependency falled back to attempting the FindPackagesById endpoint.

Operating Systems Testing

Change Types Made

Change Checklist

Related Issue

Fixes #3433