From fc4b5c9f963c8292d0908a9dd30e47bbb00a6396 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:54:12 +0000 Subject: g++- works Author: jgg Date: 1999-07-09 04:11:33 GMT g++- works --- apt-pkg/algorithms.cc | 9 ++++++--- apt-pkg/algorithms.h | 4 ++-- apt-pkg/deb/dpkgpm.cc | 18 +++++++++++++++--- apt-pkg/deb/dpkgpm.h | 6 +++--- apt-pkg/depcache.h | 4 ++-- apt-pkg/packagemanager.cc | 4 ++-- apt-pkg/packagemanager.h | 4 ++-- cmdline/apt-get.cc | 29 +++++++++++++++++++++++++---- debian/changelog | 3 +++ doc/apt-get.8.yo | 3 +++ 10 files changed, 63 insertions(+), 21 deletions(-) diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 21db98941..9ca6ca590 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.20 1999/07/03 03:10:35 jgg Exp $ +// $Id: algorithms.cc,v 1.21 1999/07/09 04:11:33 jgg Exp $ /* ###################################################################### Algorithms - A set of misc algorithms @@ -125,14 +125,17 @@ bool pkgSimulate::Configure(PkgIterator iPkg) // Simulate::Remove - Simulate the removal of a package /*{{{*/ // --------------------------------------------------------------------- /* */ -bool pkgSimulate::Remove(PkgIterator iPkg) +bool pkgSimulate::Remove(PkgIterator iPkg,bool Purge) { // Adapt the iterator PkgIterator Pkg = Sim.FindPkg(iPkg.Name()); Flags[Pkg->ID] = 3; Sim.MarkDelete(Pkg); - cout << "Remv " << Pkg.Name(); + if (Purge == true) + cout << "Purg " << Pkg.Name(); + else + cout << "Remv " << Pkg.Name(); if (Sim.BrokenCount() != 0) ShortBreaks(); diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index 0553b3eec..1603377f4 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: algorithms.h,v 1.6 1998/10/20 02:39:18 jgg Exp $ +// $Id: algorithms.h,v 1.7 1999/07/09 04:11:34 jgg Exp $ /* ###################################################################### Algorithms - A set of misc algorithms @@ -49,7 +49,7 @@ class pkgSimulate : public pkgPackageManager // The Actuall installation implementation virtual bool Install(PkgIterator Pkg,string File); virtual bool Configure(PkgIterator Pkg); - virtual bool Remove(PkgIterator Pkg); + virtual bool Remove(PkgIterator Pkg,bool Purge); void ShortBreaks(); public: diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 998750b3b..4e108c419 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: dpkgpm.cc,v 1.10 1999/07/03 03:10:35 jgg Exp $ +// $Id: dpkgpm.cc,v 1.11 1999/07/09 04:11:34 jgg Exp $ /* ###################################################################### DPKG Package Manager - Provide an interface to dpkg @@ -65,12 +65,15 @@ bool pkgDPkgPM::Configure(PkgIterator Pkg) // DPkgPM::Remove - Remove a package /*{{{*/ // --------------------------------------------------------------------- /* Add a remove operation to the sequence list */ -bool pkgDPkgPM::Remove(PkgIterator Pkg) +bool pkgDPkgPM::Remove(PkgIterator Pkg,bool Purge) { if (Pkg.end() == true) return false; - List.push_back(Item(Item::Remove,Pkg)); + if (Purge == true) + List.push_back(Item(Item::Purge,Pkg)); + else + List.push_back(Item(Item::Remove,Pkg)); return true; } /*}}}*/ @@ -184,6 +187,15 @@ bool pkgDPkgPM::Go() Size += strlen(Args[n-1]); break; + case Item::Purge: + Args[n++] = "--force-depends"; + Size += strlen(Args[n-1]); + Args[n++] = "--force-remove-essential"; + Size += strlen(Args[n-1]); + Args[n++] = "--purge"; + Size += strlen(Args[n-1]); + break; + case Item::Configure: Args[n++] = "--configure"; Size += strlen(Args[n-1]); diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index d7898daf1..e8ffe7bb4 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: dpkgpm.h,v 1.4 1999/07/03 03:10:35 jgg Exp $ +// $Id: dpkgpm.h,v 1.5 1999/07/09 04:11:34 jgg Exp $ /* ###################################################################### DPKG Package Manager - Provide an interface to dpkg @@ -23,7 +23,7 @@ class pkgDPkgPM : public pkgPackageManager struct Item { - enum Ops {Install, Configure, Remove} Op; + enum Ops {Install, Configure, Remove, Purge} Op; string File; PkgIterator Pkg; Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op), @@ -39,7 +39,7 @@ class pkgDPkgPM : public pkgPackageManager // The Actuall installation implementation virtual bool Install(PkgIterator Pkg,string File); virtual bool Configure(PkgIterator Pkg); - virtual bool Remove(PkgIterator Pkg); + virtual bool Remove(PkgIterator Pkg,bool Purge = false); virtual bool Go(); virtual void Reset(); diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 29db800c2..dd56464bd 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.9 1999/04/12 04:21:20 jgg Exp $ +// $Id: depcache.h,v 1.10 1999/07/09 04:11:34 jgg Exp $ /* ###################################################################### DepCache - Dependency Extension data for the cache @@ -60,7 +60,7 @@ class pkgDepCache : public pkgCache DepCandPolicy = (1 << 4), DepCandMin = (1 << 5)}; // These flags are used in StateCache::iFlags - enum InternalFlags {AutoKept = (1 << 0)}; + enum InternalFlags {AutoKept = (1 << 0), Purge = (1 << 1)}; enum VersionTypes {NowVersion, InstallVersion, CandidateVersion}; enum ModeList {ModeDelete = 0, ModeKeep = 1, ModeInstall = 2}; diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 9e2eee969..95192c9f0 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.16 1999/07/04 23:22:53 jgg Exp $ +// $Id: packagemanager.cc,v 1.17 1999/07/09 04:11:34 jgg Exp $ /* ###################################################################### Package Manager - Abstacts the package manager @@ -375,7 +375,7 @@ bool pkgPackageManager::SmartRemove(PkgIterator Pkg) return true; List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); - return Remove(Pkg); + return Remove(Pkg,(Cache[Pkg].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge); } /*}}}*/ // PM::SmartUnPack - Install helper /*{{{*/ diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index 6dbf94def..88039ba5a 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: packagemanager.h,v 1.8 1999/07/03 03:10:35 jgg Exp $ +// $Id: packagemanager.h,v 1.9 1999/07/09 04:11:34 jgg Exp $ /* ###################################################################### Package Manager - Abstacts the package manager @@ -74,7 +74,7 @@ class pkgPackageManager // The Actuall installation implementation virtual bool Install(PkgIterator /*Pkg*/,string /*File*/) {return false;}; virtual bool Configure(PkgIterator /*Pkg*/) {return false;}; - virtual bool Remove(PkgIterator /*Pkg*/) {return false;}; + virtual bool Remove(PkgIterator /*Pkg*/,bool Purge=false) {return false;}; virtual bool Go() {return true;}; virtual void Reset() {}; diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index f81d22d20..dc1e89ae5 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.67 1999/07/03 03:10:36 jgg Exp $ +// $Id: apt-get.cc,v 1.68 1999/07/09 04:11:34 jgg Exp $ /* ###################################################################### apt-get - Cover for dpkg @@ -225,8 +225,15 @@ void ShowDel(ostream &out,pkgDepCache &Dep) pkgCache::PkgIterator I = Dep.PkgBegin(); string List; for (;I.end() != true; I++) + { if (Dep[I].Delete() == true) - List += string(I.Name()) + " "; + { + if ((Dep[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge) + List += string(I.Name()) + "* "; + else + List += string(I.Name()) + " "; + } + } ShowList(out,"The following packages will be REMOVED:",List); } @@ -440,6 +447,13 @@ bool CacheFile::CheckDeps(bool AllowBroken) happen and then calls the download routines */ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,bool Saftey = true) { + if (_config->FindB("APT::Get::Purge",false) == true) + { + pkgCache::PkgIterator I = Cache->PkgBegin(); + for (; I.end() == false; I++) + Cache[I].iFlags |= pkgDepCache::Purge; + } + bool Fail = false; bool Essential = false; @@ -768,19 +782,23 @@ bool DoInstall(CommandLine &CmdL) // See if we are removing the package bool Remove = DefRemove; - if (Cache->FindPkg(S).end() == true) + while (Cache->FindPkg(S).end() == true) { // Handle an optional end tag indicating what to do if (S[Length - 1] == '-') { Remove = true; S[--Length] = 0; + continue; } + if (S[Length - 1] == '+') { Remove = false; S[--Length] = 0; + continue; } + break; } // Locate the package @@ -986,6 +1004,8 @@ bool DoDSelectUpgrade(CommandLine &CmdL) 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; } /* Resolve any problems that dselect created, allupgrade cannot handle @@ -1371,7 +1391,7 @@ bool ShowHelp(CommandLine &CmdL) cout << " -c=? Read this configuration file" << endl; cout << " -o=? Set an arbitary configuration option, eg -o dir::cache=/tmp" << endl; cout << "See the apt-get(8), sources.list(5) and apt.conf(5) manual" << endl; - cout << "pages for more information." << endl; + cout << "pages for more information and options." << endl; return 100; } /*}}}*/ @@ -1429,6 +1449,7 @@ int main(int argc,const char *argv[]) {0,"no-upgrade","APT::Get::no-upgrade",0}, {0,"force-yes","APT::Get::force-yes",0}, {0,"print-uris","APT::Get::Print-URIs",0}, + {0,"purge","APT::Get::Purge",0}, {'c',"config-file",0,CommandLine::ConfigFile}, {'o',"option",0,CommandLine::ArbItem}, {0,0,0,0}}; diff --git a/debian/changelog b/debian/changelog index 8f6bb1309..749a11014 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ apt (0.3.11.1) unstable; urgency=low * Fix for typo in the dhelp index. Closes: #40377 + * Multiple media swap support + * Purge support. Closes: #33291, #40694 + * Better handling of - remove notation. Closes: #41024 -- Jason Gunthorpe Mon, 28 Jun 1999 21:06:44 -0700 diff --git a/doc/apt-get.8.yo b/doc/apt-get.8.yo index 6edecadf3..4f399ac31 100644 --- a/doc/apt-get.8.yo +++ b/doc/apt-get.8.yo @@ -207,6 +207,9 @@ md5 hash. Note that the file name to write to will not always match the file name on the remote site! This also works with the bf(source) command See bf(APT::Get::Print-URIs). +dit(bf(--purge)) +Use purge instead of remove for anything that would be removed. + dit(bf(-c, --config-file)) Configuration File; Specify a configuration file to use. bf(apt-get) will read the default configuration file and then this configuration file. See -- cgit v1.2.3