We do not support any options to keep obsolete packages

main
Nils Adermann 12 years ago
parent 41bd845c54
commit 5ba9a887c2

@ -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) {
$obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
foreach ($obsoleteProviders as $provider) {
if ($provider === $package) {
continue;
}
$reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES; foreach ($package->getReplaces() as $link) {
$this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $provider, $reason, (string) $link)); $obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
}
}
// check implicit obsoletes foreach ($obsoleteProviders as $provider) {
// for installed packages we only need to check installed/installed problems, if ($provider === $package) {
// as the others are picked up when looking at the uninstalled package. continue;
if (!$isInstalled) { }
$obsoleteProviders = $this->pool->whatProvides($package->getName(), null);
foreach ($obsoleteProviders as $provider) { $reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
if ($provider === $package) { $this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $provider, $reason, (string) $link));
continue; }
} }
if ($isInstalled && !isset($this->installedMap[$provider->getId()])) { // check implicit obsoletes
continue; // for installed packages we only need to check installed/installed problems,
} // as the others are picked up when looking at the uninstalled package.
if (!$isInstalled) {
$obsoleteProviders = $this->pool->whatProvides($package->getName(), null);
// obsolete same packages even when noObsoletes foreach ($obsoleteProviders as $provider) {
if ($noObsoletes && (!$package->equals($provider))) { if ($provider === $package) {
continue; continue;
} }
$reason = ($package->getName() == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES; if ($isInstalled && !isset($this->installedMap[$provider->getId()])) {
$this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createConflictRule($package, $provider, $reason, (string) $package)); 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));
} }
} }
} }

Loading…
Cancel
Save