57 lines
2.0 KiB
Diff
57 lines
2.0 KiB
Diff
--- apt-0.5.15cnc6/cmdline/apt-shell.cc.orig 2004-06-07 18:53:30 +0400
|
|
+++ apt-0.5.15cnc6/cmdline/apt-shell.cc 2004-06-07 19:13:44 +0400
|
|
@@ -1285,10 +1285,24 @@
|
|
if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0)
|
|
{
|
|
vector<pkgCache::Package *> GoodSolutions;
|
|
+ unsigned long Size = 0;
|
|
for (pkgCache::PrvIterator Prv = Pkg.ProvidesList();
|
|
Prv.end() == false; Prv++)
|
|
- {
|
|
- pkgCache::PkgIterator PrvPkg = Prv.OwnerPkg();
|
|
+ Size++;
|
|
+ SPtrArray<pkgCache::Package *> PList = new pkgCache::Package *[Size];
|
|
+ pkgCache::Package **PEnd = PList;
|
|
+ for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() == false; Prv++)
|
|
+ *PEnd++ = Prv.OwnerPkg();
|
|
+ Fix.MakeScores();
|
|
+ qsort(PList,PEnd - PList,sizeof(*PList),&(Fix.ScoreSort));
|
|
+
|
|
+ for (unsigned int p=0; p<Size; ++p)
|
|
+ {
|
|
+ bool instVirtual = _config->FindB("APT::Install::Virtual", false);
|
|
+ pkgCache::PkgIterator PrvPkg = pkgCache::PkgIterator(*Pkg.Cache(), PList[p]);
|
|
+ pkgCache::PrvIterator Prv = Pkg.ProvidesList();
|
|
+ for (; Prv.end() == false && Prv.OwnerPkg() != PrvPkg; Prv++)
|
|
+ ;
|
|
// Check if it's a different version of a package already
|
|
// considered as a good solution.
|
|
bool AlreadySeen = false;
|
|
@@ -1310,6 +1324,8 @@
|
|
// the user might try to install something he already has
|
|
// without being aware.
|
|
GoodSolutions.push_back(PrvPkg);
|
|
+ if (instVirtual)
|
|
+ break;
|
|
continue;
|
|
}
|
|
pkgCache::VerIterator PrvPkgCandVer =
|
|
@@ -1324,13 +1340,15 @@
|
|
{
|
|
// Yes, it is. This is a good solution.
|
|
GoodSolutions.push_back(PrvPkg);
|
|
+ if (instVirtual)
|
|
+ break;
|
|
continue;
|
|
}
|
|
}
|
|
vector<string> GoodSolutionNames;
|
|
- for (unsigned int i = 0; i != GoodSolutionNames.size(); i++)
|
|
+ for (unsigned int i = 0; i != GoodSolutions.size(); i++)
|
|
{
|
|
- pkgCache::PkgIterator GoodPkg(Cache, GoodSolutions[0]);
|
|
+ pkgCache::PkgIterator GoodPkg(Cache, GoodSolutions[i]);
|
|
GoodSolutionNames.push_back(GoodPkg.Name());
|
|
}
|
|
#ifdef WITH_LUA
|