Browse Source

We do not support any options to keep obsolete packages

Nils Adermann 13 years ago
parent
commit
5ba9a887c2
1 changed files with 25 additions and 38 deletions
  1. 25 38
      src/Composer/DependencyResolver/Solver.php

+ 25 - 38
src/Composer/DependencyResolver/Solver.php

@@ -30,7 +30,6 @@ class Solver
     protected $ruleToJob = array();
     protected $addedMap = array();
     protected $updateMap = array();
-    protected $noObsoletes = array();
     protected $watches = array();
     protected $removeWatches = array();
     protected $decisionMap;
@@ -237,50 +236,38 @@ class Solver
             }
 
             // check obsoletes and implicit obsoletes of a package
-            // if ignoreinstalledsobsoletes is not set, we're also checking
-            // 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;
-                        }
+            $isInstalled = (isset($this->installedMap[$package->getId()]));
 
-                        $reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
-                        $this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $provider, $reason, (string) $link));
-                    }
-                }
+            foreach ($package->getReplaces() as $link) {
+                $obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
 
-                // check implicit obsoletes
-                // 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);
+                foreach ($obsoleteProviders as $provider) {
+                    if ($provider === $package) {
+                        continue;
+                    }
 
-                    foreach ($obsoleteProviders as $provider) {
-                        if ($provider === $package) {
-                            continue;
-                        }
+                    $reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
+                    $this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $provider, $reason, (string) $link));
+                }
+            }
 
-                        if ($isInstalled && !isset($this->installedMap[$provider->getId()])) {
-                            continue;
-                        }
+            // check implicit obsoletes
+            // 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
-                        if ($noObsoletes && (!$package->equals($provider))) {
-                            continue;
-                        }
+                foreach ($obsoleteProviders as $provider) {
+                    if ($provider === $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));
+                    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));
                 }
             }
         }