1
0
Fork 0

Fix alias handling with --dev installs, fixes #579

pull/582/head
Jordi Boggiano 2012-04-15 19:05:16 +02:00
parent 7b87d2b573
commit f63df842b3
3 changed files with 27 additions and 10 deletions

View File

@ -136,13 +136,6 @@ class Installer
$aliases = $this->aliasPackages();
// creating repository pool
$pool = new Pool;
$pool->addRepository($installedRepo);
foreach ($this->repositoryManager->getRepositories() as $repository) {
$pool->addRepository($repository);
}
if (!$this->dryRun) {
// dispatch pre event
$eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
@ -150,11 +143,11 @@ class Installer
}
$this->suggestedPackages = array();
if (!$this->doInstall($this->repositoryManager->getLocalRepository(), $installedRepo, $pool, $aliases)) {
if (!$this->doInstall($this->repositoryManager->getLocalRepository(), $installedRepo, $aliases)) {
return false;
}
if ($this->devMode) {
if (!$this->doInstall($this->repositoryManager->getLocalDevRepository(), $installedRepo, $pool, $aliases, true)) {
if (!$this->doInstall($this->repositoryManager->getLocalDevRepository(), $installedRepo, $aliases, true)) {
return false;
}
}
@ -191,8 +184,15 @@ class Installer
return true;
}
protected function doInstall($localRepo, $installedRepo, $pool, $aliases, $devMode = false)
protected function doInstall($localRepo, $installedRepo, $aliases, $devMode = false)
{
// creating repository pool
$pool = new Pool;
$pool->addRepository($installedRepo);
foreach ($this->repositoryManager->getRepositories() as $repository) {
$pool->addRepository($repository);
}
// creating requirements request
$installFromLock = false;
$request = new Request($pool);
@ -358,6 +358,11 @@ class Installer
}
}
// reload local repository for the dev pass to work ok with aliases since it was anti-aliased above
if (!$devMode) {
$localRepo->reload();
}
return true;
}

View File

@ -21,6 +21,7 @@ use Composer\Package\Dumper\ArrayDumper;
* Filesystem repository.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class FilesystemRepository extends ArrayRepository implements WritableRepositoryInterface
{
@ -71,6 +72,12 @@ class FilesystemRepository extends ArrayRepository implements WritableRepository
}
}
public function reload()
{
$this->packages = null;
$this->initialize();
}
/**
* Writes writable repository.
*/

View File

@ -39,4 +39,9 @@ interface WritableRepositoryInterface extends RepositoryInterface
* @param PackageInterface $package package instance
*/
function removePackage(PackageInterface $package);
/**
* Forces a reload of all packages
*/
function reload();
}