1
0
Fork 0

We do not support any options to keep obsolete packages

pull/636/head
Nils Adermann 2012-04-27 17:40:59 +02:00
parent 41bd845c54
commit 5ba9a887c2
1 changed files with 25 additions and 38 deletions

View File

@ -30,7 +30,6 @@ class Solver
protected $ruleToJob = array(); protected $ruleToJob = array();
protected $addedMap = array(); protected $addedMap = array();
protected $updateMap = array(); protected $updateMap = array();
protected $noObsoletes = array();
protected $watches = array(); protected $watches = array();
protected $removeWatches = array(); protected $removeWatches = array();
protected $decisionMap; protected $decisionMap;
@ -237,50 +236,38 @@ class Solver
} }
// check obsoletes and implicit obsoletes of a package // check obsoletes and implicit obsoletes of a package
// if ignoreinstalledsobsoletes is not set, we're also checking $isInstalled = (isset($this->installedMap[$package->getId()]));
// obsoletes of installed packages (like newer rpm versions)
//
/** TODO if ($this->noInstalledObsoletes) */
if (true) {
$noObsoletes = isset($this->noObsoletes[$package->getId()]);
$isInstalled = (isset($this->installedMap[$package->getId()]));
foreach ($package->getReplaces() as $link) { foreach ($package->getReplaces() as $link) {
$obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint()); $obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
foreach ($obsoleteProviders as $provider) { foreach ($obsoleteProviders as $provider) {
if ($provider === $package) { if ($provider === $package) {
continue; continue;
}
$reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
$this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $provider, $reason, (string) $link));
} }
$reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
$this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $provider, $reason, (string) $link));
} }
}
// check implicit obsoletes // check implicit obsoletes
// for installed packages we only need to check installed/installed problems, // for installed packages we only need to check installed/installed problems,
// as the others are picked up when looking at the uninstalled package. // as the others are picked up when looking at the uninstalled package.
if (!$isInstalled) { if (!$isInstalled) {
$obsoleteProviders = $this->pool->whatProvides($package->getName(), null); $obsoleteProviders = $this->pool->whatProvides($package->getName(), null);
foreach ($obsoleteProviders as $provider) { foreach ($obsoleteProviders as $provider) {
if ($provider === $package) { if ($provider === $package) {
continue; continue;
}
if ($isInstalled && !isset($this->installedMap[$provider->getId()])) {
continue;
}
// obsolete same packages even when noObsoletes
if ($noObsoletes && (!$package->equals($provider))) {
continue;
}
$reason = ($package->getName() == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
$this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createConflictRule($package, $provider, $reason, (string) $package));
} }
if ($isInstalled && !isset($this->installedMap[$provider->getId()])) {
continue;
}
$reason = ($package->getName() == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
$this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createConflictRule($package, $provider, $reason, (string) $package));
} }
} }
} }