From cfcfc5759b2ce27f9e99021bda2e3d7e41d34546 Mon Sep 17 00:00:00 2001 From: Gleb Fotengauer-Malinovskiy Date: Fri, 16 May 2014 21:04:21 +0400 Subject: [PATCH] Apply apt-0.5.15cnc6-alt-apt-shell.patch Added in commit d952729: 0.5.15cnc6-alt4 - apt-shell fixes from Mouse (#4306). --- apt-0.5.15cnc6-alt-apt-shell.patch | 49 ------------------------------ apt/cmdline/apt-shell.cc | 22 ++++++++++++-- 2 files changed, 19 insertions(+), 52 deletions(-) delete mode 100644 apt-0.5.15cnc6-alt-apt-shell.patch diff --git a/apt-0.5.15cnc6-alt-apt-shell.patch b/apt-0.5.15cnc6-alt-apt-shell.patch deleted file mode 100644 index d90c711..0000000 --- a/apt-0.5.15cnc6-alt-apt-shell.patch +++ /dev/null @@ -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 GoodSolutions; -+ unsigned long Size = 0; - for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); - Prv.end() == false; Prv++) -- { -- pkgCache::PkgIterator PrvPkg = Prv.OwnerPkg(); -+ Size++; -+ SPtrArray 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; pFindB("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); diff --git a/apt/cmdline/apt-shell.cc b/apt/cmdline/apt-shell.cc index 51a9d0e..a3ca798 100644 --- a/apt/cmdline/apt-shell.cc +++ b/apt/cmdline/apt-shell.cc @@ -1279,10 +1279,24 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache, if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0) { vector GoodSolutions; + unsigned long Size = 0; for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() == false; Prv++) + Size++; + SPtrArray 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; pFindB("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);