From: Michael Vogt Date: Wed, 14 May 2014 16:04:48 +0000 (+0200) Subject: Merge remote-tracking branch 'donkult/debian/experimental' into debian/experimental X-Git-Tag: 1.1.exp1~19 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/e110d7bf5675f484c06b82f621ac98bedc464865 Merge remote-tracking branch 'donkult/debian/experimental' into debian/experimental Conflicts: apt-pkg/acquire-item.cc apt-pkg/acquire-item.h --- e110d7bf5675f484c06b82f621ac98bedc464865 diff --cc apt-pkg/acquire-item.cc index b3d67de2c,ce19e5486..99013d649 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@@ -343,10 -354,11 +354,10 @@@ bool pkgAcqSubIndex::ParseIndex(string * the original packages file */ pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire *Owner, - IndexTarget const *Target, - HashString ExpectedHash, - IndexTarget const * const Target, - HashStringList const &ExpectedHashes, - indexRecords *MetaIndexParser) - : Item(Owner, ExpectedHashes), Target(Target), - MetaIndexParser(MetaIndexParser) ++ IndexTarget const * const Target, ++ HashStringList const &ExpectedHashes, + indexRecords *MetaIndexParser) - : pkgAcqBaseIndex(Owner, Target, ExpectedHash, MetaIndexParser) ++ : pkgAcqBaseIndex(Owner, Target, ExpectedHashes, MetaIndexParser) { Debug = _config->FindB("Debug::pkgAcquire::Diffs",false); @@@ -444,8 -456,8 +455,8 @@@ bool pkgAcqDiffIndex::ParseDiffIndex(st std::clog << "Package file is up-to-date" << std::endl; // list cleanup needs to know that this file as well as the already // present index is ours, so we create an empty diff to save it for us - new pkgAcqIndexDiffs(Owner, Target, ExpectedHash, MetaIndexParser, - new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc, - ExpectedHashes, ServerSha1, available_patches); ++ new pkgAcqIndexDiffs(Owner, Target, ExpectedHashes, MetaIndexParser, + ServerSha1, available_patches); return true; } else @@@ -530,19 -542,14 +541,19 @@@ } if (pdiff_merge == false) - new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc, - ExpectedHashes, ServerSha1, available_patches); - else + { - new pkgAcqIndexDiffs(Owner, Target, ExpectedHash, MetaIndexParser, ++ new pkgAcqIndexDiffs(Owner, Target, ExpectedHashes, MetaIndexParser, + ServerSha1, available_patches); + } + else { std::vector *diffs = new std::vector(available_patches.size()); for(size_t i = 0; i < available_patches.size(); ++i) - (*diffs)[i] = new pkgAcqIndexMergeDiffs(Owner, RealURI, Description, Desc.ShortDesc, ExpectedHashes, - available_patches[i], diffs); + (*diffs)[i] = new pkgAcqIndexMergeDiffs(Owner, Target, - ExpectedHash, ++ ExpectedHashes, + MetaIndexParser, + available_patches[i], + diffs); } Complete = false; @@@ -609,12 -616,11 +620,12 @@@ void pkgAcqDiffIndex::Done(string Messa * for each diff and the index */ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner, - string URI,string URIDesc,string ShortDesc, - HashStringList const &ExpectedHashes, + struct IndexTarget const * const Target, - HashString ExpectedHash, ++ HashStringList const &ExpectedHashes, + indexRecords *MetaIndexParser, string ServerSha1, vector diffs) - : pkgAcqBaseIndex(Owner, Target, ExpectedHash, MetaIndexParser), - : Item(Owner, ExpectedHashes), RealURI(URI), ++ : pkgAcqBaseIndex(Owner, Target, ExpectedHashes, MetaIndexParser), available_patches(diffs), ServerSha1(ServerSha1) { @@@ -646,7 -651,7 +657,7 @@@ void pkgAcqIndexDiffs::Failed(string Me if(Debug) std::clog << "pkgAcqIndexDiffs failed: " << Desc.URI << " with " << Message << std::endl << "Falling back to normal index file acquire" << std::endl; - new pkgAcqIndex(Owner, Target, ExpectedHash, MetaIndexParser); - new pkgAcqIndex(Owner, RealURI, Description,Desc.ShortDesc, HashSums()); ++ new pkgAcqIndex(Owner, Target, ExpectedHashes, MetaIndexParser); Finish(); } /*}}}*/ @@@ -786,9 -791,8 +797,9 @@@ void pkgAcqIndexDiffs::Done(string Mess // see if there is more to download if(available_patches.empty() == false) { - new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc, - HashSums(), ServerSha1, available_patches); + new pkgAcqIndexDiffs(Owner, Target, - ExpectedHash, MetaIndexParser, ++ ExpectedHashes, MetaIndexParser, + ServerSha1, available_patches); return Finish(); } else return Finish(true); @@@ -797,13 -801,12 +808,13 @@@ /*}}}*/ // AcqIndexMergeDiffs::AcqIndexMergeDiffs - Constructor /*{{{*/ pkgAcqIndexMergeDiffs::pkgAcqIndexMergeDiffs(pkgAcquire *Owner, - string const &URI, string const &URIDesc, - string const &ShortDesc, HashStringList const &ExpectedHashes, - DiffInfo const &patch, - std::vector const * const allPatches) - : Item(Owner, ExpectedHashes), RealURI(URI), - patch(patch),allPatches(allPatches), State(StateFetchDiff) + struct IndexTarget const * const Target, - HashString ExpectedHash, ++ HashStringList const &ExpectedHashes, + indexRecords *MetaIndexParser, + DiffInfo const &patch, + std::vector const * const allPatches) - : pkgAcqBaseIndex(Owner, Target, ExpectedHash, MetaIndexParser), ++ : pkgAcqBaseIndex(Owner, Target, ExpectedHashes, MetaIndexParser), + patch(patch), allPatches(allPatches), State(StateFetchDiff) { DestFile = _config->FindDir("Dir::State::lists") + "partial/"; @@@ -845,10 -847,11 +856,10 @@@ void pkgAcqIndexMergeDiffs::Failed(stri // first failure means we should fallback State = StateErrorDiff; std::clog << "Falling back to normal index file acquire" << std::endl; - new pkgAcqIndex(Owner, Target, ExpectedHash, MetaIndexParser); - new pkgAcqIndex(Owner, RealURI, Description,Desc.ShortDesc, - ExpectedHashes); ++ new pkgAcqIndex(Owner, Target, ExpectedHashes, MetaIndexParser); } /*}}}*/ - void pkgAcqIndexMergeDiffs::Done(string Message,unsigned long long Size,string Md5Hash, /*{{{*/ + void pkgAcqIndexMergeDiffs::Done(string Message,unsigned long long Size,HashStringList const &Hashes, /*{{{*/ pkgAcquire::MethodConfig *Cnf) { if(Debug) @@@ -927,8 -930,9 +938,8 @@@ instantiated to fetch the revision file */ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner, string URI,string URIDesc,string ShortDesc, - HashString ExpectedHash, string comprExt) - HashStringList const &ExpectedHashes, string comprExt) - : Item(Owner, ExpectedHashes), RealURI(URI), Target(0), - MetaIndexParser(0) ++ HashStringList const &ExpectedHash, string comprExt) + : pkgAcqBaseIndex(Owner, NULL, ExpectedHash, NULL), RealURI(URI) { if(comprExt.empty() == true) { @@@ -945,10 -949,9 +956,11 @@@ Init(URI, URIDesc, ShortDesc); } -pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner, IndexTarget const * const Target, - HashStringList const &ExpectedHashes, indexRecords *MetaIndexParser) - : Item(Owner, ExpectedHashes), RealURI(Target->URI) +pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner, IndexTarget const *Target, - HashString const &ExpectedHash, indexRecords *MetaIndexParser) ++ HashStringList const &ExpectedHash, ++ indexRecords *MetaIndexParser) + : pkgAcqBaseIndex(Owner, Target, ExpectedHash, MetaIndexParser), + RealURI(Target->URI) { // autoselect the compression method std::vector types = APT::Configuration::getCompressionTypes(); diff --cc apt-pkg/acquire-item.h index 35cd78afc,d054b96af..3d863874c --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@@ -361,34 -360,10 +360,31 @@@ class pkgAcqSubIndex : public pkgAcquir * * \param ShortDesc A short description of the list file to download. * - * \param ExpectedHash The list file's MD5 signature. + * \param ExpectedHashes The list file's hashsums which are expected. */ pkgAcqSubIndex(pkgAcquire *Owner, std::string const &URI,std::string const &URIDesc, - std::string const &ShortDesc, HashString const &ExpectedHash); + std::string const &ShortDesc, HashStringList const &ExpectedHashes); +}; + /*}}}*/ + +/** \brief Common base class for all classes that deal with fetching {{{ + indexes + */ +class pkgAcqBaseIndex : public pkgAcquire::Item +{ + protected: + /** \brief Pointer to the IndexTarget data + */ + const struct IndexTarget * Target; + indexRecords *MetaIndexParser; + - /** \brief The Hash that this file should have after download - */ - HashString ExpectedHash; - + pkgAcqBaseIndex(pkgAcquire *Owner, + struct IndexTarget const * const Target, - HashString ExpectedHash, ++ HashStringList const &ExpectedHashes, + indexRecords *MetaIndexParser) - : Item(Owner), Target(Target), MetaIndexParser(MetaIndexParser), - ExpectedHash(ExpectedHash) {}; ++ : Item(Owner, ExpectedHashes), Target(Target), ++ MetaIndexParser(MetaIndexParser) {}; ++ }; /*}}}*/ /** \brief An item that is responsible for fetching an index file of {{{ @@@ -551,12 -522,9 +538,12 @@@ class pkgAcqIndexMergeDiffs : public pk * \param allPatches contains all related items so that each item can * check if it was the last one to complete the download step */ - pkgAcqIndexMergeDiffs(pkgAcquire *Owner,std::string const &URI,std::string const &URIDesc, - std::string const &ShortDesc, HashStringList const &ExpectedHashes, - DiffInfo const &patch, std::vector const * const allPatches); + pkgAcqIndexMergeDiffs(pkgAcquire *Owner, + struct IndexTarget const * const Target, - HashString ExpectedHash, ++ HashStringList const &ExpectedHash, + indexRecords *MetaIndexParser, + DiffInfo const &patch, + std::vector const * const allPatches); }; /*}}}*/ /** \brief An item that is responsible for fetching server-merge patches {{{ @@@ -684,10 -647,8 +666,10 @@@ class pkgAcqIndexDiffs : public pkgAcqB * should be ordered so that each diff appears before any diff * that depends on it. */ - pkgAcqIndexDiffs(pkgAcquire *Owner,std::string URI,std::string URIDesc, - std::string ShortDesc, HashStringList const &ExpectedHashes, + pkgAcqIndexDiffs(pkgAcquire *Owner, + struct IndexTarget const * const Target, - HashString ExpectedHash, ++ HashStringList const &ExpectedHash, + indexRecords *MetaIndexParser, std::string ServerSha1, std::vector diffs=std::vector()); }; @@@ -766,14 -726,11 +742,14 @@@ class pkgAcqIndex : public pkgAcqBaseIn * fallback is ".gz" or none. */ pkgAcqIndex(pkgAcquire *Owner,std::string URI,std::string URIDesc, - std::string ShortDesc, HashString ExpectedHash, + std::string ShortDesc, HashStringList const &ExpectedHashes, std::string compressExt=""); - pkgAcqIndex(pkgAcquire *Owner, IndexTarget const * const Target, - HashStringList const &ExpectedHashes, indexRecords *MetaIndexParser); - void Init(std::string const &URI, std::string const &URIDesc, std::string const &ShortDesc); + pkgAcqIndex(pkgAcquire *Owner, + struct IndexTarget const * const Target, - HashString const &ExpectedHash, ++ HashStringList const &ExpectedHash, + indexRecords *MetaIndexParser); + void Init(std::string const &URI, std::string const &URIDesc, + std::string const &ShortDesc); }; /*}}}*/ /** \brief An acquire item that is responsible for fetching a {{{