]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-method.cc
support compression and by-hash for .diff/Index files
[apt.git] / apt-pkg / acquire-method.cc
index 991e6780a6e71bf375e82430d51f8b73de812157..39d5e61f2acb1ab10d4009f9bad60bfa26672fa5 100644 (file)
@@ -80,9 +80,20 @@ void pkgAcqMethod::Fail(bool Transient)
 {
    string Err = "Undetermined Error";
    if (_error->empty() == false)
-      _error->PopMessage(Err);   
-   _error->Discard();
-   Fail(Err,Transient);
+   {
+      Err.clear();
+      while (_error->empty() == false)
+      {
+        std::string msg;
+        if (_error->PopMessage(msg))
+        {
+           if (Err.empty() == false)
+              Err.append("\n");
+           Err.append(msg);
+        }
+      }
+   }
+   Fail(Err, Transient);
 }
                                                                        /*}}}*/
 // AcqMethod::Fail - A fetch has failed                                        /*{{{*/
@@ -145,13 +156,13 @@ void pkgAcqMethod::URIStart(FetchResult &Res)
    std::cout << "200 URI Start\n"
             << "URI: " << Queue->Uri << "\n";
    if (Res.Size != 0)
-      std::cout << "Size: " << Res.Size << "\n";
+      std::cout << "Size: " << std::to_string(Res.Size) << "\n";
 
    if (Res.LastModified != 0)
-      std::cout << "Last-Modified: " << TimeRFC1123(Res.LastModified) << "\n";
+      std::cout << "Last-Modified: " << TimeRFC1123(Res.LastModified, true) << "\n";
 
    if (Res.ResumePoint != 0)
-      std::cout << "Resume-Point: " << Res.ResumePoint << "\n";
+      std::cout << "Resume-Point: " << std::to_string(Res.ResumePoint) << "\n";
 
    if (UsedMirror.empty() == false)
       std::cout << "UsedMirror: " << UsedMirror << "\n";
@@ -184,10 +195,10 @@ void pkgAcqMethod::URIDone(FetchResult &Res, FetchResult *Alt)
       std::cout << "Filename: " << Res.Filename << "\n";
 
    if (Res.Size != 0)
-      std::cout << "Size: " << Res.Size << "\n";
+      std::cout << "Size: " << std::to_string(Res.Size) << "\n";
 
    if (Res.LastModified != 0)
-      std::cout << "Last-Modified: " << TimeRFC1123(Res.LastModified) << "\n";
+      std::cout << "Last-Modified: " << TimeRFC1123(Res.LastModified, true) << "\n";
 
    printHashStringList(&Res.Hashes);
 
@@ -202,7 +213,7 @@ void pkgAcqMethod::URIDone(FetchResult &Res, FetchResult *Alt)
    }
 
    if (Res.ResumePoint != 0)
-      std::cout << "Resume-Point: " << Res.ResumePoint << "\n";
+      std::cout << "Resume-Point: " << std::to_string(Res.ResumePoint) << "\n";
 
    if (Res.IMSHit == true)
       std::cout << "IMS-Hit: true\n";
@@ -213,10 +224,10 @@ void pkgAcqMethod::URIDone(FetchResult &Res, FetchResult *Alt)
         std::cout << "Alt-Filename: " << Alt->Filename << "\n";
 
       if (Alt->Size != 0)
-        std::cout << "Alt-Size: " << Alt->Size << "\n";
+        std::cout << "Alt-Size: " << std::to_string(Alt->Size) << "\n";
 
       if (Alt->LastModified != 0)
-        std::cout << "Alt-Last-Modified: " << TimeRFC1123(Alt->LastModified) << "\n";
+        std::cout << "Alt-Last-Modified: " << TimeRFC1123(Alt->LastModified, true) << "\n";
 
       printHashStringList(&Alt->Hashes);
 
@@ -480,7 +491,10 @@ void pkgAcqMethod::Dequeue() {                                             /*{{{*/
                                                                        /*}}}*/
 pkgAcqMethod::~pkgAcqMethod() {}
 
-pkgAcqMethod::FetchItem::FetchItem() : d(NULL) {}
+pkgAcqMethod::FetchItem::FetchItem() :
+   Next(nullptr), DestFileFd(-1), LastModified(0), IndexFile(false),
+   FailIgnore(false), MaximumSize(0), d(nullptr)
+{}
 pkgAcqMethod::FetchItem::~FetchItem() {}
 
 pkgAcqMethod::FetchResult::~FetchResult() {}