1
0
Fork 0

Clarify code a bit

pull/1883/merge
Jordi Boggiano 2013-05-11 13:01:08 +02:00
parent 2f4656e87a
commit 7f7d13450e
1 changed files with 9 additions and 6 deletions

View File

@ -560,18 +560,21 @@ class Installer
$constraint->setPrettyString($rootPackage->getPrettyVersion()); $constraint->setPrettyString($rootPackage->getPrettyVersion());
$request->install($rootPackage->getName(), $constraint); $request->install($rootPackage->getName(), $constraint);
$installedPackages = $platformRepo->getPackages(); $fixedPackages = $platformRepo->getPackages();
if ($this->additionalInstalledRepository) { if ($this->additionalInstalledRepository) {
$additionalInstalledPackages = $this->additionalInstalledRepository->getPackages(); $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
$installedPackages = array_merge($installedPackages, $additionalInstalledPackages); $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
} }
// fix the version of all platform packages to prevent the solver trying to remove those // fix the version of all platform packages + additionally installed packages
foreach ($installedPackages as $package) { // to prevent the solver trying to remove or update those
$provided = $rootPackage->getProvides();
foreach ($fixedPackages as $package) {
$constraint = new VersionConstraint('=', $package->getVersion()); $constraint = new VersionConstraint('=', $package->getVersion());
$constraint->setPrettyString($package->getPrettyVersion()); $constraint->setPrettyString($package->getPrettyVersion());
if (!($provided = $rootPackage->getProvides()) // skip platform packages that are provided by the root package
if ($package->getRepository() !== $platformRepo
|| !isset($provided[$package->getName()]) || !isset($provided[$package->getName()])
|| !$provided[$package->getName()]->getConstraint()->matches($constraint) || !$provided[$package->getName()]->getConstraint()->matches($constraint)
) { ) {