*/
class pkgAcquire::Item : public WeakPointable
{
+ friend class pkgAcqMetaBase;
+
void *d;
protected:
pkgAcquire *Owner;
/** \brief Insert this item into its owner's queue.
+ *
+ * The method is designed to check if the request would end
+ * in an IMSHit and if it determines that it would, it isn't
+ * queueing the Item and instead sets it to completion instantly.
*
* \param Item Metadata about this item (its URI and
* description).
+ * \return true if the item was inserted, false if IMSHit was detected
*/
- void QueueURI(ItemDesc &Item);
+ virtual bool QueueURI(ItemDesc &Item);
/** \brief Remove this item from its owner's queue. */
void Dequeue();
*/
bool Rename(std::string From,std::string To);
+ /** \brief Get the full pathname of the final file for the current URI */
+ virtual std::string GetFinalFilename() const;
+
public:
/** \brief The current status of this item. */
* line, so they should (if nonempty) have a leading newline and
* no trailing newline.
*/
+#if APT_PKG_ABI >= 413
virtual std::string Custom600Headers() const {return std::string();};
+#else
+ virtual std::string Custom600Headers() {return std::string();};
+#endif
/** \brief A "descriptive" URI-like string.
*
/** \return the acquire process with which this item is associated. */
pkgAcquire *GetOwner() const {return Owner;};
+#if APT_PKG_ABI < 413
+ pkgAcquire *GetOwner() {return Owner;};
+#endif
/** \return \b true if this object is being fetched from a trusted source. */
+#if APT_PKG_ABI >= 413
virtual bool IsTrusted() const {return false;};
+#else
+ virtual bool IsTrusted() {return false;};
+#endif
/** \brief Report mirror problem
*
InvalidFormat,
SignatureError,
NotClearsigned,
+ MaximumSizeExceeded
};
/** \brief Rename failed file and set error
};
/*}}}*/
/** \brief Information about an index patch (aka diff). */ /*{{{*/
-struct DiffInfo {
+struct APT_HIDDEN DiffInfo {
/** The filename of the diff. */
std::string file;
unsigned long long patch_size;
};
/*}}}*/
- /*}}}*/
-
-class pkgAcqMetaBase : public pkgAcquire::Item
+class pkgAcqMetaBase : public pkgAcquire::Item /*{{{*/
{
void *d;
*/
bool AuthPass;
- // required to deal gracefully with problems caused by incorrect ims hits
- bool IMSHit;
+ /** \brief The URI of the signature file. Unlike Desc.URI, this is
+ * never modified; it is used to determine the file that is being
+ * downloaded.
+ */
+ std::string RealURI;
/** \brief Starts downloading the individual index files.
*
*/
void QueueIndexes(bool verify);
-
/** \brief Called when a file is finished being retrieved.
*
* If the file was not downloaded to DestFile, a copy process is
* \param Message The message block received from the fetch
* subprocess.
*/
- bool CheckDownloadDone(const std::string &Message,
- const std::string &RealURI);
+ bool CheckDownloadDone(const std::string &Message);
/** \brief Queue the downloaded Signature for verification */
void QueueForSignatureVerify(const std::string &MetaIndexFile,
const std::string &MetaIndexFileSignature);
+#if APT_PKG_ABI >= 413
+ virtual std::string Custom600Headers() const;
+#else
+ virtual std::string Custom600Headers();
+#endif
+
/** \brief Called when authentication succeeded.
*
* Sanity-checks the authenticated file, queues up the individual
* \param Message The message block received from the fetch
* subprocess.
*/
- bool CheckAuthDone(std::string Message, const std::string &RealURI);
+ bool CheckAuthDone(std::string Message);
/** Check if the current item should fail at this point */
- bool CheckStopAuthentication(const std::string &RealURI,
- const std::string &Message);
+ bool CheckStopAuthentication(const std::string &Message);
/** \brief Check that the release file is a release file for the
* correct distribution.
*
* \return \b true if no fatal errors were encountered.
*/
- bool VerifyVendor(std::string Message, const std::string &RealURI);
-
+ bool VerifyVendor(std::string Message);
+
+ /** \brief Get the full pathname of the final file for the current URI */
+ virtual std::string GetFinalFilename() const;
+
public:
+ // This refers more to the Transaction-Manager than the actual file
+ bool IMSHit;
+
+ virtual std::string DescURI() {return RealURI; };
+ virtual bool QueueURI(pkgAcquire::ItemDesc &Item);
+
// transaction code
void Add(Item *I);
void AbortTransaction();
bool TransactionHasError() APT_PURE;
void CommitTransaction();
- /** \brief Stage (queue) a copy action when the transaction is commited
+ /** \brief Stage (queue) a copy action when the transaction is committed
*/
void TransactionStageCopy(Item *I,
const std::string &From,
const std::string &To);
- /** \brief Stage (queue) a removal action when the transaction is commited
+ /** \brief Stage (queue) a removal action when the transaction is committed
*/
void TransactionStageRemoval(Item *I, const std::string &FinalFile);
pkgAcqMetaBase(pkgAcquire *Owner,
const std::vector<IndexTarget*>* IndexTargets,
indexRecords* MetaIndexParser,
+ std::string const &RealURI,
HashStringList const &ExpectedHashes=HashStringList(),
- pkgAcqMetaBase *TransactionManager=NULL)
- : Item(Owner, ExpectedHashes, TransactionManager),
- MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets),
- AuthPass(false), IMSHit(false) {};
+ pkgAcqMetaBase *TransactionManager=NULL);
};
-
+ /*}}}*/
/** \brief An acquire item that downloads the detached signature {{{
* of a meta-index (Release) file, then queues up the release
* file itself.
*
* \sa pkgAcqMetaIndex
*/
-class pkgAcqMetaSig : public pkgAcqMetaBase
+class APT_HIDDEN pkgAcqMetaSig : public pkgAcqMetaBase
{
void *d;
protected:
- /** \brief The URI of the signature file. Unlike Desc.URI, this is
- * never modified; it is used to determine the file that is being
- * downloaded.
- */
- std::string RealURI;
-
/** \brief The file we need to verify */
std::string MetaIndexFile;
std::string ShortDesc;
public:
-
+
// Specialized action members
virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(std::string Message,unsigned long long Size,
HashStringList const &Hashes,
pkgAcquire::MethodConfig *Cnf);
- virtual std::string Custom600Headers() const;
- virtual std::string DescURI() {return RealURI; };
/** \brief Create a new pkgAcqMetaSig. */
pkgAcqMetaSig(pkgAcquire *Owner,
virtual ~pkgAcqMetaSig();
};
/*}}}*/
-
/** \brief An item that is responsible for downloading the meta-index {{{
* file (i.e., Release) itself and verifying its signature.
*
* otherwise, the expected hashsums will be "" (causing the
* authentication of the index files to be bypassed).
*/
-class pkgAcqMetaIndex : public pkgAcqMetaBase
+class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase
{
void *d;
protected:
- /** \brief The URI that is actually being downloaded; never
- * modified by pkgAcqMetaIndex.
- */
- std::string RealURI;
-
std::string URIDesc;
std::string ShortDesc;
virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,
pkgAcquire::MethodConfig *Cnf);
- virtual std::string Custom600Headers() const;
- virtual std::string DescURI() {return RealURI; };
virtual void Finished();
/** \brief Create a new pkgAcqMetaIndex. */
};
/*}}}*/
/** \brief An item repsonsible for downloading clearsigned metaindexes {{{*/
-class pkgAcqMetaClearSig : public pkgAcqMetaIndex
+class APT_HIDDEN pkgAcqMetaClearSig : public pkgAcqMetaIndex
{
void *d;
public:
virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+#if APT_PKG_ABI >= 413
virtual std::string Custom600Headers() const;
+#else
+ virtual std::string Custom600Headers();
+#endif
virtual void Done(std::string Message,unsigned long long Size,
HashStringList const &Hashes,
pkgAcquire::MethodConfig *Cnf);
virtual ~pkgAcqMetaClearSig();
};
/*}}}*/
-
-
/** \brief Common base class for all classes that deal with fetching {{{
indexes
*/
bool VerifyHashByMetaKey(HashStringList const &Hashes);
+ /** \brief Get the full pathname of the final file for the current URI */
+ virtual std::string GetFinalFilename() const;
+
pkgAcqBaseIndex(pkgAcquire *Owner,
pkgAcqMetaBase *TransactionManager,
struct IndexTarget const * const Target,
HashStringList const &ExpectedHashes,
- indexRecords *MetaIndexParser)
- : Item(Owner, ExpectedHashes, TransactionManager), Target(Target),
- MetaIndexParser(MetaIndexParser) {};
+ indexRecords *MetaIndexParser);
};
/*}}}*/
/** \brief An item that is responsible for fetching an index file of {{{
*
* \sa pkgAcqIndexDiffs, pkgAcqIndex
*/
-class pkgAcqDiffIndex : public pkgAcqBaseIndex
+class APT_HIDDEN pkgAcqDiffIndex : public pkgAcqBaseIndex
{
void *d;
*/
bool PackagesFileReadyInPartial;
+ /** \brief Get the full pathname of the final file for the current URI */
+ virtual std::string GetFinalFilename() const;
+
+ virtual bool QueueURI(pkgAcquire::ItemDesc &Item);
public:
// Specialized action members
virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,
pkgAcquire::MethodConfig *Cnf);
virtual std::string DescURI() {return RealURI + "Index";};
+#if APT_PKG_ABI >= 413
virtual std::string Custom600Headers() const;
+#else
+ virtual std::string Custom600Headers();
+#endif
/** \brief Parse the Index file for a set of Packages diffs.
*
* false otherwise.
*/
bool ParseDiffIndex(std::string IndexDiffFile);
-
/** \brief Create a new pkgAcqDiffIndex.
*
struct IndexTarget const * const Target,
HashStringList const &ExpectedHashes,
indexRecords *MetaIndexParser);
+ private:
+ APT_HIDDEN void QueueOnIMSHit() const;
};
/*}}}*/
/** \brief An item that is responsible for fetching client-merge patches {{{
*
* \sa pkgAcqDiffIndex, pkgAcqIndex
*/
-class pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex
+class APT_HIDDEN pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex
{
void *d;
*
* \sa pkgAcqDiffIndex, pkgAcqIndex
*/
-class pkgAcqIndexDiffs : public pkgAcqBaseIndex
+class APT_HIDDEN pkgAcqIndexDiffs : public pkgAcqBaseIndex
{
void *d;
*
* \todo Why does pkgAcqIndex have protected members?
*/
-class pkgAcqIndex : public pkgAcqBaseIndex
+class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex
{
void *d;
/** \brief Auto select the right compression to use */
void AutoSelectCompression();
- /** \brief Get the full pathname of the final file for the current URI
- */
- std::string GetFinalFilename() const;
-
/** \brief Schedule file for verification after a IMS hit */
void ReverifyAfterIMS();
/** \brief Validate the downloaded index file */
bool ValidateFile(const std::string &FileName);
+ /** \brief Get the full pathname of the final file for the current URI */
+ virtual std::string GetFinalFilename() const;
+
public:
-
// Specialized action members
virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(std::string Message,unsigned long long Size,
HashStringList const &Hashes,
pkgAcquire::MethodConfig *Cnf);
+#if APT_PKG_ABI >= 413
virtual std::string Custom600Headers() const;
+#else
+ virtual std::string Custom600Headers();
+#endif
virtual std::string DescURI() {return Desc.URI;};
/** \brief Create a pkgAcqIndex.
std::string const &ShortDesc);
};
/*}}}*/
-/** \brief An acquire item that is responsible for fetching a {{{
- * translated index file.
- *
- * The only difference from pkgAcqIndex is that transient failures
- * are suppressed: no error occurs if the translated index file is
- * missing.
- */
-class pkgAcqIndexTrans : public pkgAcqIndex
-{
- void *d;
-
- public:
-
- virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
- virtual std::string Custom600Headers() const;
-
- /** \brief Create a pkgAcqIndexTrans.
- *
- * \param Owner The pkgAcquire object with which this item is
- * associated.
- *
- * \param URI The URI of the index file that is to be downloaded.
- *
- * \param URIDesc A "URI-style" description of this index file.
- *
- * \param ShortDesc A brief description of this index file.
- */
- pkgAcqIndexTrans(pkgAcquire *Owner,
- std::string URI,std::string URIDesc,
- std::string ShortDesc);
- pkgAcqIndexTrans(pkgAcquire *Owner,
- pkgAcqMetaBase *TransactionManager,
- IndexTarget const * const Target,
- HashStringList const &ExpectedHashes,
- indexRecords *MetaIndexParser);
-};
- /*}}}*/
/** \brief Information about an index file. */ /*{{{*/
-class IndexTarget
+class APT_HIDDEN IndexTarget
{
void *d;
};
/*}}}*/
/** \brief Information about an optional index file. */ /*{{{*/
-class OptionalIndexTarget : public IndexTarget
+class APT_HIDDEN OptionalIndexTarget : public IndexTarget
{
void *d;
/** \brief Queue up the next available file for this version. */
bool QueueNext();
-
+
+ /** \brief Get the full pathname of the final file for the current URI */
+ virtual std::string GetFinalFilename() const;
+
public:
-
+
virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,
pkgAcquire::MethodConfig *Cnf);
virtual std::string DescURI() {return Desc.URI;};
virtual std::string ShortDesc() {return Desc.ShortDesc;};
virtual void Finished();
+#if APT_PKG_ABI >= 413
virtual bool IsTrusted() const;
-
+#else
+ virtual bool IsTrusted();
+#endif
+
/** \brief Create a new pkgAcqArchive.
*
* \param Owner The pkgAcquire object with which this item is
virtual void Done(std::string Message,unsigned long long Size, HashStringList const &CalcHashes,
pkgAcquire::MethodConfig *Cnf);
virtual std::string DescURI() {return Desc.URI;};
+#if APT_PKG_ABI >= 413
virtual std::string Custom600Headers() const;
+#else
+ virtual std::string Custom600Headers();
+#endif
/** \brief Create a new pkgAcqFile object.
*