1
0
Fork 0

Fix exception when solver could not resolve a set of packages

pull/582/head
Jordi Boggiano 2012-04-15 17:44:47 +02:00
parent 65999c48e1
commit f520ce6a80
1 changed files with 15 additions and 7 deletions

View File

@ -82,6 +82,11 @@ class Installer
protected $verbose = false; protected $verbose = false;
protected $update = false; protected $update = false;
/**
* @var array
*/
protected $suggestedPackages;
/** /**
* @var RepositoryInterface * @var RepositoryInterface
*/ */
@ -144,14 +149,18 @@ class Installer
$this->eventDispatcher->dispatchCommandEvent($eventName); $this->eventDispatcher->dispatchCommandEvent($eventName);
} }
$suggestedPackages = $this->doInstall($this->repositoryManager->getLocalRepository(), $installedRepo, $pool, $aliases); $this->suggestedPackages = array();
if (!$this->doInstall($this->repositoryManager->getLocalRepository(), $installedRepo, $pool, $aliases)) {
return false;
}
if ($this->devMode) { if ($this->devMode) {
$devSuggested = $this->doInstall($this->repositoryManager->getLocalDevRepository(), $installedRepo, $pool, $aliases, true); if (!$this->doInstall($this->repositoryManager->getLocalDevRepository(), $installedRepo, $pool, $aliases, true)) {
$suggestedPackages = array_merge($suggestedPackages, $devSuggested); return false;
}
} }
// dump suggestions // dump suggestions
foreach ($suggestedPackages as $suggestion) { foreach ($this->suggestedPackages as $suggestion) {
$this->io->write($suggestion['source'].' suggests installing '.$suggestion['target'].' ('.$suggestion['reason'].')'); $this->io->write($suggestion['source'].' suggests installing '.$suggestion['target'].' ('.$suggestion['reason'].')');
} }
@ -304,7 +313,6 @@ class Installer
$this->io->write('Nothing to install or update'); $this->io->write('Nothing to install or update');
} }
$suggestedPackages = array();
foreach ($operations as $operation) { foreach ($operations as $operation) {
if ($this->verbose) { if ($this->verbose) {
$this->io->write((string) $operation); $this->io->write((string) $operation);
@ -313,7 +321,7 @@ class Installer
// collect suggestions // collect suggestions
if ('install' === $operation->getJobType()) { if ('install' === $operation->getJobType()) {
foreach ($operation->getPackage()->getSuggests() as $target => $reason) { foreach ($operation->getPackage()->getSuggests() as $target => $reason) {
$suggestedPackages[] = array( $this->suggestedPackages[] = array(
'source' => $operation->getPackage()->getPrettyName(), 'source' => $operation->getPackage()->getPrettyName(),
'target' => $target, 'target' => $target,
'reason' => $reason, 'reason' => $reason,
@ -350,7 +358,7 @@ class Installer
} }
} }
return $suggestedPackages; return true;
} }
private function aliasPackages() private function aliasPackages()