X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/c8a4ce6cbed57ae108dc955d4a850f9b129a0693..769e06cf07625f4a2f5c84340ef6af697d7b0894:/apt-pkg/acquire-item.h diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index df1380b5e..26e1a1922 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -31,10 +31,8 @@ #include #ifndef APT_8_CLEANER_HEADERS -#include #include #include -#include #endif /** \addtogroup acquire @@ -43,10 +41,11 @@ * \file acquire-item.h */ -class indexRecords; class pkgRecords; class pkgSourceList; -class pkgAcqMetaBase; +class pkgAcqMetaClearSig; +class pkgAcqIndexMergeDiffs; +class metaIndex; class pkgAcquire::Item : public WeakPointable /*{{{*/ /** \brief Represents the process by which a pkgAcquire object should @@ -106,7 +105,7 @@ class pkgAcquire::Item : public WeakPointable /*{{{*/ /** \brief If not \b NULL, contains the name of a subprocess that * is operating on this object (for instance, "gzip" or "gpgv"). */ - APT_DEPRECATED const char *Mode; + APT_DEPRECATED_MSG("Use the std::string member ActiveSubprocess instead") const char *Mode; /** \brief contains the name of the subprocess that is operating on this object * (for instance, "gzip", "rred" or "gpgv"). This is obsoleting #Mode from above @@ -177,6 +176,28 @@ class pkgAcquire::Item : public WeakPointable /*{{{*/ */ virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf); + /** \brief Invoked by the acquire worker to check if the successfully + * fetched object is also the objected we wanted to have. + * + * Note that the object might \e not have been written to + * DestFile; check for the presence of an Alt-Filename entry in + * Message to find the file to which it was really written. + * + * This is called before Done is called and can prevent it by returning + * \b false which will result in Failed being called instead. + * + * You should prefer to use this method over calling Failed() from Done() + * as this has e.g. the wrong progress reporting. + * + * \param Message Data from the acquire method. Use LookupTag() + * to parse it. + * \param Cnf The method via which the object was fetched. + * + * \sa pkgAcqMethod + */ + virtual bool VerifyDone(std::string const &Message, + pkgAcquire::MethodConfig const * const Cnf); + /** \brief Invoked by the acquire worker when the object was * fetched successfully. * @@ -260,7 +281,7 @@ class pkgAcquire::Item : public WeakPointable /*{{{*/ * * \param FailCode A short failure string that is send */ - void ReportMirrorFailure(std::string const &FailCode); + APT_DEPRECATED_MSG("Item::Failed does this for you") void ReportMirrorFailure(std::string const &FailCode); /** \brief Set the name of the current active subprocess * @@ -276,13 +297,17 @@ class pkgAcquire::Item : public WeakPointable /*{{{*/ * * \param Owner The new owner of this item. */ - Item(pkgAcquire * const Owner); + explicit Item(pkgAcquire * const Owner); /** \brief Remove this item from its owner's queue by invoking * pkgAcquire::Remove. */ virtual ~Item(); + bool APT_HIDDEN IsRedirectionLoop(std::string const &NewURI); + /** \brief The priority of the item, used for queuing */ + int APT_HIDDEN Priority(); + protected: /** \brief The acquire object with which this item is associated. */ pkgAcquire * const Owner; @@ -336,78 +361,62 @@ class pkgAcquire::Item : public WeakPointable /*{{{*/ virtual std::string GetFinalFilename() const; private: - void *d; + class Private; + Private * const d; friend class pkgAcqMetaBase; + friend class pkgAcqMetaClearSig; }; /*}}}*/ class APT_HIDDEN pkgAcqTransactionItem: public pkgAcquire::Item /*{{{*/ /** \brief baseclass for the indexes files to manage them all together */ { - void *d; + void * const d; protected: - IndexTarget const Target; - HashStringList GetExpectedHashesFor(std::string const MetaKey) const; + HashStringList GetExpectedHashesFor(std::string const &MetaKey) const; - bool QueueURI(pkgAcquire::ItemDesc &Item); + bool QueueURI(pkgAcquire::ItemDesc &Item) APT_OVERRIDE; public: + IndexTarget const Target; + /** \brief storge name until a transaction is finished */ std::string PartialFile; /** \brief TransactionManager */ - pkgAcqMetaBase * const TransactionManager; + pkgAcqMetaClearSig * const TransactionManager; enum TransactionStates { + TransactionStarted, TransactionCommit, TransactionAbort, }; virtual bool TransactionState(TransactionStates const state); - virtual std::string DescURI() const { return Target.URI; } - virtual HashStringList GetExpectedHashes() const; + virtual std::string DescURI() const APT_OVERRIDE { return Target.URI; } + virtual HashStringList GetExpectedHashes() const APT_OVERRIDE; virtual std::string GetMetaKey() const; - virtual bool HashesRequired() const; + virtual bool HashesRequired() const APT_OVERRIDE; - pkgAcqTransactionItem(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager, IndexTarget const Target); + pkgAcqTransactionItem(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, IndexTarget const &Target) APT_NONNULL(2, 3); virtual ~pkgAcqTransactionItem(); friend class pkgAcqMetaBase; + friend class pkgAcqMetaClearSig; }; /*}}}*/ class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem /*{{{*/ /** \brief the manager of a transaction */ { - void *d; + void * const d; protected: std::vector Transaction; - public: - /** \brief A package-system-specific parser for the meta-index file. */ - indexRecords *MetaIndexParser; - indexRecords *LastMetaIndexParser; - protected: - - /** \brief The index files which should be looked up in the meta-index - * and then downloaded. - */ - std::vector const IndexTargets; - /** \brief If \b true, the index's signature is currently being verified. */ bool AuthPass; - /** \brief Starts downloading the individual index files. - * - * \param verify If \b true, only indices whose expected hashsum - * can be determined from the meta-index will be downloaded, and - * the hashsums of indices will be checked (reporting - * #StatAuthError if there is a mismatch). If verify is \b false, - * no hashsum checking will be performed. - */ - void QueueIndexes(bool const verify); - /** \brief Called when a file is finished being retrieved. * * If the file was not downloaded to DestFile, a copy process is @@ -422,7 +431,7 @@ class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem /*{{{*/ /** \brief Queue the downloaded Signature for verification */ void QueueForSignatureVerify(pkgAcqTransactionItem * const I, std::string const &File, std::string const &Signature); - virtual std::string Custom600Headers() const; + virtual std::string Custom600Headers() const APT_OVERRIDE; /** \brief Called when authentication succeeded. * @@ -445,15 +454,17 @@ class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem /*{{{*/ */ bool VerifyVendor(std::string const &Message); - virtual bool TransactionState(TransactionStates const state); + virtual bool TransactionState(TransactionStates const state) APT_OVERRIDE; public: // This refers more to the Transaction-Manager than the actual file bool IMSHit; + TransactionStates State; + std::string BaseURI; - virtual bool QueueURI(pkgAcquire::ItemDesc &Item); - virtual HashStringList GetExpectedHashes() const; - virtual bool HashesRequired() const; + virtual bool QueueURI(pkgAcquire::ItemDesc &Item) APT_OVERRIDE; + virtual HashStringList GetExpectedHashes() const APT_OVERRIDE; + virtual bool HashesRequired() const APT_OVERRIDE; // transaction code void Add(pkgAcqTransactionItem * const I); @@ -471,12 +482,10 @@ class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem /*{{{*/ void TransactionStageRemoval(pkgAcqTransactionItem * const I, const std::string &FinalFile); /** \brief Get the full pathname of the final file for the current URI */ - virtual std::string GetFinalFilename() const; + virtual std::string GetFinalFilename() const APT_OVERRIDE; - pkgAcqMetaBase(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager, - std::vector const IndexTargets, - IndexTarget const &DataTarget, - indexRecords* const MetaIndexParser); + pkgAcqMetaBase(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, + IndexTarget const &DataTarget) APT_NONNULL(2, 3); virtual ~pkgAcqMetaBase(); }; /*}}}*/ @@ -492,7 +501,7 @@ class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem /*{{{*/ */ class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase { - void *d; + void * const d; protected: IndexTarget const DetachedSigTarget; @@ -500,18 +509,16 @@ class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase void Init(std::string const &URIDesc, std::string const &ShortDesc); public: - virtual std::string DescURI() const; + virtual std::string DescURI() const APT_OVERRIDE; // Specialized action members - virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf); + virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; virtual void Done(std::string const &Message, HashStringList const &Hashes, - pkgAcquire::MethodConfig const * const Cnf); - virtual void Finished(); + pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; /** \brief Create a new pkgAcqMetaIndex. */ - pkgAcqMetaIndex(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager, - IndexTarget const &DataTarget, IndexTarget const &DetachedSigTarget, - std::vector const IndexTargets, indexRecords * const MetaIndexParser); + pkgAcqMetaIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, + IndexTarget const &DataTarget, IndexTarget const &DetachedSigTarget) APT_NONNULL(2, 3); virtual ~pkgAcqMetaIndex(); friend class pkgAcqMetaSig; @@ -527,7 +534,7 @@ class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase */ class APT_HIDDEN pkgAcqMetaSig : public pkgAcqTransactionItem { - void *d; + void * const d; pkgAcqMetaIndex * const MetaIndex; @@ -537,61 +544,148 @@ class APT_HIDDEN pkgAcqMetaSig : public pkgAcqTransactionItem protected: /** \brief Get the full pathname of the final file for the current URI */ - virtual std::string GetFinalFilename() const; + virtual std::string GetFinalFilename() const APT_OVERRIDE; public: - virtual bool HashesRequired() const { return false; } + virtual bool HashesRequired() const APT_OVERRIDE { return false; } // Specialized action members - virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf); + virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; virtual void Done(std::string const &Message, HashStringList const &Hashes, - pkgAcquire::MethodConfig const * const Cnf); + pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; + virtual std::string Custom600Headers() const APT_OVERRIDE; /** \brief Create a new pkgAcqMetaSig. */ - pkgAcqMetaSig(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager, IndexTarget const Target, - pkgAcqMetaIndex * const MetaIndex); + pkgAcqMetaSig(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, + IndexTarget const &Target, pkgAcqMetaIndex * const MetaIndex) APT_NONNULL(2, 3, 5); virtual ~pkgAcqMetaSig(); }; /*}}}*/ /** \brief An item repsonsible for downloading clearsigned metaindexes {{{*/ class APT_HIDDEN pkgAcqMetaClearSig : public pkgAcqMetaIndex { - void *d; - - IndexTarget const ClearsignedTarget; + void * const d; IndexTarget const DetachedDataTarget; - IndexTarget const DetachedSigTarget; -public: - virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf); - virtual std::string Custom600Headers() const; + public: + /** \brief A package-system-specific parser for the meta-index file. */ + metaIndex *MetaIndexParser; + metaIndex *LastMetaIndexParser; + + virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; + virtual std::string Custom600Headers() const APT_OVERRIDE; + virtual bool VerifyDone(std::string const &Message, pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; virtual void Done(std::string const &Message, HashStringList const &Hashes, - pkgAcquire::MethodConfig const * const Cnf); + pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; + virtual void Finished() APT_OVERRIDE; + + /** \brief Starts downloading the individual index files. + * + * \param verify If \b true, only indices whose expected hashsum + * can be determined from the meta-index will be downloaded, and + * the hashsums of indices will be checked (reporting + * #StatAuthError if there is a mismatch). If verify is \b false, + * no hashsum checking will be performed. + */ + void QueueIndexes(bool const verify); /** \brief Create a new pkgAcqMetaClearSig. */ pkgAcqMetaClearSig(pkgAcquire * const Owner, IndexTarget const &ClearsignedTarget, IndexTarget const &DetachedDataTarget, IndexTarget const &DetachedSigTarget, - std::vector const IndexTargets, - indexRecords * const MetaIndexParser); + metaIndex * const MetaIndexParser); virtual ~pkgAcqMetaClearSig(); }; /*}}}*/ /** \brief Common base class for all classes that deal with fetching indexes {{{*/ class APT_HIDDEN pkgAcqBaseIndex : public pkgAcqTransactionItem { - void *d; + void * const d; public: /** \brief Get the full pathname of the final file for the current URI */ - virtual std::string GetFinalFilename() const; + virtual std::string GetFinalFilename() const APT_OVERRIDE; + virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; - pkgAcqBaseIndex(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager, - IndexTarget const Target); + pkgAcqBaseIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, + IndexTarget const &Target) APT_NONNULL(2, 3); virtual ~pkgAcqBaseIndex(); }; /*}}}*/ +/** \brief An acquire item that is responsible for fetching an index {{{ + * file (e.g., Packages or Sources). + * + * \sa pkgAcqDiffIndex, pkgAcqIndexDiffs, pkgAcqIndexTrans + * + * \todo Why does pkgAcqIndex have protected members? + */ +class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex +{ + void * const d; + + protected: + + /** \brief The stages the method goes through + * + * The method first downloads the indexfile, then its decompressed (or + * copied) and verified + */ + enum AllStages { + STAGE_DOWNLOAD, + STAGE_DECOMPRESS_AND_VERIFY, + }; + AllStages Stage; + + /** \brief Handle what needs to be done when the download is done */ + void StageDownloadDone(std::string const &Message); + + /** \brief Handle what needs to be done when the decompression/copy is + * done + */ + void StageDecompressDone(); + + /** \brief If \b set, this partially downloaded file will be + * removed when the download completes. + */ + std::string EraseFileName; + + /** \brief The compression-related file extensions that are being + * added to the downloaded file one by one if first fails (e.g., "gz bz2"). + */ + std::string CompressionExtensions; + + /** \brief The actual compression extension currently used */ + std::string CurrentCompressionExtension; + + /** \brief Do the changes needed to fetch via AptByHash (if needed) */ + void InitByHashIfNeeded(); + + /** \brief Get the full pathname of the final file for the current URI */ + virtual std::string GetFinalFilename() const APT_OVERRIDE; + + virtual bool TransactionState(TransactionStates const state) APT_OVERRIDE; + + public: + // Specialized action members + virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; + virtual void Done(std::string const &Message, HashStringList const &Hashes, + pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; + virtual std::string Custom600Headers() const APT_OVERRIDE; + virtual std::string DescURI() const APT_OVERRIDE {return Desc.URI;}; + virtual std::string GetMetaKey() const APT_OVERRIDE; + + pkgAcqIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, + IndexTarget const &Target, bool const Derived = false) APT_NONNULL(2, 3); + virtual ~pkgAcqIndex(); + + protected: + APT_HIDDEN void Init(std::string const &URI, std::string const &URIDesc, + std::string const &ShortDesc); + APT_HIDDEN bool CommonFailed(std::string const &TargetURI, std::string const TargetDesc, + std::string const &Message, pkgAcquire::MethodConfig const * const Cnf); +}; + /*}}}*/ /** \brief An item that is responsible for fetching an index file of {{{ * package list diffs and starting the package list's download. * @@ -601,9 +695,10 @@ class APT_HIDDEN pkgAcqBaseIndex : public pkgAcqTransactionItem * * \sa pkgAcqIndexDiffs, pkgAcqIndex */ -class APT_HIDDEN pkgAcqDiffIndex : public pkgAcqBaseIndex +class APT_HIDDEN pkgAcqDiffIndex : public pkgAcqIndex { - void *d; + void * const d; + std::vector * diffs; protected: /** \brief If \b true, debugging information will be written to std::clog. */ @@ -615,19 +710,18 @@ class APT_HIDDEN pkgAcqDiffIndex : public pkgAcqBaseIndex std::string Description; /** \brief Get the full pathname of the final file for the current URI */ - virtual std::string GetFinalFilename() const; + virtual std::string GetFinalFilename() const APT_OVERRIDE; - virtual bool QueueURI(pkgAcquire::ItemDesc &Item); + virtual bool QueueURI(pkgAcquire::ItemDesc &Item) APT_OVERRIDE; - virtual bool TransactionState(TransactionStates const state); + virtual bool TransactionState(TransactionStates const state) APT_OVERRIDE; public: // Specialized action members - virtual void Failed(std::string const &Message, pkgAcquire::MethodConfig const * const Cnf); + virtual void Failed(std::string const &Message, pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; virtual void Done(std::string const &Message, HashStringList const &Hashes, - pkgAcquire::MethodConfig const * const Cnf); - virtual std::string DescURI() const {return Target.URI + "Index";}; - virtual std::string Custom600Headers() const; - virtual std::string GetMetaKey() const; + pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; + virtual std::string DescURI() const APT_OVERRIDE {return Target.URI + "Index";}; + virtual std::string GetMetaKey() const APT_OVERRIDE; /** \brief Parse the Index file for a set of Packages diffs. * @@ -651,8 +745,8 @@ class APT_HIDDEN pkgAcqDiffIndex : public pkgAcqBaseIndex * * \param ShortDesc A short description of the list file to download. */ - pkgAcqDiffIndex(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager, - IndexTarget const Target); + pkgAcqDiffIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, + IndexTarget const &Target) APT_NONNULL(2, 3); virtual ~pkgAcqDiffIndex(); private: APT_HIDDEN void QueueOnIMSHit() const; @@ -685,7 +779,7 @@ struct APT_HIDDEN DiffInfo { /*{{{*/ */ class APT_HIDDEN pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex { - void *d; + void * const d; protected: @@ -725,13 +819,13 @@ class APT_HIDDEN pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex * This method will fall back to downloading the whole index file * outright; its arguments are ignored. */ - virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf); + virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; virtual void Done(std::string const &Message, HashStringList const &Hashes, - pkgAcquire::MethodConfig const * const Cnf); - virtual std::string Custom600Headers() const; - virtual std::string DescURI() const {return Target.URI + "Index";}; - virtual HashStringList GetExpectedHashes() const; - virtual bool HashesRequired() const; + pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; + virtual std::string Custom600Headers() const APT_OVERRIDE; + virtual std::string DescURI() const APT_OVERRIDE {return Target.URI + "Index";}; + virtual HashStringList GetExpectedHashes() const APT_OVERRIDE; + virtual bool HashesRequired() const APT_OVERRIDE; /** \brief Create an index merge-diff item. * @@ -750,9 +844,9 @@ class APT_HIDDEN pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex * \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 * const Owner, pkgAcqMetaBase * const TransactionManager, - IndexTarget const Target, DiffInfo const &patch, - std::vector const * const allPatches); + pkgAcqIndexMergeDiffs(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, + IndexTarget const &Target, DiffInfo const &patch, + std::vector const * const allPatches) APT_NONNULL(2, 3, 6); virtual ~pkgAcqIndexMergeDiffs(); }; /*}}}*/ @@ -769,7 +863,7 @@ class APT_HIDDEN pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex */ class APT_HIDDEN pkgAcqIndexDiffs : public pkgAcqBaseIndex { - void *d; + void * const d; private: @@ -819,10 +913,7 @@ class APT_HIDDEN pkgAcqIndexDiffs : public pkgAcqBaseIndex /** The current status of this patch. */ enum DiffState - { - /** \brief The diff is in an unknown state. */ - StateFetchUnkown, - + { /** \brief The diff is currently being fetched. */ StateFetchDiff, @@ -837,14 +928,14 @@ class APT_HIDDEN pkgAcqIndexDiffs : public pkgAcqBaseIndex * This method will fall back to downloading the whole index file * outright; its arguments are ignored. */ - virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf); + virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; virtual void Done(std::string const &Message, HashStringList const &Hashes, - pkgAcquire::MethodConfig const * const Cnf); - virtual std::string Custom600Headers() const; - virtual std::string DescURI() const {return Target.URI + "IndexDiffs";}; - virtual HashStringList GetExpectedHashes() const; - virtual bool HashesRequired() const; + pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; + virtual std::string Custom600Headers() const APT_OVERRIDE; + virtual std::string DescURI() const APT_OVERRIDE {return Target.URI + "IndexDiffs";}; + virtual HashStringList GetExpectedHashes() const APT_OVERRIDE; + virtual bool HashesRequired() const APT_OVERRIDE; /** \brief Create an index diff item. * @@ -864,93 +955,12 @@ class APT_HIDDEN pkgAcqIndexDiffs : public pkgAcqBaseIndex * should be ordered so that each diff appears before any diff * that depends on it. */ - pkgAcqIndexDiffs(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager, - IndexTarget const Target, - std::vector const &diffs=std::vector()); + pkgAcqIndexDiffs(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, + IndexTarget const &Target, + std::vector const &diffs=std::vector()) APT_NONNULL(2, 3); virtual ~pkgAcqIndexDiffs(); }; /*}}}*/ -/** \brief An acquire item that is responsible for fetching an index {{{ - * file (e.g., Packages or Sources). - * - * \sa pkgAcqDiffIndex, pkgAcqIndexDiffs, pkgAcqIndexTrans - * - * \todo Why does pkgAcqIndex have protected members? - */ -class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex -{ - void *d; - - protected: - - /** \brief The stages the method goes through - * - * The method first downloads the indexfile, then its decompressed (or - * copied) and verified - */ - enum AllStages { - STAGE_DOWNLOAD, - STAGE_DECOMPRESS_AND_VERIFY, - }; - AllStages Stage; - - /** \brief Handle what needs to be done when the download is done */ - void StageDownloadDone(std::string const &Message, - HashStringList const &Hashes, - pkgAcquire::MethodConfig const * const Cfg); - - /** \brief Handle what needs to be done when the decompression/copy is - * done - */ - void StageDecompressDone(std::string const &Message, - HashStringList const &Hashes, - pkgAcquire::MethodConfig const * const Cfg); - - /** \brief If \b set, this partially downloaded file will be - * removed when the download completes. - */ - std::string EraseFileName; - - /** \brief The compression-related file extensions that are being - * added to the downloaded file one by one if first fails (e.g., "gz bz2"). - */ - std::string CompressionExtensions; - - /** \brief The actual compression extension currently used */ - std::string CurrentCompressionExtension; - - /** \brief Do the changes needed to fetch via AptByHash (if needed) */ - void InitByHashIfNeeded(); - - /** \brief Auto select the right compression to use */ - void AutoSelectCompression(); - - /** \brief Schedule file for verification after a IMS hit */ - void ReverifyAfterIMS(); - - /** \brief Get the full pathname of the final file for the current URI */ - virtual std::string GetFinalFilename() const; - - virtual bool TransactionState(TransactionStates const state); - - public: - // Specialized action members - virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf); - virtual void Done(std::string const &Message, HashStringList const &Hashes, - pkgAcquire::MethodConfig const * const Cnf); - virtual std::string Custom600Headers() const; - virtual std::string DescURI() const {return Desc.URI;}; - virtual std::string GetMetaKey() const; - - pkgAcqIndex(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager, - IndexTarget const Target); - virtual ~pkgAcqIndex(); - - private: - APT_HIDDEN void Init(std::string const &URI, std::string const &URIDesc, - std::string const &ShortDesc); -}; - /*}}}*/ /** \brief An item that is responsible for fetching a package file. {{{ * * If the package file already exists in the cache, nothing will be @@ -958,7 +968,7 @@ class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex */ class pkgAcqArchive : public pkgAcquire::Item { - void *d; + void * const d; bool LocalSource; HashStringList ExpectedHashes; @@ -1001,19 +1011,19 @@ class pkgAcqArchive : public pkgAcquire::Item bool QueueNext(); /** \brief Get the full pathname of the final file for the current URI */ - virtual std::string GetFinalFilename() const; + virtual std::string GetFinalFilename() const APT_OVERRIDE; public: - virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf); + virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; virtual void Done(std::string const &Message, HashStringList const &Hashes, - pkgAcquire::MethodConfig const * const Cnf); - virtual std::string DescURI() const; - virtual std::string ShortDesc() const; - virtual void Finished(); - virtual bool IsTrusted() const; - virtual HashStringList GetExpectedHashes() const; - virtual bool HashesRequired() const; + pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; + virtual std::string DescURI() const APT_OVERRIDE; + virtual std::string ShortDesc() const APT_OVERRIDE; + virtual void Finished() APT_OVERRIDE; + virtual bool IsTrusted() const APT_OVERRIDE; + virtual HashStringList GetExpectedHashes() const APT_OVERRIDE; + virtual bool HashesRequired() const APT_OVERRIDE; /** \brief Create a new pkgAcqArchive. * @@ -1046,7 +1056,8 @@ class pkgAcqArchive : public pkgAcquire::Item */ class pkgAcqChangelog : public pkgAcquire::Item { - void *d; + class Private; + Private * const d; std::string TemporaryDirectory; std::string const SrcName; std::string const SrcVersion; @@ -1054,14 +1065,14 @@ class pkgAcqChangelog : public pkgAcquire::Item public: // we will never have hashes for changelogs. // If you need verified ones, download the deb and extract the changelog. - virtual HashStringList GetExpectedHashes() const { return HashStringList(); } - virtual bool HashesRequired() const { return false; } + virtual HashStringList GetExpectedHashes() const APT_OVERRIDE { return HashStringList(); } + virtual bool HashesRequired() const APT_OVERRIDE { return false; } // Specialized action members - virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf); + virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; virtual void Done(std::string const &Message, HashStringList const &CalcHashes, - pkgAcquire::MethodConfig const * const Cnf); - virtual std::string DescURI() const {return Desc.URI;}; + pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; + virtual std::string DescURI() const APT_OVERRIDE {return Desc.URI;}; /** returns the URI to the changelog of this version * @@ -1084,7 +1095,7 @@ class pkgAcqChangelog : public pkgAcquire::Item /** returns the URI to the changelog of this version * - * \param Template URI where CHANGEPATH has to be filled in + * \param Template URI where @CHANGEPATH@ has to be filled in * \param Component in which the package resides, can be empty * \param SrcName is the source package name * \param SrcVersion is the source package version @@ -1161,7 +1172,7 @@ private: */ class pkgAcqFile : public pkgAcquire::Item { - void *d; + void * const d; /** \brief How many times to retry the download, set from * Acquire::Retries. @@ -1173,15 +1184,15 @@ class pkgAcqFile : public pkgAcquire::Item HashStringList const ExpectedHashes; public: - virtual HashStringList GetExpectedHashes() const; - virtual bool HashesRequired() const; + virtual HashStringList GetExpectedHashes() const APT_OVERRIDE; + virtual bool HashesRequired() const APT_OVERRIDE; // Specialized action members - virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf); + virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; virtual void Done(std::string const &Message, HashStringList const &CalcHashes, - pkgAcquire::MethodConfig const * const Cnf); - virtual std::string DescURI() const {return Desc.URI;}; - virtual std::string Custom600Headers() const; + pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; + virtual std::string DescURI() const APT_OVERRIDE {return Desc.URI;}; + virtual std::string Custom600Headers() const APT_OVERRIDE; /** \brief Create a new pkgAcqFile object. *