X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/d03b947b0ce4f87d7d5cc48d4d274ab3bd0b289a..7d5234ab88b4cd6b172f13d0912c585983c3410b:/apt-pkg/acquire-item.h diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index ac4994738..8be8801bf 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -304,6 +304,10 @@ class pkgAcquire::Item : public WeakPointable /*{{{*/ */ 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; @@ -357,7 +361,8 @@ class pkgAcquire::Item : public WeakPointable /*{{{*/ virtual std::string GetFinalFilename() const; private: - void * const d; + class Private; + Private * const d; friend class pkgAcqMetaBase; friend class pkgAcqMetaClearSig; @@ -608,6 +613,79 @@ class APT_HIDDEN pkgAcqBaseIndex : public pkgAcqTransactionItem 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. * @@ -617,7 +695,7 @@ class APT_HIDDEN pkgAcqBaseIndex : public pkgAcqTransactionItem * * \sa pkgAcqIndexDiffs, pkgAcqIndex */ -class APT_HIDDEN pkgAcqDiffIndex : public pkgAcqBaseIndex +class APT_HIDDEN pkgAcqDiffIndex : public pkgAcqIndex { void * const d; std::vector * diffs; @@ -643,7 +721,6 @@ class APT_HIDDEN pkgAcqDiffIndex : public pkgAcqBaseIndex virtual void Done(std::string const &Message, HashStringList const &Hashes, pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE; virtual std::string DescURI() const APT_OVERRIDE {return Target.URI + "Index";}; - virtual std::string Custom600Headers() const APT_OVERRIDE; virtual std::string GetMetaKey() const APT_OVERRIDE; /** \brief Parse the Index file for a set of Packages diffs. @@ -702,7 +779,7 @@ struct APT_HIDDEN DiffInfo { /*{{{*/ */ class APT_HIDDEN pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex { - void * const d; + std::string const indexURI; protected: @@ -753,23 +830,19 @@ class APT_HIDDEN pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex /** \brief Create an index merge-diff item. * * \param Owner The pkgAcquire object that owns this item. - * - * \param URI The URI of the package index file being - * reconstructed. - * - * \param URIDesc A long description of this item. - * - * \param ShortDesc A brief description of this item. - * + * \param TransactionManager responsible for this item + * \param Target we intend to built via pdiff patching + * \param baseURI is the URI used for the Index, but stripped down to Target + * \param DiffInfo of the patch in question * \param patch contains infos about the patch this item is supposed * to download which were read from the index - * * \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, pkgAcqMetaClearSig * const TransactionManager, - IndexTarget const &Target, DiffInfo const &patch, - std::vector const * const allPatches) APT_NONNULL(2, 3, 6); + IndexTarget const &Target, std::string const &indexUsedMirror, + std::string const &indexURI, DiffInfo const &patch, + std::vector const * const allPatches) APT_NONNULL(2, 3, 8); virtual ~pkgAcqIndexMergeDiffs(); }; /*}}}*/ @@ -786,7 +859,7 @@ class APT_HIDDEN pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex */ class APT_HIDDEN pkgAcqIndexDiffs : public pkgAcqBaseIndex { - void * const d; + std::string const indexURI; private: @@ -866,95 +939,20 @@ class APT_HIDDEN pkgAcqIndexDiffs : public pkgAcqBaseIndex * \a diffs is empty, or QueueNextDiff() otherwise. * * \param Owner The pkgAcquire object that owns this item. - * - * \param URI The URI of the package index file being - * reconstructed. - * - * \param URIDesc A long description of this item. - * - * \param ShortDesc A brief description of this item. - * + * \param TransactionManager responsible for this item + * \param Target we want to built via pdiff patching + * \param baseURI is the URI used for the Index, but stripped down to Target * \param diffs The remaining diffs from the index of diffs. They * should be ordered so that each diff appears before any diff * that depends on it. */ pkgAcqIndexDiffs(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, IndexTarget const &Target, + std::string const &indexUsedMirror, std::string const &indexURI, 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 * 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) APT_NONNULL(2, 3); - 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