X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/981d20eb7e036152b04238036d1ce215b9b75ccf..fc4b5c9f963c8292d0908a9dd30e47bbb00a6396:/apt-pkg/depcache.cc diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 7f9ded720..36abcddd4 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: depcache.cc,v 1.10 1998/12/08 01:34:07 jgg Exp $ +// $Id: depcache.cc,v 1.18 1999/04/28 22:48:45 jgg Exp $ /* ###################################################################### Dependency Cache - Caches Dependency information. @@ -99,24 +99,13 @@ bool pkgDepCache::Init(OpProgress *Prog) // --------------------------------------------------------------------- /* The default just returns the target version if it exists or the highest version. */ -pkgDepCache::VerIterator pkgDepCache::GetCandidateVer(PkgIterator Pkg) +pkgDepCache::VerIterator pkgDepCache::GetCandidateVer(PkgIterator Pkg, + bool AllowCurrent) { // Try to use an explicit target - if (Pkg->TargetVer == 0) - { - /* Not source versions cannot be a candidate version unless they - are already installed */ - for (VerIterator I = Pkg.VersionList(); I.end() == false; I++) - { - if (Pkg.CurrentVer() == I) - return I; - for (VerFileIterator J = I.FileList(); J.end() == false; J++) - if ((J.File()->Flags & Flag::NotSource) == 0) - return I; - } - - return VerIterator(*this,0); - } + if (Pkg->TargetVer == 0 || + (AllowCurrent == false && Pkg.TargetVer() == Pkg.CurrentVer())) + return pkgCache::GetCandidateVer(Pkg,AllowCurrent); else return Pkg.TargetVer(); } @@ -214,11 +203,9 @@ void pkgDepCache::AddSizes(const PkgIterator &Pkg,long Mult) { StateCache &P = PkgState[Pkg->ID]; - if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure) - { - iUsrSize += Mult*P.InstVerIter(*this)->InstalledSize; + if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure && + P.Keep() == true) return; - } // Compute the size data if (P.NewInstall() == true) @@ -532,6 +519,12 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg,bool Soft) // Simplifies other routines. if (Pkg.end() == true) return; + + /* Reject an attempt to keep a non-source broken installed package, those + must be upgraded */ + if (Pkg.State() == PkgIterator::NeedsUnpack && + Pkg.CurrentVer().Downloadable() == false) + return; /* We changed the soft state all the time so the UI is a bit nicer to use */ @@ -588,7 +581,10 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg) RemoveSizes(Pkg); RemoveStates(Pkg); - P.Mode = ModeDelete; + if (Pkg->CurrentVer == 0) + P.Mode = ModeKeep; + else + P.Mode = ModeDelete; P.InstallVer = 0; P.Flags &= Flag::Auto;