summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/cacheiterators.h3
-rw-r--r--apt-pkg/depcache.cc20
-rw-r--r--apt-pkg/depcache.h4
-rw-r--r--apt-pkg/packagemanager.cc6
4 files changed, 22 insertions, 11 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 16088765d..800066be9 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: cacheiterators.h,v 1.13 1999/02/23 06:46:24 jgg Exp $
+// $Id: cacheiterators.h,v 1.14 1999/07/10 04:58:42 jgg Exp $
/* ######################################################################
Cache Iterators - Iterators for navigating the cache structure
@@ -66,6 +66,7 @@ class pkgCache::PkgIterator
inline const char *Name() const {return Pkg->Name == 0?0:Owner->StrP + Pkg->Name;};
inline const char *Section() const {return Pkg->Section == 0?0:Owner->StrP + Pkg->Section;};
inline const char *TargetDist() const {return Pkg->TargetDist == 0?0:Owner->StrP + Pkg->TargetDist;};
+ inline bool Purge() const {return Pkg->CurrentState == pkgCache::State::Purge;};
inline VerIterator VersionList() const;
inline VerIterator TargetVer() const;
inline VerIterator CurrentVer() const;
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 36abcddd4..dc03ef68c 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.18 1999/04/28 22:48:45 jgg Exp $
+// $Id: depcache.cc,v 1.19 1999/07/10 04:58:42 jgg Exp $
/* ######################################################################
Dependency Cache - Caches Dependency information.
@@ -264,6 +264,10 @@ void pkgDepCache::AddStates(const PkgIterator &Pkg,int Add)
// Not installed
if (Pkg->CurrentVer == 0)
{
+ if (State.Mode == ModeDelete &&
+ (State.iFlags | Purge) == Purge && Pkg.Purge() == false)
+ iDelCount += Add;
+
if (State.Mode == ModeInstall)
iInstCount += Add;
return;
@@ -562,7 +566,7 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg,bool Soft)
// DepCache::MarkDelete - Put the package in the delete state /*{{{*/
// ---------------------------------------------------------------------
/* */
-void pkgDepCache::MarkDelete(PkgIterator const &Pkg)
+void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge)
{
// Simplifies other routines.
if (Pkg.end() == true)
@@ -570,10 +574,14 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg)
// Check that it is not already marked for delete
StateCache &P = PkgState[Pkg->ID];
- P.iFlags &= ~AutoKept;
- if (P.Mode == ModeDelete || P.InstallVer == 0)
+ P.iFlags &= ~(AutoKept | Purge);
+ if (rPurge == true)
+ P.iFlags |= Purge;
+
+ if ((P.Mode == ModeDelete || P.InstallVer == 0) &&
+ (Pkg.Purge() == true || rPurge == false))
return;
-
+
// We dont even try to delete virtual packages..
if (Pkg->VersionList == 0)
return;
@@ -581,7 +589,7 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg)
RemoveSizes(Pkg);
RemoveStates(Pkg);
- if (Pkg->CurrentVer == 0)
+ if (Pkg->CurrentVer == 0 && (Pkg.Purge() == true || rPurge == false))
P.Mode = ModeKeep;
else
P.Mode = ModeDelete;
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index dd56464bd..9592e7035 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: depcache.h,v 1.10 1999/07/09 04:11:34 jgg Exp $
+// $Id: depcache.h,v 1.11 1999/07/10 04:58:42 jgg Exp $
/* ######################################################################
DepCache - Dependency Extension data for the cache
@@ -162,7 +162,7 @@ class pkgDepCache : public pkgCache
// Manipulators
void MarkKeep(PkgIterator const &Pkg,bool Soft = false);
- void MarkDelete(PkgIterator const &Pkg);
+ void MarkDelete(PkgIterator const &Pkg,bool Purge = false);
void MarkInstall(PkgIterator const &Pkg,bool AutoInst = true);
// This is for debuging
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 95192c9f0..126caef93 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: packagemanager.cc,v 1.17 1999/07/09 04:11:34 jgg Exp $
+// $Id: packagemanager.cc,v 1.18 1999/07/10 04:58:42 jgg Exp $
/* ######################################################################
Package Manager - Abstacts the package manager
@@ -152,7 +152,9 @@ bool pkgPackageManager::CreateOrderList()
// Not interesting
if ((Cache[I].Keep() == true ||
Cache[I].InstVerIter(Cache) == I.CurrentVer()) &&
- I.State() == pkgCache::PkgIterator::NeedsNothing)
+ I.State() == pkgCache::PkgIterator::NeedsNothing &&
+ (I.Purge() != false || Cache[I].Mode != pkgDepCache::ModeDelete ||
+ (Cache[I].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge))
continue;
// Append it to the list