]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-item.cc
failure code if package files could not be downloaded
[apt.git] / apt-pkg / acquire-item.cc
index f2fd0b8b8a406aac8ee08c9ecb1fc55ab2264881..25839f85c3990648c826465ecb4e01160826848c 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire-item.cc,v 1.29 1999/04/28 22:48:44 jgg Exp $
+// $Id: acquire-item.cc,v 1.33 1999/07/10 05:32:25 jgg Exp $
 /* ######################################################################
 
    Acquire Item - Item to acquire
@@ -97,6 +97,9 @@ void pkgAcquire::Item::Done(string Message,unsigned long Size,string)
       if (Owner->Log != 0)
         Owner->Log->Fetched(Size,atoi(LookupTag(Message,"Resume-Point","0").c_str()));
    }
+
+   if (FileSize == 0)
+      FileSize= Size;
    
    Status = StatDone;
    ErrorText = string();
@@ -320,7 +323,6 @@ void pkgAcqIndexRel::Done(string Message,unsigned long Size,string MD5)
 /* */
 void pkgAcqIndexRel::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 {
-   // This is the retry counter
    if (Cnf->LocalOnly == true || 
        StringToBool(LookupTag(Message,"Transient-Failure"),false) == false)
    {      
@@ -484,7 +486,7 @@ void pkgAcqArchive::Done(string Message,unsigned long Size,string Md5Hash)
       if (Md5Hash != MD5)
       {
         _error->Error("MD5Sum mismatch for package %s",Version.ParentPkg().Name());
-        Rename(DestFile + ".FAILED",DestFile);
+        Rename(DestFile,DestFile + ".FAILED");
         return;
       }
    }
@@ -541,6 +543,17 @@ void pkgAcqArchive::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
    }
 }
                                                                        /*}}}*/
+// AcqArchive::Finished - Fetching has finished, tidy up               /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void pkgAcqArchive::Finished()
+{
+   if (Status == pkgAcquire::Item::StatDone &&
+       Complete == true)
+      return;
+   StoreFilename = string();
+}
+                                                                       /*}}}*/
 
 // AcqFile::pkgAcqFile - Constructor                                   /*{{{*/
 // ---------------------------------------------------------------------