Apply apt-0.5.15cnc6-alt-apt-shell.patch

Added in commit d952729:
0.5.15cnc6-alt4

- apt-shell fixes from Mouse (#4306).
This commit is contained in:
Gleb Fotengauer-Malinovskiy 2014-05-16 21:04:21 +04:00
parent 1adbad161e
commit cfcfc5759b
2 changed files with 19 additions and 52 deletions

View File

@ -1,49 +0,0 @@
--- apt-0.5.15lorg2/cmdline/apt-shell.cc.orig 2006-03-17 17:56:01 +0300
+++ apt-0.5.15lorg2/cmdline/apt-shell.cc 2006-03-17 17:56:02 +0300
@@ -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 =
@@ -4536,8 +4552,8 @@
largv[largc] = 0;
// Make our own copy of the configuration.
- delete _config;
- _config = new Configuration(GlobalConfig);
+ //delete _config;
+ //_config = new Configuration(GlobalConfig);
// Prepare the command line
CommandLine CmdL(CommandArgs(largv[1]),_config);

View File

@ -1279,10 +1279,24 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
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++)
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)
{
pkgCache::PkgIterator PrvPkg = Prv.OwnerPkg();
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;
@ -1304,6 +1318,8 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
// the user might try to install something he already has
// without being aware.
GoodSolutions.push_back(PrvPkg);
if (instVirtual)
break;
continue;
}
pkgCache::VerIterator PrvPkgCandVer =
@ -4533,8 +4549,8 @@ int main(int argc,const char *argv[])
largv[largc] = 0;
// Make our own copy of the configuration.
delete _config;
_config = new Configuration(GlobalConfig);
//delete _config;
//_config = new Configuration(GlobalConfig);
// Prepare the command line
CommandLine CmdL(CommandArgs(largv[1]),_config);