Create pool before reading package ids as the pool creation reassigns package ids, fixes #9034
parent
212fbc516e
commit
d7b1248508
|
@ -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]);
|
||||||
|
|
Loading…
Reference in New Issue