class pkgRecords;
class pkgSourceList;
class IndexTarget;
-class pkgAcqMetaIndex;
+class pkgAcqMetaBase;
/** \brief Represents the process by which a pkgAcquire object should {{{
* retrieve a file or a collection of files.
*/
class pkgAcquire::Item : public WeakPointable
{
+ void *d;
+
protected:
/** \brief The acquire object with which this item is associated. */
* \param To The new name of \a From. If \a To exists it will be
* overwritten.
*/
- void Rename(std::string From,std::string To);
+ bool Rename(std::string From,std::string To);
public:
*/
unsigned int QueueCounter;
- /** \brief TransactionID */
- unsigned long TransactionID;
+ /** \brief TransactionManager */
+ pkgAcqMetaBase *TransactionManager;
/** \brief The number of additional fetch items that are expected
* once this item is done.
* \param ExpectedHashes of the file represented by this item
*/
Item(pkgAcquire *Owner,
- HashStringList const &ExpectedHashes=HashStringList());
+ HashStringList const &ExpectedHashes=HashStringList(),
+ pkgAcqMetaBase *TransactionManager=NULL);
/** \brief Remove this item from its owner's queue by invoking
* pkgAcquire::Remove.
unsigned long size;
};
/*}}}*/
-/** \brief An item that is responsible for fetching a SubIndex {{{
- *
- * The MetaIndex file includes only records for important indexes
- * and records for these SubIndex files so these can carry records
- * for addition files like PDiffs and Translations
- */
-class pkgAcqSubIndex : public pkgAcquire::Item
+ /*}}}*/
+
+class pkgAcqMetaBase : public pkgAcquire::Item
{
+ void *d;
+
protected:
- /** \brief If \b true, debugging information will be written to std::clog. */
- bool Debug;
+ std::vector<Item*> Transaction;
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() const {return Desc.URI;};
- virtual std::string Custom600Headers() const;
- virtual bool ParseIndex(std::string const &IndexFile);
+ // transaction code
+ void Add(Item *I);
+ void AbortTransaction();
+ bool TransactionHasError() APT_PURE;
+ void CommitTransaction();
- /** \brief Create a new pkgAcqSubIndex.
- *
- * \param Owner The Acquire object that owns this item.
- *
- * \param URI The URI of the list file to download.
- *
- * \param URIDesc A long description of the list file to download.
- *
- * \param ShortDesc A short description of the list file to download.
- *
- * \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, HashStringList const &ExpectedHashes);
+ // helper for the signature warning
+ bool GenerateAuthWarning(const std::string &RealURI,
+ const std::string &Message);
+
+
+ pkgAcqMetaBase(pkgAcquire *Owner,
+ HashStringList const &ExpectedHashes=HashStringList(),
+ pkgAcqMetaBase *TransactionManager=NULL)
+ : Item(Owner, ExpectedHashes, TransactionManager) {};
};
- /*}}}*/
+
/** \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 pkgAcquire::Item
+class pkgAcqMetaIndex : public pkgAcqMetaBase
{
+ void *d;
+
protected:
/** \brief The URI that is actually being downloaded; never
* modified by pkgAcqMetaIndex.
/** \brief A brief description of the meta-index file */
std::string MetaIndexSigShortDesc;
+
+ /** \brief delayed constructor */
+ void Init(std::string URIDesc, std::string ShortDesc);
public:
/** \brief Create a new pkgAcqMetaIndex. */
pkgAcqMetaIndex(pkgAcquire *Owner,
+ pkgAcqMetaBase *TransactionManager,
std::string URI,std::string URIDesc, std::string ShortDesc,
std::string MetaIndexSigURI, std::string MetaIndexSigURIDesc, std::string MetaIndexSigShortDesc,
const std::vector<IndexTarget*>* IndexTargets,
/** \brief An item repsonsible for downloading clearsigned metaindexes {{{*/
class pkgAcqMetaClearSig : public pkgAcqMetaIndex
{
+ void *d;
+
/** \brief The URI of the meta-index file for the detached signature */
std::string MetaIndexURI;
std::string MetaSigShortDesc;
public:
- void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+ virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual std::string Custom600Headers() const;
+ virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,
+ pkgAcquire::MethodConfig *Cnf);
/** \brief Create a new pkgAcqMetaClearSig. */
pkgAcqMetaClearSig(pkgAcquire *Owner,
*/
class pkgAcqBaseIndex : public pkgAcquire::Item
{
+ void *d;
+
protected:
/** \brief Pointer to the IndexTarget data
*/
const struct IndexTarget * Target;
indexRecords *MetaIndexParser;
- pkgAcqMetaIndex *MetaOwner;
-
- pkgAcqBaseIndex(pkgAcqMetaIndex *MetaOwner,
- struct IndexTarget const * const Target,
- HashStringList const &ExpectedHashes,
- indexRecords *MetaIndexParser)
- : Item(MetaOwner->GetOwner(), ExpectedHashes), Target(Target),
- MetaIndexParser(MetaIndexParser), MetaOwner(MetaOwner) {};
+ /** \brief The MetaIndex Key */
+ std::string MetaKey;
pkgAcqBaseIndex(pkgAcquire *Owner,
+ pkgAcqMetaBase *TransactionManager,
struct IndexTarget const * const Target,
HashStringList const &ExpectedHashes,
indexRecords *MetaIndexParser)
- : Item(Owner, ExpectedHashes), Target(Target),
- MetaIndexParser(MetaIndexParser), MetaOwner(0) {};
-
+ : Item(Owner, ExpectedHashes, TransactionManager), Target(Target),
+ MetaIndexParser(MetaIndexParser) {};
};
/*}}}*/
/** \brief An item that is responsible for fetching an index file of {{{
*/
class pkgAcqDiffIndex : public pkgAcqBaseIndex
{
+ void *d;
+
protected:
/** \brief If \b true, debugging information will be written to std::clog. */
bool Debug;
*/
std::string Description;
+ /** \brief If the copy step of the packages file is done
+ */
+ bool PackagesFileReadyInPartial;
+
public:
// Specialized action members
virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
*
* \param ExpectedHashes The list file's hashsums which are expected.
*/
- pkgAcqDiffIndex(pkgAcqMetaIndex *MetaIndexOwner,
+ pkgAcqDiffIndex(pkgAcquire *Owner,
+ pkgAcqMetaBase *TransactionManager,
struct IndexTarget const * const Target,
HashStringList const &ExpectedHashes,
indexRecords *MetaIndexParser);
*/
class pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex
{
+ void *d;
+
protected:
/** \brief If \b true, debugging output will be written to
* \param allPatches contains all related items so that each item can
* check if it was the last one to complete the download step
*/
- pkgAcqIndexMergeDiffs(pkgAcqMetaIndex *MetaIndexOwner,
+ pkgAcqIndexMergeDiffs(pkgAcquire *Owner,
+ pkgAcqMetaBase *TransactionManager,
struct IndexTarget const * const Target,
HashStringList const &ExpectedHash,
indexRecords *MetaIndexParser,
*/
class pkgAcqIndexDiffs : public pkgAcqBaseIndex
{
+ void *d;
+
private:
/** \brief Queue up the next diff download.
virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,
pkgAcquire::MethodConfig *Cnf);
- virtual std::string DescURI() const {return RealURI + "Index";};
+ virtual std::string DescURI() const {return RealURI + "IndexDiffs";};
/** \brief Create an index diff item.
*
* should be ordered so that each diff appears before any diff
* that depends on it.
*/
- pkgAcqIndexDiffs(pkgAcqMetaIndex *MetaIndexOwner,
+ pkgAcqIndexDiffs(pkgAcquire *Owner,
+ pkgAcqMetaBase *TransactionManager,
struct IndexTarget const * const Target,
HashStringList const &ExpectedHash,
indexRecords *MetaIndexParser,
*/
class pkgAcqIndex : public pkgAcqBaseIndex
{
+ void *d;
+
protected:
/** \brief If \b true, the index file has been decompressed. */
*/
bool Erase;
- // Unused, used to be used to verify that "Packages: " header was there
- bool __DELME_ON_NEXT_ABI_BREAK_Verify;
-
/** \brief The object that is actually being fetched (minus any
* compression-related extensions).
*/
*/
std::string CompressionExtension;
+
/** \brief Do the changes needed to fetch via AptByHash (if needed) */
void InitByHashIfNeeded(const std::string MetaKey);
/** \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();
+
public:
// Specialized action members
* fallback is ".gz" or none.
*/
pkgAcqIndex(pkgAcquire *Owner,std::string URI,std::string URIDesc,
- std::string ShortDesc, HashStringList const &ExpectedHashes,
- std::string compressExt="");
-#if 0
- pkgAcqIndex(pkgAcquire *Owner,
- IndexTarget const * const Target,
- HashStringList const &ExpectedHash,
- indexRecords *MetaIndexParser);
-#endif
- pkgAcqIndex(pkgAcqMetaIndex *MetaIndexOwner,
+ std::string ShortDesc, HashStringList const &ExpectedHashes);
+ pkgAcqIndex(pkgAcquire *Owner, pkgAcqMetaBase *TransactionManager,
IndexTarget const * const Target,
HashStringList const &ExpectedHash,
indexRecords *MetaIndexParser);
*/
class pkgAcqIndexTrans : public pkgAcqIndex
{
+ void *d;
+
public:
virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
pkgAcqIndexTrans(pkgAcquire *Owner,
std::string URI,std::string URIDesc,
std::string ShortDesc);
- pkgAcqIndexTrans(pkgAcqMetaIndex *Owner, IndexTarget const * const Target,
+ pkgAcqIndexTrans(pkgAcquire *Owner,
+ pkgAcqMetaBase *TransactionManager,
+ IndexTarget const * const Target,
HashStringList const &ExpectedHashes,
indexRecords *MetaIndexParser);
};
/** \brief Information about an index file. */ /*{{{*/
class IndexTarget
{
+ void *d;
+
public:
/** \brief A URI from which the index file can be downloaded. */
std::string URI;
virtual bool IsOptional() const {
return false;
}
- virtual bool IsSubIndex() const {
- return false;
- }
};
/*}}}*/
/** \brief Information about an optional index file. */ /*{{{*/
class OptionalIndexTarget : public IndexTarget
{
+ void *d;
+
virtual bool IsOptional() const {
return true;
}
};
/*}}}*/
-/** \brief Information about an subindex index file. */ /*{{{*/
-class SubIndexTarget : public IndexTarget
-{
- virtual bool IsSubIndex() const {
- return true;
- }
-};
- /*}}}*/
-/** \brief Information about an subindex index file. */ /*{{{*/
-class OptionalSubIndexTarget : public OptionalIndexTarget
-{
- virtual bool IsSubIndex() const {
- return true;
- }
-};
- /*}}}*/
/** \brief An acquire item that downloads the detached signature {{{
* of a meta-index (Release) file, then queues up the release
*
* \sa pkgAcqMetaIndex
*/
-class pkgAcqMetaSig : public pkgAcquire::Item
+class pkgAcqMetaSig : public pkgAcqMetaBase
{
+ void *d;
+
protected:
/** \brief The last good signature file */
std::string LastGoodSig;
*/
const std::vector<IndexTarget*>* IndexTargets;
- /** \brief if we are in fetching or download state */
+ /** \brief If we are in fetching or download state */
bool AuthPass;
+ /** \brief Was this file already on disk */
+ bool IMSHit;
+
public:
// Specialized action members
virtual std::string DescURI() const {return RealURI; };
/** \brief Create a new pkgAcqMetaSig. */
- pkgAcqMetaSig(pkgAcqMetaIndex *MetaOwner,
+ pkgAcqMetaSig(pkgAcquire *Owner,
+ pkgAcqMetaBase *TransactionManager,
std::string URI,std::string URIDesc, std::string ShortDesc,
std::string MetaIndexFile,
const std::vector<IndexTarget*>* IndexTargets,
*/
class pkgAcqArchive : public pkgAcquire::Item
{
+ void *d;
+
protected:
/** \brief The package version being fetched. */
pkgCache::VerIterator Version;
*/
class pkgAcqFile : public pkgAcquire::Item
{
+ void *d;
+
/** \brief How many times to retry the download, set from
* Acquire::Retries.
*/