1
0
Fork 0

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

pull/9035/head
Jordi Boggiano 2020-07-04 12:00:37 +02:00
parent 212fbc516e
commit d7b1248508
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 1 additions and 2 deletions

View File

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