X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/3a48630505772d0cf3ae781490331ba8d5f34536..4845b8d50e9b1546127423aba675635024c93aa1:/apt-pkg/algorithms.cc diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index aa3e86568..9b37385bf 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: algorithms.cc,v 1.41 2002/04/26 05:36:20 jgg Exp $ +// $Id: algorithms.cc,v 1.44 2002/11/28 18:49:16 jgg Exp $ /* ###################################################################### Algorithms - A set of misc algorithms @@ -26,6 +26,7 @@ #include /*}}}*/ +using namespace std; pkgProblemResolver *pkgProblemResolver::This = 0; @@ -49,17 +50,22 @@ pkgSimulate::pkgSimulate(pkgDepCache *Cache) : pkgPackageManager(Cache), /*}}}*/ // Simulate::Describe - Describe a package /*{{{*/ // --------------------------------------------------------------------- -/* */ +/* Parameter Now == true gives both current and available varsion, + Parameter Now == false gives only the available package version */ void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Now) { VerIterator Ver(Sim); + + out << Pkg.Name(); + if (Now == true) + { Ver = Pkg.CurrentVer(); - else - Ver = Sim[Pkg].CandidateVerIter(Sim); + if (Ver.end() == false) + out << " [" << Ver.VerStr() << ']'; + } - out << Pkg.Name(); - + Ver = Sim[Pkg].CandidateVerIter(Sim); if (Ver.end() == true) return; @@ -76,7 +82,7 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/) Flags[Pkg->ID] = 1; cout << "Inst "; - Describe(Pkg,cout,false); + Describe(Pkg,cout,true); Sim.MarkInstall(Pkg,false); // Look for broken conflicts+predepends. @@ -1204,14 +1210,14 @@ static int PrioComp(const void *A,const void *B) pkgCache::VerIterator R(*PrioCache,*(pkgCache::Version **)B); if ((L.ParentPkg()->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential && - (L.ParentPkg()->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential) - return 1; + (R.ParentPkg()->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential) + return 1; if ((L.ParentPkg()->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential && - (L.ParentPkg()->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential) - return -1; + (R.ParentPkg()->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential) + return -1; if (L->Priority != R->Priority) - return L->Priority - R->Priority; + return R->Priority - L->Priority; return strcmp(L.ParentPkg().Name(),R.ParentPkg().Name()); } void pkgPrioSortList(pkgCache &Cache,pkgCache::Version **List)