From 2baf02ca838e9d7df0a0e9923ffbbb706978ffa4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 24 Jul 2011 19:26:38 +0200 Subject: alternatively check in a versioned depends if the candidate is good 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 | 48 +++++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index b37ced5cb..80037ae66 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -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; -- cgit v1.2.3