X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/27dcb3155d74e5f66c86e18aa008ded8b2dd1367..0c6aa02ecfbb1b1ecac519527467befae36b7c40:/apt-pkg/acquire-item.h diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index af0b2d888..943c61876 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -27,6 +27,7 @@ #include #include #include +#include /** \addtogroup acquire * @{ @@ -34,7 +35,7 @@ * \file acquire-item.h */ -/** \brief Represents the process by which a pkgAcquire object should +/** \brief Represents the process by which a pkgAcquire object should {{{ * retrieve a file or a collection of files. * * By convention, Item subclasses should insert themselves into the @@ -46,7 +47,7 @@ * * \see pkgAcquire */ -class pkgAcquire::Item +class pkgAcquire::Item : public WeakPointable { protected: @@ -111,10 +112,10 @@ class pkgAcquire::Item string ErrorText; /** \brief The size of the object to fetch. */ - unsigned long FileSize; + unsigned long long FileSize; /** \brief How much of the object was already fetched. */ - unsigned long PartialSize; + unsigned long long PartialSize; /** \brief If not \b NULL, contains the name of a subprocess that * is operating on this object (for instance, "gzip" or "gpgv"). @@ -273,8 +274,8 @@ class pkgAcquire::Item */ virtual ~Item(); }; - -/** \brief Information about an index patch (aka diff). */ + /*}}}*/ +/** \brief Information about an index patch (aka diff). */ /*{{{*/ struct DiffInfo { /** The filename of the diff. */ string file; @@ -285,8 +286,8 @@ struct DiffInfo { /** The size of the diff. */ unsigned long size; }; - -/** \brief An item that is responsible for fetching an index file of + /*}}}*/ +/** \brief An item that is responsible for fetching an index file of {{{ * package list diffs and starting the package list's download. * * This item downloads the Index file and parses it, then enqueues @@ -360,8 +361,8 @@ class pkgAcqDiffIndex : public pkgAcquire::Item pkgAcqDiffIndex(pkgAcquire *Owner,string URI,string URIDesc, string ShortDesc, HashString ExpectedHash); }; - -/** \brief An item that is responsible for fetching all the patches + /*}}}*/ +/** \brief An item that is responsible for fetching all the patches {{{ * that need to be applied to a given package index file. * * After downloading and applying a single patch, this item will @@ -434,6 +435,10 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item * off the front? */ vector available_patches; + + /** Stop applying patches when reaching that sha1 */ + string ServerSha1; + /** The current status of this patch. */ enum DiffState { @@ -487,10 +492,11 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item */ pkgAcqIndexDiffs(pkgAcquire *Owner,string URI,string URIDesc, string ShortDesc, HashString ExpectedHash, + string ServerSha1, vector diffs=vector()); }; - -/** \brief An acquire item that is responsible for fetching an index + /*}}}*/ +/** \brief An acquire item that is responsible for fetching an index {{{ * file (e.g., Packages or Sources). * * \sa pkgAcqDiffIndex, pkgAcqIndexDiffs, pkgAcqIndexTrans @@ -552,14 +558,16 @@ class pkgAcqIndex : public pkgAcquire::Item * * \param compressExt The compression-related extension with which * this index file should be downloaded, or "" to autodetect - * (".bz2" is used if bzip2 is installed, ".gz" otherwise). + * Compression types can be set with config Acquire::CompressionTypes, + * default is ".lzma" or ".bz2" (if the needed binaries are present) + * fallback is ".gz" or none. */ pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc, string ShortDesc, HashString ExpectedHash, string compressExt=""); }; - -/** \brief An acquire item that is responsible for fetching a + /*}}}*/ +/** \brief An acquire item that is responsible for fetching a {{{ * translated index file. * * The only difference from pkgAcqIndex is that transient failures @@ -571,6 +579,7 @@ class pkgAcqIndexTrans : public pkgAcqIndex public: virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); + virtual string Custom600Headers(); /** \brief Create a pkgAcqIndexTrans. * @@ -582,18 +591,12 @@ class pkgAcqIndexTrans : public pkgAcqIndex * \param URIDesc A "URI-style" description of this index file. * * \param ShortDesc A brief description of this index file. - * - * \param ExpectedHash The expected hashsum of this index file. - * - * \param compressExt The compression-related extension with which - * this index file should be downloaded, or "" to autodetect - * (".bz2" is used if bzip2 is installed, ".gz" otherwise). */ pkgAcqIndexTrans(pkgAcquire *Owner,string URI,string URIDesc, string ShortDesc); }; - -/** \brief Information about an index file. */ + /*}}}*/ +/** \brief Information about an index file. */ /*{{{*/ struct IndexTarget { /** \brief A URI from which the index file can be downloaded. */ @@ -610,8 +613,8 @@ struct IndexTarget */ string MetaKey; }; - -/** \brief An acquire item that downloads the detached signature + /*}}}*/ +/** \brief An acquire item that downloads the detached signature {{{ * of a meta-index (Release) file, then queues up the release * file itself. * @@ -672,8 +675,8 @@ class pkgAcqMetaSig : public pkgAcquire::Item const vector* IndexTargets, indexRecords* MetaIndexParser); }; - -/** \brief An item that is responsible for downloading the meta-index + /*}}}*/ +/** \brief An item that is responsible for downloading the meta-index {{{ * file (i.e., Release) itself and verifying its signature. * * Once the download and verification are complete, the downloads of @@ -768,8 +771,8 @@ class pkgAcqMetaIndex : public pkgAcquire::Item const vector* IndexTargets, indexRecords* MetaIndexParser); }; - -/** \brief An item that is responsible for fetching a package file. + /*}}}*/ +/** \brief An item that is responsible for fetching a package file. {{{ * * If the package file already exists in the cache, nothing will be * done. @@ -852,8 +855,8 @@ class pkgAcqArchive : public pkgAcquire::Item pkgRecords *Recs,pkgCache::VerIterator const &Version, string &StoreFilename); }; - -/** \brief Retrieve an arbitrary file to the current directory. + /*}}}*/ +/** \brief Retrieve an arbitrary file to the current directory. {{{ * * The file is retrieved even if it is accessed via a URL type that * normally is a NOP, such as "file". If the download fails, the @@ -872,6 +875,9 @@ class pkgAcqFile : public pkgAcquire::Item */ unsigned int Retries; + /** \brief Should this file be considered a index file */ + bool IsIndexFile; + public: // Specialized action members @@ -880,6 +886,7 @@ class pkgAcqFile : public pkgAcquire::Item pkgAcquire::MethodConfig *Cnf); virtual string DescURI() {return Desc.URI;}; virtual string HashSum() {return ExpectedHash.toStr(); }; + virtual string Custom600Headers(); /** \brief Create a new pkgAcqFile object. * @@ -903,6 +910,8 @@ class pkgAcqFile : public pkgAcquire::Item * * \param DestFilename The filename+path the file is downloaded to. * + * \param IsIndexFile The file is considered a IndexFile and cache-control + * headers like "cache-control: max-age=0" are send * * If DestFilename is empty, download to DestDir/ if * DestDir is non-empty, $CWD/ otherwise. If @@ -912,9 +921,10 @@ class pkgAcqFile : public pkgAcquire::Item pkgAcqFile(pkgAcquire *Owner, string URI, string Hash, unsigned long Size, string Desc, string ShortDesc, - const string &DestDir="", const string &DestFilename=""); + const string &DestDir="", const string &DestFilename="", + bool IsIndexFile=false); }; - + /*}}}*/ /** @} */ #endif