Merge pull request #324 from edorian/installNonExistingPackage
Create an 'impossible rule' when installing non existent packagespull/327/head
commit
9b8e62396c
|
@ -304,7 +304,7 @@ class Solver
|
||||||
// if ignoreinstalledsobsoletes is not set, we're also checking
|
// if ignoreinstalledsobsoletes is not set, we're also checking
|
||||||
// obsoletes of installed packages (like newer rpm versions)
|
// obsoletes of installed packages (like newer rpm versions)
|
||||||
//
|
//
|
||||||
/** @TODO: if ($this->noInstalledObsoletes) */
|
/** TODO if ($this->noInstalledObsoletes) */
|
||||||
if (true) {
|
if (true) {
|
||||||
$noObsoletes = isset($this->noObsoletes[$package->getId()]);
|
$noObsoletes = isset($this->noObsoletes[$package->getId()]);
|
||||||
$isInstalled = (isset($this->installedMap[$package->getId()]));
|
$isInstalled = (isset($this->installedMap[$package->getId()]));
|
||||||
|
@ -964,6 +964,12 @@ class Solver
|
||||||
|
|
||||||
|
|
||||||
foreach ($this->jobs as $job) {
|
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) {
|
foreach ($job['packages'] as $package) {
|
||||||
switch ($job['cmd']) {
|
switch ($job['cmd']) {
|
||||||
case 'install':
|
case 'install':
|
||||||
|
|
|
@ -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()
|
public function testSolverInstallWithDeps()
|
||||||
{
|
{
|
||||||
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
|
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
|
||||||
|
@ -537,7 +554,7 @@ class SolverTest extends TestCase
|
||||||
$transaction = $this->solver->solve($this->request);
|
$transaction = $this->solver->solve($this->request);
|
||||||
$this->fail('Unsolvable conflict did not resolve in exception.');
|
$this->fail('Unsolvable conflict did not resolve in exception.');
|
||||||
} catch (SolverProblemsException $e) {
|
} 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);
|
$transaction = $this->solver->solve($this->request);
|
||||||
$this->fail('Unsolvable conflict did not resolve in exception.');
|
$this->fail('Unsolvable conflict did not resolve in exception.');
|
||||||
} catch (SolverProblemsException $e) {
|
} catch (SolverProblemsException $e) {
|
||||||
// @todo: assert problem properties
|
// TODO assert problem properties
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue