diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-08-29 23:48:15 +0000 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-08-29 23:48:15 +0000 |
commit | 002d99439f800af38ee08fb89ef9651db727f36b (patch) | |
tree | db6a4d1d4a42f54c150fc65d2489babfc1b3b2a6 | |
parent | 2237bd010018aedc2c301cd9357eb5ea6affb436 (diff) |
* fixed apt-pkg/acquire-item.h (looks like the last commit didn't include it?)
-rw-r--r-- | apt-pkg/acquire-item.cc | 53 | ||||
-rw-r--r-- | apt-pkg/acquire-item.h | 21 |
2 files changed, 38 insertions, 36 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index aab8b7ed1..a1bd2336f 100644 --- a/apt-pkg/acquire-item.cc +++ b/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; diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index f9c1b5b2d..b55ac526b 100644 --- a/apt-pkg/acquire-item.h +++ b/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(); |