1
0
Fork 0

Merge pull request #324 from edorian/installNonExistingPackage

Create an 'impossible rule' when installing non existent packages
pull/327/head
Nils Adermann 2012-02-19 07:05:21 -08:00
commit 9b8e62396c
2 changed files with 26 additions and 3 deletions

View File

@ -304,7 +304,7 @@ class Solver
// if ignoreinstalledsobsoletes is not set, we're also checking
// obsoletes of installed packages (like newer rpm versions)
//
/** @TODO: if ($this->noInstalledObsoletes) */
/** TODO if ($this->noInstalledObsoletes) */
if (true) {
$noObsoletes = isset($this->noObsoletes[$package->getId()]);
$isInstalled = (isset($this->installedMap[$package->getId()]));
@ -964,6 +964,12 @@ class Solver
foreach ($this->jobs as $job) {
if (empty($job['packages']) && $job['cmd'] == 'install') {
$this->addRule(
RuleSet::TYPE_JOB,
$this->createImpossibleRule(static::RULE_JOB_INSTALL, $job)
);
}
foreach ($job['packages'] as $package) {
switch ($job['cmd']) {
case 'install':

View File

@ -55,6 +55,23 @@ class SolverTest extends TestCase
));
}
public function testInstallNonExistingPackageFails()
{
$this->markTestIncomplete('Reporting this failure is not implemented/working yet');
$this->repo->addPackage($this->getPackage('A', '1.0'));
$this->reposComplete();
$this->request->install('B');
try {
$transaction = $this->solver->solve($this->request);
$this->fail('Unsolvable conflict did not resolve in exception.');
} catch (SolverProblemsException $e) {
// TODO assert problem properties
}
}
public function testSolverInstallWithDeps()
{
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
@ -537,7 +554,7 @@ class SolverTest extends TestCase
$transaction = $this->solver->solve($this->request);
$this->fail('Unsolvable conflict did not resolve in exception.');
} catch (SolverProblemsException $e) {
// @todo: assert problem properties
// TODO assert problem properties
}
}
@ -558,7 +575,7 @@ class SolverTest extends TestCase
$transaction = $this->solver->solve($this->request);
$this->fail('Unsolvable conflict did not resolve in exception.');
} catch (SolverProblemsException $e) {
// @todo: assert problem properties
// TODO assert problem properties
}
}