X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/fcf85120ef8c7e953a23a49768c0d5b84385efcd..981d20eb7e036152b04238036d1ce215b9b75ccf:/apt-pkg/algorithms.cc diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index c419022ff..cb9228cff 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.10 1998/11/14 03:32:36 jgg Exp $ +// $Id: algorithms.cc,v 1.14 1998/12/08 01:34:05 jgg Exp $ /* ###################################################################### Algorithms - A set of misc algorithms @@ -29,7 +29,7 @@ pkgProblemResolver *pkgProblemResolver::This = 0; // --------------------------------------------------------------------- /* */ pkgSimulate::pkgSimulate(pkgDepCache &Cache) : pkgPackageManager(Cache), - Sim(Cache) + Sim(Cache.GetMap()) { Flags = new unsigned char[Cache.HeaderP->PackageCount]; memset(Flags,0,sizeof(*Flags)*Cache.HeaderP->PackageCount); @@ -165,6 +165,14 @@ bool pkgApplyStatus(pkgDepCache &Cache) { for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++) { + // Only choice for a ReInstReq package is to reinstall + if (I->InstState == pkgCache::State::ReInstReq || + I->InstState == pkgCache::State::HoldReInstReq) + { + Cache.MarkKeep(I); + continue; + } + switch (I->CurrentState) { // This means installation failed somehow @@ -445,8 +453,12 @@ void pkgProblemResolver::MakeScores() /* Protected things are pushed really high up. This number should put them ahead of everything */ for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++) + { if ((Flags[I->ID] & Protected) != 0) Scores[I->ID] += 10000; + if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential) + Scores[I->ID] += 5000; + } delete [] OldScores; } @@ -671,16 +683,9 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false;) { // Compute a single dependency element (glob or) - pkgCache::DepIterator Start = D; - pkgCache::DepIterator End = D; - unsigned char State = 0; - for (bool LastOR = true; D.end() == false && LastOR == true; D++) - { - State |= Cache[D]; - LastOR = (D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or; - if (LastOR == true) - End = D; - } + pkgCache::DepIterator Start; + pkgCache::DepIterator End; + D.GlobOr(Start,End); // We only worry about critical deps. if (End.IsCritical() != true) @@ -693,7 +698,8 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) // Hm, the group is broken.. I have no idea how to handle this if (Start != End) { - clog << "Note, a broken or group was found in " << I.Name() << "." << endl; + if (Debug == true) + clog << "Note, a broken or group was found in " << I.Name() << "." << endl; Cache.MarkDelete(I); break; }