Explorar o código

* fixed apt-pkg/acquire-item.h (looks like the last commit didn't include it?)

Michael Vogt %!s(int64=21) %!d(string=hai) anos
pai
achega
002d99439f
Modificáronse 2 ficheiros con 38 adicións e 36 borrados
  1. 26 27
      apt-pkg/acquire-item.cc
  2. 12 9
      apt-pkg/acquire-item.h

+ 26 - 27
apt-pkg/acquire-item.cc

@@ -220,6 +220,10 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile)
    if(TF.Step(Tags) == true)
    {
       string local_sha1;
+      bool found = false;
+      DiffInfo d;
+      string size;
+
       string tmp = Tags.FindS("SHA1-Current");
       std::stringstream ss(tmp);
       ss >> ServerSha1;
@@ -232,32 +236,27 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile)
       if(local_sha1 == ServerSha1) {
 	 if(Debug)
 	    std::clog << "Package file is up-to-date" << std::endl;
-	 new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc,
-			      ExpectedMD5, available_patches);
-	 Complete = false;
-	 Status = StatDone;
-	 Dequeue();
-	 return true;
-      }
-      if(Debug)
-	 std::clog << "SHA1-Current: " << ServerSha1 << std::endl;
-
-      // check the historie and see what patches we need
-      string history = Tags.FindS("SHA1-History");     
-      std::stringstream hist(history);
-      DiffInfo d;
-      string size;
-      bool found = false;
-      while(hist >> d.sha1 >> size >> d.file) {
-	 d.size = atoi(size.c_str());
-	 // read until the first match is found
-	 if(d.sha1 == local_sha1) 
-	    found=true;
-	 // from that point on, we probably need all diffs
-	 if(found) {
-	    if(Debug)
-	       std::clog << "Need to get diff: " << d.file << std::endl;
-	    available_patches.push_back(d);
+	 // set found to true, this will queue a pkgAcqIndexDiffs with
+	 // a empty availabe_patches
+	 found = true;
+      } else {
+	 if(Debug)
+	    std::clog << "SHA1-Current: " << ServerSha1 << std::endl;
+
+	 // check the historie and see what patches we need
+	 string history = Tags.FindS("SHA1-History");     
+	 std::stringstream hist(history);
+	 while(hist >> d.sha1 >> size >> d.file) {
+	    d.size = atoi(size.c_str());
+	    // read until the first match is found
+	    if(d.sha1 == local_sha1) 
+	       found=true;
+	    // from that point on, we probably need all diffs
+	    if(found) {
+	       if(Debug)
+		  std::clog << "Need to get diff: " << d.file << std::endl;
+	       available_patches.push_back(d);
+	    }
 	 }
       }
 
@@ -287,7 +286,7 @@ void pkgAcqDiffIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
       std::clog << "pkgAcqDiffIndex failed: " << Desc.URI << std::endl
 		<< "Falling back to normal index file aquire" << std::endl;
 
-   new pkgAcqIndex(Owner, RealURI, Description,Desc.ShortDesc, 
+   new pkgAcqIndex(Owner, RealURI, Description, Desc.ShortDesc, 
 		   ExpectedMD5);
 
    Complete = false;

+ 12 - 9
apt-pkg/acquire-item.h

@@ -83,11 +83,22 @@ class pkgAcquire::Item
 };
 
 // item for index diffs
+
+struct DiffInfo {
+   string file;
+   string sha1;
+   unsigned long size;
+};
+
 class pkgAcqDiffIndex : public pkgAcquire::Item
 {
  protected:
    bool Debug;
+   pkgAcquire::ItemDesc Desc;
    string RealURI;
+   string ExpectedMD5;
+   string CurrentPackagesFile;
+   string Description;
 
  public:
    // Specialized action members
@@ -102,7 +113,7 @@ class pkgAcqDiffIndex : public pkgAcquire::Item
    
    pkgAcqDiffIndex(pkgAcquire *Owner,string URI,string URIDesc,
 		   string ShortDesct, string ExpectedMD5);
-}
+};
 
 class pkgAcqIndexDiffs : public pkgAcquire::Item
 {
@@ -113,14 +124,7 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
    string ExpectedMD5;
 
    // this is the SHA-1 sum we expect after the patching
-   string ServerSha1;
-   string CurrentPackagesFile;
    string Description;
-   struct DiffInfo {
-      string file;
-      string sha1;
-      unsigned long size;
-   };
    vector<DiffInfo> available_patches;
    enum {StateFetchIndex,StateFetchDiff,StateUnzipDiff,StateApplyDiff} State;
 
@@ -131,7 +135,6 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
    virtual void Done(string Message,unsigned long Size,string Md5Hash,
 		     pkgAcquire::MethodConfig *Cnf);
    virtual string DescURI() {return RealURI + "Index";};
-   virtual string Custom600Headers();
 
    // various helpers
    bool QueueNextDiff();