summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:54:13 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:54:13 +0000
commitd556d1a1cc89e0f99d1b76fd6da72fd0174f5862 (patch)
tree6b67b2f7bb477d9e6b000059113101fd8695dcef
parent58d63ae695eb9f979e65fa8c01fa2c34d61e6527 (diff)
Purge support
Author: jgg Date: 1999-07-10 04:58:42 GMT Purge support
-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
-rw-r--r--cmdline/apt-get.cc13
-rw-r--r--debian/changelog1
6 files changed, 30 insertions, 17 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
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index dc1e89ae5..67352c868 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-get.cc,v 1.68 1999/07/09 04:11:34 jgg Exp $
+// $Id: apt-get.cc,v 1.69 1999/07/10 04:58:42 jgg Exp $
/* ######################################################################
apt-get - Cover for dpkg
@@ -451,7 +451,10 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,bool Saftey =
{
pkgCache::PkgIterator I = Cache->PkgBegin();
for (; I.end() == false; I++)
- Cache[I].iFlags |= pkgDepCache::Purge;
+ {
+ if (I.Purge() == false && Cache[I].Mode == pkgDepCache::ModeDelete)
+ Cache->MarkDelete(I,true);
+ }
}
bool Fail = false;
@@ -863,7 +866,7 @@ bool DoInstall(CommandLine &CmdL)
if (Remove == true)
{
Fix.Remove(Pkg);
- Cache->MarkDelete(Pkg);
+ Cache->MarkDelete(Pkg,_config->FindB("APT::Get::Purge",false));
continue;
}
@@ -1003,9 +1006,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
// Remove packages
if (I->SelectedState == pkgCache::State::DeInstall ||
I->SelectedState == pkgCache::State::Purge)
- Cache->MarkDelete(I);
- if (I->SelectedState == pkgCache::State::Purge)
- Cache[I].iFlags |= pkgDepCache::Purge;
+ Cache->MarkDelete(I,I->SelectedState == pkgCache::State::Purge);
}
/* Resolve any problems that dselect created, allupgrade cannot handle
diff --git a/debian/changelog b/debian/changelog
index 749a11014..a10361a85 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ apt (0.3.11.1) unstable; urgency=low
* Multiple media swap support
* Purge support. Closes: #33291, #40694
* Better handling of - remove notation. Closes: #41024
+ * Purge support. Closes: #33291, #40694
-- Jason Gunthorpe <jgg@debian.org> Mon, 28 Jun 1999 21:06:44 -0700