Browse Source

Added clean install code
Author: jgg
Date: 1999-10-03 21:09:27 GMT
Added clean install code

Arch Librarian 22 years ago
parent
commit
c98b1307f0
5 changed files with 27 additions and 6 deletions
  1. 6 2
      apt-pkg/clean.cc
  2. 2 1
      debian/changelog
  3. 6 0
      doc/apt.conf.5.yo
  4. 7 1
      doc/examples/apt.conf
  5. 6 2
      methods/http.cc

+ 6 - 2
apt-pkg/clean.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: clean.cc,v 1.2 1999/06/24 04:06:30 jgg Exp $
+// $Id: clean.cc,v 1.3 1999/10/03 21:09:27 jgg Exp $
 /* ######################################################################
 /* ######################################################################
 
 
    Clean - Clean out downloaded directories
    Clean - Clean out downloaded directories
@@ -15,6 +15,7 @@
 #include <apt-pkg/clean.h>
 #include <apt-pkg/clean.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/configuration.h>
 
 
 #include <dirent.h>
 #include <dirent.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
@@ -27,6 +28,8 @@
    against our database to see if it is interesting */
    against our database to see if it is interesting */
 bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
 bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
 {
 {
+   bool CleanInstalled = _config->FindB("APT::Clean-Installed",true);
+   
    DIR *D = opendir(Dir.c_str());   
    DIR *D = opendir(Dir.c_str());   
    if (D == 0)
    if (D == 0)
       return _error->Errno("opendir","Unable to read %s",Dir.c_str());
       return _error->Errno("opendir","Unable to read %s",Dir.c_str());
@@ -84,7 +87,8 @@ bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
 	    for (pkgCache::VerFileIterator J = V.FileList(); 
 	    for (pkgCache::VerFileIterator J = V.FileList(); 
 		 J.end() == false; J++)
 		 J.end() == false; J++)
 	    {
 	    {
-	       if ((J.File()->Flags & pkgCache::Flag::NotSource) != 0)
+	       if (CleanInstalled == true &&
+		   (J.File()->Flags & pkgCache::Flag::NotSource) != 0)
 		  continue;
 		  continue;
 	       IsFetchable = true;
 	       IsFetchable = true;
 	       break;
 	       break;

+ 2 - 1
debian/changelog

@@ -5,8 +5,9 @@ apt (0.3.13.1) unstable; urgency=low
   * Make unparsable priorities non-fatal Closes: #46266, #46267, #46293, #46298  
   * Make unparsable priorities non-fatal Closes: #46266, #46267, #46293, #46298  
   * Fix handling of '/' for the dist name. Closes: #43830, #45640, #45692
   * Fix handling of '/' for the dist name. Closes: #43830, #45640, #45692
   * Fixed 'Method gave a blank filename' error from IMS queries onto CDs.
   * Fixed 'Method gave a blank filename' error from IMS queries onto CDs.
-    Closes: #45034, #45695
+    Closes: #45034, #45695, #46537
   * Made OR group handling in the problem resolver more elaborate. Closes: #45646
   * Made OR group handling in the problem resolver more elaborate. Closes: #45646
+  * Added APT::Clean-Installed option. Closes: #45973
   
   
  -- Jason Gunthorpe <jgg@debian.org>  Fri,  3 Sep 1999 09:04:28 -0700
  -- Jason Gunthorpe <jgg@debian.org>  Fri,  3 Sep 1999 09:04:28 -0700
  
  

+ 6 - 0
doc/apt.conf.5.yo

@@ -55,6 +55,12 @@ dit(bf(Ignore-Hold))
 Ignore Held packages; This global options causes the problem resolver to
 Ignore Held packages; This global options causes the problem resolver to
 ignore held packages in its decision making. 
 ignore held packages in its decision making. 
 
 
+dit(bf(Clean-Installed))
+Defaults to on. When turned on the autoclean feature will remove any pacakge
+which can no longer be downloaded from the cache. If turned off then
+packages that are locally installed are also excluded from cleaning - but
+note that APT provides no direct means to reinstall them.
+
 dit(bf(Immediate-Configure))
 dit(bf(Immediate-Configure))
 Disable Immedate Configuration; This dangerous option disables some
 Disable Immedate Configuration; This dangerous option disables some
 of APT's ordering code to cause it to make fewer dpkg calls. Doing
 of APT's ordering code to cause it to make fewer dpkg calls. Doing

+ 7 - 1
doc/examples/apt.conf

@@ -1,4 +1,4 @@
-// $Id: apt.conf,v 1.37 1999/08/28 03:22:45 jgg Exp $
+// $Id: apt.conf,v 1.38 1999/10/03 21:09:27 jgg Exp $
 /* This file is an index of all APT configuration directives. It should
 /* This file is an index of all APT configuration directives. It should
    NOT actually be used as a real config file, though it is a completely
    NOT actually be used as a real config file, though it is a completely
    valid file.
    valid file.
@@ -53,6 +53,7 @@ APT
 
 
   // Some general options
   // Some general options
   Ignore-Hold "false";
   Ignore-Hold "false";
+  Clean-Installed "true";
   Immediate-Configure "true";      // DO NOT turn this off, see the man page
   Immediate-Configure "true";      // DO NOT turn this off, see the man page
   Force-LoopBreak "false";         // DO NOT turn this on, see the man page
   Force-LoopBreak "false";         // DO NOT turn this on, see the man page
 };
 };
@@ -192,5 +193,10 @@ Debug
   pkgInitialize "false";   // This one will dump the configuration space
   pkgInitialize "false";   // This one will dump the configuration space
   NoLocking "false";
   NoLocking "false";
   Acquire::Ftp "false";    // Show ftp command traffic
   Acquire::Ftp "false";    // Show ftp command traffic
+  Acquire::Http "false";   // Show http command traffic
   aptcdrom "false";        // Show found package files
   aptcdrom "false";        // Show found package files
 }
 }
+
+/* Whatever you do, do not use this configuration file!! Take out ONLY
+   the portions you need */
+ThisIsNotAValidConfigFile

+ 6 - 2
methods/http.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: http.cc,v 1.37 1999/08/03 06:08:23 jgg Exp $
+// $Id: http.cc,v 1.38 1999/10/03 21:09:27 jgg Exp $
 /* ######################################################################
 /* ######################################################################
 
 
    HTTP Aquire Method - This is the HTTP aquire method for APT.
    HTTP Aquire Method - This is the HTTP aquire method for APT.
@@ -54,6 +54,7 @@ int HttpMethod::FailFd = -1;
 time_t HttpMethod::FailTime = 0;
 time_t HttpMethod::FailTime = 0;
 unsigned long PipelineDepth = 10;
 unsigned long PipelineDepth = 10;
 unsigned long TimeOut = 120;
 unsigned long TimeOut = 120;
+bool Debug = false;
 
 
 // CircleBuf::CircleBuf - Circular input buffer				/*{{{*/
 // CircleBuf::CircleBuf - Circular input buffer				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
@@ -631,7 +632,9 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
           Base64Encode(Proxy.User + ":" + Proxy.Password) + "\r\n";
           Base64Encode(Proxy.User + ":" + Proxy.Password) + "\r\n";
 
 
    Req += "User-Agent: Debian APT-HTTP/1.2\r\n\r\n";
    Req += "User-Agent: Debian APT-HTTP/1.2\r\n\r\n";
-//   cerr << Req << endl;
+   
+   if (Debug == true)
+      cerr << Req << endl;
 
 
    Out.Read(Req);
    Out.Read(Req);
 }
 }
@@ -939,6 +942,7 @@ bool HttpMethod::Configuration(string Message)
    TimeOut = _config->FindI("Acquire::http::Timeout",TimeOut);
    TimeOut = _config->FindI("Acquire::http::Timeout",TimeOut);
    PipelineDepth = _config->FindI("Acquire::http::Pipeline-Depth",
    PipelineDepth = _config->FindI("Acquire::http::Pipeline-Depth",
 				  PipelineDepth);
 				  PipelineDepth);
+   Debug = _config->FindB("Debug::Acquire::http",false);
    
    
    return true;
    return true;
 }
 }