Create pool before reading package ids as the pool creation reassigns package ids, fixes #9034

main
Jordi Boggiano 4 years ago
parent 212fbc516e
commit d7b1248508
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -567,6 +567,7 @@ EOT
$matchedPackage = null;
$versions = array();
$matches = $repositorySet->findPackages($name, $constraint);
$pool = $repositorySet->createPoolForPackage($name);
foreach ($matches as $index => $package) {
// select an exact match if it is in the installed repo and no specific version was required
if (null === $version && $installedRepo->hasPackage($package)) {
@ -577,8 +578,6 @@ EOT
$matches[$index] = $package->getId();
}
$pool = $repositorySet->createPoolForPackage($name);
// select preferred package according to policy rules
if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, $matches)) {
$matchedPackage = $pool->literalToPackage($preferred[0]);

Loading…
Cancel
Save