chocolatey / choco

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

(#3451) Use availablePackages in GetPackageDependencies #3471

Open josh-cooley opened 1 week ago

josh-cooley commented 1 week ago

Description Of Changes

This updates the dependency handling of packages to use availablePackages when a package from the same source satisfies the dependency. This improves packages that have dependencies with many versions available, and allows less data being requested from servers in the case we have already have available packages from the source.

Without this fix, the installation will be delayed with repeated resolution of the same package dependencies.

Motivation and Context

Installation of packages with many dependent versions available without reducing repeat calls to ResolvePackages

Testing

  1. Download demo-projects.zip
  2. Run GeneratePackages.ps1. This will generate a single package for package-a, package-b, and package-c. It will generate 1000 packages each for package-d and package-e.
  3. Clone and checkout the branch associated with this PR.
  4. Build chocolatey.console.
  5. Run choco upgrade package-a --yes --source <path-to-demo-projects>
  6. See that install/upgrade completes within seconds.

Repeat test with delivered chocolatey 2.3 and see that the install takes much longer.

Operating Systems Testing

Change Types Made

Change Checklist

Related Issue

Fixes #3451