]> git.saurik.com Git - apt.git/commitdiff
alternatively check in a versioned depends if the candidate is good
authorDavid Kalnischkies <kalnischkies@gmail.com>
Sun, 24 Jul 2011 17:26:38 +0000 (19:26 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Sun, 24 Jul 2011 17:26:38 +0000 (19:26 +0200)
The old code used to do move on to versions behind the candidate in
cases the candidate wasn't a match, but as the Install request later
always installs the candidate (witch wasn't switched) this could have
never worked - and shouldn't in most cases anyway as:
a) it could only work for <, <=, != depends which are unusal
b) doesn't respect pinning, so it could install -1 versions

cmdline/apt-get.cc

index b37ced5cb61814ddc062abdcd73fc7f804c5cb9f..80037ae661c8873e5fbbd523cd4f97eda87bf7d1 100644 (file)
@@ -2827,33 +2827,27 @@ bool DoBuildDep(CommandLine &CmdL)
                  continue;
               }
            }
-
-            if ((*D).Version[0] != '\0') {
-                 // Versioned dependency
-
-                 pkgCache::VerIterator CV = (*Cache)[Pkg].CandidateVerIter(*Cache);
-
-                 for (; CV.end() != true; CV++)
-                 {
-                      if (Cache->VS().CheckDep(CV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
-                           break;
-                 }
-                 if (CV.end() == true)
-                {
-                  if (hasAlternatives)
-                  {
-                     continue;
-                  }
-                  else
-                  {
-                      return _error->Error(_("%s dependency for %s cannot be satisfied "
-                                             "because no available versions of package %s "
-                                             "can satisfy version requirements"),
-                                           Last->BuildDepType((*D).Type),Src.c_str(),
-                                           (*D).Package.c_str());
-                  }
-                }
-            }
+           else // versioned dependency
+           {
+              pkgCache::VerIterator CV = (*Cache)[Pkg].CandidateVerIter(*Cache);
+              if (CV.end() == true ||
+                  Cache->VS().CheckDep(CV.VerStr(),(*D).Op,(*D).Version.c_str()) == false)
+              {
+                 if (hasAlternatives)
+                    continue;
+                 else if (CV.end() == false)
+                    return _error->Error(_("%s dependency for %s cannot be satisfied "
+                                           "because candidate version of package %s "
+                                           "can't satisfy version requirements"),
+                                         Last->BuildDepType(D->Type), Src.c_str(),
+                                         D->Package.c_str());
+                 else
+                    return _error->Error(_("%s dependency for %s cannot be satisfied "
+                                           "because package %s has no candidate version"),
+                                         Last->BuildDepType(D->Type), Src.c_str(),
+                                         D->Package.c_str());
+              }
+           }
 
             if (_config->FindB("Debug::BuildDeps",false) == true)
                cout << "  Trying to install " << (*D).Package << endl;