Просмотр исходного кода

failure code if package files could not be downloaded
Author: jgg
Date: 1999-07-10 05:32:25 GMT
failure code if package files could not be downloaded

Arch Librarian лет назад: 22
Родитель
Сommit
9df71a5bdf
4 измененных файлов с 32 добавлено и 7 удалено
  1. 1 2
      apt-pkg/acquire-item.cc
  2. 22 4
      cmdline/apt-get.cc
  3. 6 0
      doc/apt-get.8.yo
  4. 3 1
      doc/examples/apt.conf

+ 1 - 2
apt-pkg/acquire-item.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: acquire-item.cc,v 1.32 1999/06/06 06:58:36 jgg Exp $
+// $Id: acquire-item.cc,v 1.33 1999/07/10 05:32:25 jgg Exp $
 /* ######################################################################
 /* ######################################################################
 
 
    Acquire Item - Item to acquire
    Acquire Item - Item to acquire
@@ -323,7 +323,6 @@ void pkgAcqIndexRel::Done(string Message,unsigned long Size,string MD5)
 /* */
 /* */
 void pkgAcqIndexRel::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 void pkgAcqIndexRel::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 {
 {
-   // This is the retry counter
    if (Cnf->LocalOnly == true || 
    if (Cnf->LocalOnly == true || 
        StringToBool(LookupTag(Message,"Transient-Failure"),false) == false)
        StringToBool(LookupTag(Message,"Transient-Failure"),false) == false)
    {      
    {      

+ 22 - 4
cmdline/apt-get.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: apt-get.cc,v 1.69 1999/07/10 04:58:42 jgg Exp $
+// $Id: apt-get.cc,v 1.70 1999/07/10 05:32:26 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    apt-get - Cover for dpkg
    apt-get - Cover for dpkg
@@ -719,16 +719,32 @@ bool DoUpdate(CommandLine &)
    if (Fetcher.Run() == pkgAcquire::Failed)
    if (Fetcher.Run() == pkgAcquire::Failed)
       return false;
       return false;
 
 
+   bool Failed = false;
+   for (pkgAcquire::Item **I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
+   {
+      if ((*I)->Status == pkgAcquire::Item::StatDone)
+	 continue;
+
+      (*I)->Finished();
+      
+      Failed = true;
+   }
+   
    // Clean out any old list files
    // Clean out any old list files
-   if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false ||
-       Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false)
-      return false;
+   if (_config->FindB("APT::Get::List-Cleanup",false) == false)
+   {
+      if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false ||
+	  Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false)
+	 return false;
+   }
    
    
    // Prepare the cache.   
    // Prepare the cache.   
    CacheFile Cache;
    CacheFile Cache;
    if (Cache.Open() == false)
    if (Cache.Open() == false)
       return false;
       return false;
    
    
+   if (Failed == true)
+      return _error->Error("Some index files failed to download, they have been ignored, or old ones used instead.");
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -1408,6 +1424,7 @@ void GetInitialize()
    _config->Set("APT::Get::Assume-Yes",false);
    _config->Set("APT::Get::Assume-Yes",false);
    _config->Set("APT::Get::Fix-Broken",false);
    _config->Set("APT::Get::Fix-Broken",false);
    _config->Set("APT::Get::Force-Yes",false);
    _config->Set("APT::Get::Force-Yes",false);
+   _config->Set("APT::Get::APT::Get::No-List-Cleanup",true);
 }
 }
 									/*}}}*/
 									/*}}}*/
 // SigWinch - Window size change signal handler				/*{{{*/
 // SigWinch - Window size change signal handler				/*{{{*/
@@ -1451,6 +1468,7 @@ int main(int argc,const char *argv[])
       {0,"force-yes","APT::Get::force-yes",0},
       {0,"force-yes","APT::Get::force-yes",0},
       {0,"print-uris","APT::Get::Print-URIs",0},
       {0,"print-uris","APT::Get::Print-URIs",0},
       {0,"purge","APT::Get::Purge",0},
       {0,"purge","APT::Get::Purge",0},
+      {0,"list-cleanup","APT::Get::List-Cleanup",0},
       {'c',"config-file",0,CommandLine::ConfigFile},
       {'c',"config-file",0,CommandLine::ConfigFile},
       {'o',"option",0,CommandLine::ArbItem},
       {'o',"option",0,CommandLine::ArbItem},
       {0,0,0,0}};
       {0,0,0,0}};

+ 6 - 0
doc/apt-get.8.yo

@@ -210,6 +210,12 @@ command See bf(APT::Get::Print-URIs).
 dit(bf(--purge))
 dit(bf(--purge))
 Use purge instead of remove for anything that would be removed.
 Use purge instead of remove for anything that would be removed.
 
 
+dit(bf(--list-cleanup))
+This option defaults to on, use bf(--no-list-cleanup) to turn it off.
+When on apt-get will automatically manage the contents of 
+/var/state/apt/lists to ensure that obsolete files are erased. The only 
+reason to turn it off is if you frequently change your source list.
+
 dit(bf(-c, --config-file))
 dit(bf(-c, --config-file))
 Configuration File; Specify a configuration file to use. bf(apt-get) will
 Configuration File; Specify a configuration file to use. bf(apt-get) will
 read the default configuration file and then this configuration file. See
 read the default configuration file and then this configuration file. See

+ 3 - 1
doc/examples/apt.conf

@@ -1,4 +1,4 @@
-// $Id: apt.conf,v 1.33 1999/05/24 03:39:37 jgg Exp $
+// $Id: apt.conf,v 1.34 1999/07/10 05:32:26 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.
@@ -34,6 +34,8 @@ APT
      Print-URIs "false";
      Print-URIs "false";
      Compile "false";
      Compile "false";
      No-Download "false";
      No-Download "false";
+     Purge "false";
+     List-Cleanup "true";
   };
   };
 
 
   Cache 
   Cache