- /*
- * TODO: if we depend on a version lower than what we already have
- * installed it is not clear what should be done; in practice
- * this case should be rare, and right now nothing is
- * done about it :-(
- */
- if (Prv.end() == true && // Nothing provides it; and
- (IV.end() == true || // It is not installed, or
- Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == false))
- // the version installed doesn't
- // satisfy constraints
- TryToInstall(Pkg,Cache,Fix,false,false,ExpectedInst);
+ if (IV.end() == false)
+ {
+ if (_config->FindB("Debug::BuildDeps",false) == true)
+ cout << " Is installed\n";
+
+ if (Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
+ {
+ skipAlternatives = hasAlternatives;
+ continue;
+ }
+
+ if (_config->FindB("Debug::BuildDeps",false) == true)
+ cout << " ...but the installed version doesn't meet the version requirement\n";
+
+ if (((*D).Op & pkgCache::Dep::LessEq) == pkgCache::Dep::LessEq)
+ {
+ return _error->Error(_("Failed to satisfy %s dependency for %s: Installed package %s is too new"),
+ Last->BuildDepType((*D).Type),
+ Src.c_str(),
+ Pkg.Name());
+ }
+ }
+
+
+ if (_config->FindB("Debug::BuildDeps",false) == true)
+ cout << " Trying to install " << (*D).Package << endl;
+
+ if (TryToInstall(Pkg,Cache,Fix,false,false,ExpectedInst) == true)
+ {
+ // We successfully installed something; skip remaining alternatives
+ skipAlternatives = hasAlternatives;
+ continue;
+ }
+ else if (hasAlternatives)
+ {
+ if (_config->FindB("Debug::BuildDeps",false) == true)
+ cout << " Unsatisfiable, trying alternatives\n";
+ continue;
+ }
+ else
+ {
+ return _error->Error(_("Failed to satisfy %s dependency for %s: %s"),
+ Last->BuildDepType((*D).Type),
+ Src.c_str(),
+ (*D).Package.c_str());
+ }