diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2011-07-24 19:26:38 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2011-07-24 19:26:38 +0200 |
commit | 2baf02ca838e9d7df0a0e9923ffbbb706978ffa4 (patch) | |
tree | 703c78816e3999ed86ac98f311cd325cb5e78aaf | |
parent | fe0278799cb7bd1c9039a053da178f54d120248c (diff) |
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
-rw-r--r-- | cmdline/apt-get.cc | 48 |
1 files 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; |