From cc3d91f75c68f812314dda04e8f03e0cad74f225 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 24 Apr 2012 10:49:49 +0200 Subject: [PATCH] Make sure aliased packages created by the locker are available in the pool --- src/Composer/Installer.php | 7 ++++++- src/Composer/Package/Locker.php | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 49472635e..583d27498 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -186,6 +186,11 @@ class Installer protected function doInstall($localRepo, $installedRepo, $aliases, $devMode = false) { + // initialize locker to create aliased packages + if (!$this->update && $this->locker->isLocked($devMode)) { + $lockedPackages = $this->locker->getLockedPackages($devMode); + } + // creating repository pool $pool = new Pool; $pool->addRepository($installedRepo); @@ -214,7 +219,7 @@ class Installer $this->io->write('Your lock file is out of sync with your composer.json, run "composer.phar update" to update dependencies'); } - foreach ($this->locker->getLockedPackages($devMode) as $package) { + foreach ($lockedPackages as $package) { $version = $package->getVersion(); foreach ($aliases as $alias) { if ($alias['package'] === $package->getName() && $alias['version'] === $package->getVersion()) { diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index fc448c360..e8037b464 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -95,7 +95,9 @@ class Locker if (!$package) { $package = $this->repositoryManager->findPackage($info['package'], $info['version']); if ($package && !empty($info['alias'])) { - $package = new AliasPackage($package, $info['alias'], $info['alias']); + $alias = new AliasPackage($package, $info['alias'], $info['alias']); + $package->getRepository()->addPackage($alias); + $package = $alias; } }