1
0
Fork 0

Error out when a package can not be found, refs #30

pull/48/head
Jordi Boggiano 2011-10-02 21:24:09 +02:00
parent 1a9de17a88
commit 2ebc795754
1 changed files with 23 additions and 2 deletions

View File

@ -76,8 +76,29 @@ EOT
$policy = new DependencyResolver\DefaultPolicy();
$solver = new DependencyResolver\Solver($policy, $pool, $localRepo);
// solve dependencies and execute operations
foreach ($solver->solve($request) as $operation) {
// solve dependencies
$operations = $solver->solve($request);
// check for missing deps
// TODO this belongs in the solver, but this will do for now to report top-level deps missing at least
foreach ($request->getJobs() as $job) {
if ('install' === $job['cmd']) {
foreach ($localRepo->getPackages() as $package) {
if ($job['packageName'] === $package->getName()) {
continue 2;
}
}
foreach ($operations as $operation) {
if ('install' === $operation->getJobType() && $job['packageName'] === $operation->getPackage()->getName()) {
continue 2;
}
}
throw new \UnexpectedValueException('Package '.$job['packageName'].' could not be resolved to an installable package.');
}
}
// execute operations
foreach ($operations as $operation) {
$installationManager->execute($operation);
}