--- apt-0.5.15lorg3.94pt/cmdline/apt-get.cc.builddep 2010-12-06 18:04:56.403266834 +0100 +++ apt-0.5.15lorg3.94pt/cmdline/apt-get.cc 2010-12-06 18:06:29.030808359 +0100 @@ -2354,6 +2354,74 @@ bool DoBuildDep(CommandLine &CmdL) } } + if ((*Cache)[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 && + (Pkg.ProvidesList()->NextProvides == 0 || + _config->FindB("APT::Install::Virtual", false))) + { + pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg(); + if ((*D).Version[0] != '\0') + { + // Versioned dependency + pkgCache::PrvIterator PrvItr = Pkg.ProvidesList(); + for (; !PrvItr.end(); ++PrvItr) + { + if (Cache->VS().CheckDep(PrvItr.ProvideVersion(),(*D).Op,(*D).Version.c_str()) == true) + { + Tmp = PrvItr.OwnerPkg(); + break; + } + } + if (PrvItr.end()) + { + 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()); + } + } + + // CNC:2003-11-21 - Check if the current candidate is really + // providing that dependency + ioprintf(c1out,_("Selecting %s for '%s'\n"), + Tmp.Name(),Pkg.Name()); + pkgCache::VerIterator Ver = (*Cache)[Tmp].CandidateVerIter(Cache); + pkgCache::PrvIterator Prv = Ver.ProvidesList(); + bool Found = false; + for (; Prv.end() == false; Prv++) { + if (strcmp(Prv.Name(), Pkg.Name()) == 0) { + Found = true; + break; + } + } + if (Found == false) { + // The current candidate doesn't provide the needed dependency. + // Look for one that does. + Ver = Tmp.VersionList(); + for (; Ver.end() == false; Ver++) { + Prv = Ver.ProvidesList(); + Found = false; + for (; Prv.end() == false; Prv++) { + if (strcmp(Prv.Name(), Pkg.Name()) == 0) { + Found = true; + break; + } + } + if (Found) { + (*Cache).SetCandidateVersion(Ver); + break; + } + } + if (Found == false) { + ioprintf(c1out,_("Internal error. Package %s doesn't provide %s\n"),Tmp.Name(),Pkg.Name()); + return false; + } + } + Pkg = Tmp; + } + else + { + // Get installed version and version we are going to install pkgCache::VerIterator IV = installed ? (*Cache)[Prv.OwnerPkg()].InstVerIter(*Cache): (*Cache)[Pkg].InstVerIter(*Cache); @@ -2420,6 +2488,7 @@ bool DoBuildDep(CommandLine &CmdL) Pkg.Name()); } } + } if (_config->FindB("Debug::BuildDeps",false) == true)