acquire-item.h
Go to the documentation of this file.
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
/* ######################################################################
Acquire Item - Item to acquire
When an item is instantiated it will add it self to the local list in
the Owner Acquire class. Derived classes will then call QueueURI to
register all the URI's they wish to fetch at the initial moment.
Three item classes are provided to provide functionality for
downloading of Index, Translation and Packages files.
A Archive class is provided for downloading .deb files. It does Hash
checking and source location as well as a retry algorithm.
##################################################################### */
/*}}}*/
#ifndef PKGLIB_ACQUIRE_ITEM_H
#define PKGLIB_ACQUIRE_ITEM_H
#include <apt-pkg/acquire.h>
#include <apt-pkg/hashes.h>
#include <apt-pkg/indexfile.h>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/weakptr.h>
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
class pkgRecords;
class pkgSourceList;
class pkgAcqMetaClearSig;
class pkgAcqIndexMergeDiffs;
class metaIndex;
class APT_PUBLIC pkgAcquire::Item : public WeakPointable /*{{{*/
{
public:
enum ItemState
{
StatIdle,
StatFetching,
StatDone,
StatError,
StatAuthError,
StatTransientNetworkError,
} Status;
std::string ErrorText;
unsigned long long FileSize;
unsigned long long PartialSize;
std::string ActiveSubprocess;
unsigned long ID;
bool Complete;
bool Local;
std::string UsedMirror;
unsigned int QueueCounter;
unsigned int ExpectedAdditionalItems;
std::string DestFile;
unsigned int Retries;
virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf);
APT_HIDDEN void FailMessage(std::string const &Message);
virtual bool VerifyDone(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 void Start(std::string const &Message, unsigned long long const Size);
virtual std::string Custom600Headers() const;
// this is more a hack than a proper external interface, hence hidden
APT_HIDDEN std::unordered_map<std::string, std::string> &ModifyCustomFields();
// this isn't the super nicest interface either…
APT_HIDDEN bool PopAlternativeURI(std::string &NewURI);
APT_HIDDEN bool IsGoodAlternativeURI(std::string const &AltUri) const;
APT_HIDDEN void PushAlternativeURI(std::string &&NewURI, std::unordered_map<std::string, std::string> &&fields, bool const at_the_back);
APT_HIDDEN void RemoveAlternativeSite(std::string const &AltUri);
virtual std::string DescURI() const = 0;
virtual std::string ShortDesc() const;
APT_HIDDEN void Cancelled();
virtual void Finished();
virtual HashStringList GetExpectedHashes() const = 0;
std::string HashSum() const;
virtual bool HashesRequired() const { return true; }
pkgAcquire *GetOwner() const;
pkgAcquire::ItemDesc &GetItemDesc();
virtual bool IsTrusted() const;
void SetActiveSubprocess(std::string const &subprocess);
explicit Item(pkgAcquire * const Owner);
virtual ~Item();
bool APT_HIDDEN IsRedirectionLoop(std::string const &NewURI);
int APT_HIDDEN Priority();
void APT_HIDDEN FetchAfter(time_point FetchAfter);
time_point APT_HIDDEN FetchAfter();
protected:
pkgAcquire * const Owner;
pkgAcquire::ItemDesc Desc;
enum RenameOnErrorState {
HashSumMismatch,
SizeMismatch,
InvalidFormat,
SignatureError,
NotClearsigned,
MaximumSizeExceeded,
PDiffError,
};
bool RenameOnError(RenameOnErrorState const state);
virtual bool QueueURI(ItemDesc &Item);
void Dequeue();
bool Rename(std::string const &From, std::string const &To);
virtual std::string GetFinalFilename() const;
private:
class Private;
Private * const d;
friend class pkgAcqMetaBase;
friend class pkgAcqMetaClearSig;
};
/*}}}*/
class APT_HIDDEN pkgAcqTransactionItem: public pkgAcquire::Item /*{{{*/
{
void * const d;
protected:
HashStringList GetExpectedHashesFor(std::string const &MetaKey) const;
bool QueueURI(pkgAcquire::ItemDesc &Item) override;
public:
IndexTarget const Target;
std::string PartialFile;
pkgAcqMetaClearSig * const TransactionManager;
enum TransactionStates {
TransactionStarted,
TransactionCommit,
TransactionAbort,
};
virtual bool TransactionState(TransactionStates const state);
[[nodiscard]] std::string DescURI() const override { return Target.URI; }
[[nodiscard]] HashStringList GetExpectedHashes() const override;
[[nodiscard]] virtual std::string GetMetaKey() const;
[[nodiscard]] bool HashesRequired() const override;
[[nodiscard]] virtual bool AcquireByHash() const;
pkgAcqTransactionItem(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, IndexTarget const &Target) APT_NONNULL(2, 3);
~pkgAcqTransactionItem() override;
friend class pkgAcqMetaBase;
friend class pkgAcqMetaClearSig;
};
/*}}}*/
class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem /*{{{*/
{
void * const d;
protected:
std::vector<pkgAcqTransactionItem*> Transaction;
bool AuthPass;
bool CheckDownloadDone(pkgAcqTransactionItem * const I, const std::string &Message, HashStringList const &Hashes) const;
void QueueForSignatureVerify(pkgAcqTransactionItem * const I, std::string const &File, std::string const &Signature);
[[nodiscard]] std::string Custom600Headers() const override;
bool CheckAuthDone(std::string const &Message, pkgAcquire::MethodConfig const *const Cnf);
bool CheckStopAuthentication(pkgAcquire::Item * const I, const std::string &Message);
bool VerifyVendor(std::string const &Message);
bool TransactionState(TransactionStates state) override;
public:
// This refers more to the Transaction-Manager than the actual file
bool IMSHit;
TransactionStates State;
std::string BaseURI;
bool QueueURI(pkgAcquire::ItemDesc &Item) override;
[[nodiscard]] HashStringList GetExpectedHashes() const override;
[[nodiscard]] bool HashesRequired() const override;
// transaction code
void Add(pkgAcqTransactionItem * const I);
void AbortTransaction();
bool TransactionHasError() const;
void CommitTransaction();
void TransactionStageCopy(pkgAcqTransactionItem * const I,
const std::string &From,
const std::string &To);
void TransactionStageRemoval(pkgAcqTransactionItem * const I, const std::string &FinalFile);
[[nodiscard]] std::string GetFinalFilename() const override;
pkgAcqMetaBase(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &DataTarget) APT_NONNULL(2, 3);
~pkgAcqMetaBase() override;
};
/*}}}*/
class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase
{
void * const d;
protected:
IndexTarget const DetachedSigTarget;
void Init(std::string const &URIDesc, std::string const &ShortDesc);
public:
[[nodiscard]] std::string DescURI() const override;
// Specialized action members
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
void Done(std::string const &Message, HashStringList const &Hashes,
pkgAcquire::MethodConfig const *Cnf) override;
pkgAcqMetaIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &DataTarget, IndexTarget const &DetachedSigTarget) APT_NONNULL(2, 3);
~pkgAcqMetaIndex() override;
friend class pkgAcqMetaSig;
};
/*}}}*/
class APT_HIDDEN pkgAcqMetaSig final : public pkgAcqTransactionItem
{
void * const d;
pkgAcqMetaIndex * const MetaIndex;
std::string MetaIndexFileSignature;
protected:
[[nodiscard]] std::string GetFinalFilename() const override;
public:
[[nodiscard]] bool HashesRequired() const override { return false; }
// Specialized action members
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
void Done(std::string const &Message, HashStringList const &Hashes,
pkgAcquire::MethodConfig const *Cnf) override;
[[nodiscard]] std::string Custom600Headers() const override;
pkgAcqMetaSig(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &Target, pkgAcqMetaIndex * const MetaIndex) APT_NONNULL(2, 3, 5);
~pkgAcqMetaSig() override;
};
/*}}}*/
class APT_HIDDEN pkgAcqMetaClearSig final : public pkgAcqMetaIndex
{
void * const d;
IndexTarget const DetachedDataTarget;
public:
metaIndex *MetaIndexParser;
metaIndex *LastMetaIndexParser;
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
[[nodiscard]] std::string Custom600Headers() const override;
bool VerifyDone(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
void Done(std::string const &Message, HashStringList const &Hashes,
pkgAcquire::MethodConfig const *Cnf) override;
void DoCancelled();
void Finished() override;
void QueueIndexes(bool const verify);
pkgAcqMetaClearSig(pkgAcquire * const Owner,
IndexTarget const &ClearsignedTarget,
IndexTarget const &DetachedDataTarget,
IndexTarget const &DetachedSigTarget,
metaIndex * const MetaIndexParser);
~pkgAcqMetaClearSig() override;
};
/*}}}*/
class APT_HIDDEN pkgAcqBaseIndex : public pkgAcqTransactionItem
{
void * const d;
public:
[[nodiscard]] std::string GetFinalFilename() const override;
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
pkgAcqBaseIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &Target) APT_NONNULL(2, 3);
~pkgAcqBaseIndex() override;
};
/*}}}*/
class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex
{
void * const d;
protected:
enum AllStages {
STAGE_DOWNLOAD,
STAGE_DECOMPRESS_AND_VERIFY,
};
AllStages Stage;
void StageDownloadDone(std::string const &Message);
void StageDecompressDone();
std::string EraseFileName;
std::string CompressionExtensions;
std::string CurrentCompressionExtension;
void InitByHashIfNeeded();
[[nodiscard]] std::string GetFinalFilename() const override;
bool TransactionState(TransactionStates state) override;
public:
// Specialized action members
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
void Done(std::string const &Message, HashStringList const &Hashes,
pkgAcquire::MethodConfig const *Cnf) override;
[[nodiscard]] std::string Custom600Headers() const override;
[[nodiscard]] std::string DescURI() const override { return Desc.URI; };
[[nodiscard]] std::string GetMetaKey() const override;
pkgAcqIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &Target, bool const Derived = false) APT_NONNULL(2, 3);
~pkgAcqIndex() override;
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 &Message, pkgAcquire::MethodConfig const *const Cnf);
};
/*}}}*/
struct APT_HIDDEN DiffInfo { /*{{{*/
std::string file;
HashStringList result_hashes;
HashStringList patch_hashes;
HashStringList download_hashes;
};
/*}}}*/
class APT_HIDDEN pkgAcqDiffIndex final : public pkgAcqIndex
{
void * const d;
std::vector<pkgAcqIndexMergeDiffs*> * diffs;
std::vector<DiffInfo> available_patches;
bool pdiff_merge;
protected:
bool Debug;
[[nodiscard]] std::string GetFinalFilename() const override;
bool QueueURI(pkgAcquire::ItemDesc &Item) override;
bool TransactionState(TransactionStates state) override;
public:
// Specialized action members
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
bool VerifyDone(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
void Done(std::string const &Message, HashStringList const &Hashes,
pkgAcquire::MethodConfig const *Cnf) override;
[[nodiscard]] std::string DescURI() const override { return Target.URI + "Index"; };
[[nodiscard]] std::string GetMetaKey() const override;
bool ParseDiffIndex(std::string const &IndexDiffFile);
pkgAcqDiffIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &Target) APT_NONNULL(2, 3);
~pkgAcqDiffIndex() override;
private:
APT_HIDDEN void QueueOnIMSHit() const;
};
/*}}}*/
class APT_HIDDEN pkgAcqIndexMergeDiffs final : public pkgAcqBaseIndex
{
protected:
bool Debug;
struct DiffInfo const patch;
std::vector<pkgAcqIndexMergeDiffs*> const * const allPatches;
enum DiffState
{
StateFetchDiff,
StateApplyDiff,
StateDoneDiff,
StateErrorDiff
} State;
public:
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
void Done(std::string const &Message, HashStringList const &Hashes,
pkgAcquire::MethodConfig const *Cnf) override;
[[nodiscard]] std::string Custom600Headers() const override;
[[nodiscard]] std::string DescURI() const override { return Target.URI + "Index"; };
[[nodiscard]] HashStringList GetExpectedHashes() const override;
[[nodiscard]] bool HashesRequired() const override;
[[nodiscard]] bool AcquireByHash() const override;
pkgAcqIndexMergeDiffs(pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager,
IndexTarget const &Target, DiffInfo const &patch,
std::vector<pkgAcqIndexMergeDiffs *> const *const allPatches) APT_NONNULL(2, 3, 6);
~pkgAcqIndexMergeDiffs() override;
};
/*}}}*/
class APT_HIDDEN pkgAcqIndexDiffs final : public pkgAcqBaseIndex
{
private:
APT_HIDDEN bool QueueNextDiff();
APT_HIDDEN void Finish(bool const allDone=false);
protected:
bool Debug;
std::vector<DiffInfo> available_patches;
enum DiffState
{
StateFetchDiff,
StateApplyDiff
} State;
public:
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
void Done(std::string const &Message, HashStringList const &Hashes,
pkgAcquire::MethodConfig const * Cnf) override;
[[nodiscard]] std::string Custom600Headers() const override;
[[nodiscard]] std::string DescURI() const override { return Target.URI + "IndexDiffs"; };
[[nodiscard]] HashStringList GetExpectedHashes() const override;
[[nodiscard]] bool HashesRequired() const override;
[[nodiscard]] bool AcquireByHash() const override;
pkgAcqIndexDiffs(pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager,
IndexTarget const &Target,
std::vector<DiffInfo> const &diffs = std::vector<DiffInfo>()) APT_NONNULL(2, 3);
~pkgAcqIndexDiffs() override;
};
/*}}}*/
class APT_PUBLIC pkgAcqArchive : public pkgAcquire::Item
{
void * const d;
bool LocalSource;
HashStringList ExpectedHashes;
protected:
pkgCache::VerIterator Version;
pkgSourceList *Sources;
pkgRecords *Recs;
std::string &StoreFilename;
bool Trusted;
bool QueueNext();
[[nodiscard]] std::string GetFinalFilename() const override;
public:
void Failed(std::string const &Message, pkgAcquire::MethodConfig const * Cnf) override;
void Done(std::string const &Message, HashStringList const &Hashes,
pkgAcquire::MethodConfig const *Cnf) override;
[[nodiscard]] std::string DescURI() const override;
[[nodiscard]] std::string ShortDesc() const override;
void Finished() override;
[[nodiscard]] bool IsTrusted() const override;
[[nodiscard]] HashStringList GetExpectedHashes() const override;
[[nodiscard]] bool HashesRequired() const override;
pkgAcqArchive(pkgAcquire * const Owner,pkgSourceList * const Sources,
pkgRecords * const Recs,pkgCache::VerIterator const &Version,
std::string &StoreFilename);
~pkgAcqArchive() override;
};
/*}}}*/
class APT_PUBLIC pkgAcqChangelog : public pkgAcquire::Item
{
class Private;
Private * const d;
std::string TemporaryDirectory;
std::string const SrcName;
std::string const SrcVersion;
public:
// we will never have hashes for changelogs.
// If you need verified ones, download the deb and extract the changelog.
[[nodiscard]] HashStringList GetExpectedHashes() const override { return {}; }
[[nodiscard]] bool HashesRequired() const override { return false; }
// Specialized action members
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
void Done(std::string const &Message, HashStringList const &CalcHashes,
pkgAcquire::MethodConfig const *Cnf) override;
[[nodiscard]] std::string DescURI() const override { return Desc.URI; };
static std::string URI(pkgCache::VerIterator const &Ver);
static std::string URI(pkgCache::RlsFileIterator const &Rls,
char const * const Component, char const * const SrcName,
char const * const SrcVersion);
static std::string URI(std::string const &Template,
char const * const Component, char const * const SrcName,
char const * const SrcVersion);
static std::string URITemplate(pkgCache::RlsFileIterator const &Rls);
pkgAcqChangelog(pkgAcquire * const Owner, pkgCache::VerIterator const &Ver,
std::string const &DestDir="", std::string const &DestFilename="");
pkgAcqChangelog(pkgAcquire * const Owner, pkgCache::RlsFileIterator const &Rls,
char const * const Component, char const * const SrcName, char const * const SrcVersion,
std::string const &DestDir="", std::string const &DestFilename="");
pkgAcqChangelog(pkgAcquire * const Owner, std::string const &URI,
char const * const SrcName, char const * const SrcVersion,
std::string const &DestDir="", std::string const &DestFilename="");
~pkgAcqChangelog() override;
private:
APT_HIDDEN void Init(std::string const &DestDir, std::string const &DestFilename);
};
/*}}}*/
class APT_PUBLIC pkgAcqFile : public pkgAcquire::Item
{
void * const d;
bool IsIndexFile;
HashStringList const ExpectedHashes;
public:
[[nodiscard]] HashStringList GetExpectedHashes() const override;
[[nodiscard]] bool HashesRequired() const override;
// Specialized action members
void Done(std::string const &Message, HashStringList const &CalcHashes,
pkgAcquire::MethodConfig const *Cnf) override;
[[nodiscard]] std::string DescURI() const override { return Desc.URI; };
[[nodiscard]] std::string Custom600Headers() const override;
pkgAcqFile(pkgAcquire * const Owner, std::string const &URI, HashStringList const &Hashes, unsigned long long const Size,
std::string const &Desc, std::string const &ShortDesc,
std::string const &DestDir="", std::string const &DestFilename="",
bool const IsIndexFile=false);
~pkgAcqFile() override;
};
/*}}}*/
class APT_HIDDEN pkgAcqAuxFile final : public pkgAcqFile /*{{{*/
{
pkgAcquire::Item *const Owner;
pkgAcquire::Worker *const Worker;
unsigned long long MaximumSize;
std::string const OriginalURI;
public:
void Failed(std::string const &Message, pkgAcquire::MethodConfig const * Cnf) override;
void Done(std::string const &Message, HashStringList const &CalcHashes,
pkgAcquire::MethodConfig const *Cnf) override;
[[nodiscard]] std::string Custom600Headers() const override;
void Finished() override;
pkgAcqAuxFile(pkgAcquire::Item *const Owner, pkgAcquire::Worker *const Worker,
std::string const &ShortDesc, std::string const &Desc, std::string const &URI,
HashStringList const &Hashes, unsigned long long const MaximumSize);
~pkgAcqAuxFile() override;
};
/*}}}*/
#endif
acquire.h
HashStringList
Definition hashes.h:79
Hashes
Definition hashes.h:184
IndexTarget
Information about an index file.
Definition indexfile.h:39
URI
Definition strutl.h:221
WeakPointable
Definition weakptr.h:34
metaIndex
Definition metaindex.h:21
pkgAcqArchive::Recs
pkgRecords * Recs
A package records object, used to look up the file corresponding to each version of the package.
Definition acquire-item.h:971
pkgAcqArchive::Version
pkgCache::VerIterator Version
The package version being fetched.
Definition acquire-item.h:961
pkgAcqArchive::Failed
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object couldn't be fetched.
Definition acquire-item.cc:3675
pkgAcqArchive::Done
void Done(std::string const &Message, HashStringList const &Hashes, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object was fetched successfully.
Definition acquire-item.cc:3650
pkgAcqArchive::Finished
void Finished() override
Invoked by the worker when the download is completely done.
Definition acquire-item.cc:3685
pkgAcqArchive::Trusted
bool Trusted
true if this version file is being downloaded from a trusted source.
Definition acquire-item.h:981
pkgAcqArchive::DescURI
std::string DescURI() const override
A "descriptive" URI-like string.
Definition acquire-item.cc:3693
pkgAcqArchive::GetExpectedHashes
HashStringList GetExpectedHashes() const override
Definition acquire-item.cc:395
pkgAcqArchive::GetFinalFilename
std::string GetFinalFilename() const override
Get the full pathname of the final file for the current URI.
Definition acquire-item.cc:547
pkgAcqArchive::StoreFilename
std::string & StoreFilename
A location in which the actual filename of the package should be stored.
Definition acquire-item.h:976
pkgAcqArchive::ShortDesc
std::string ShortDesc() const override
Short item description.
Definition acquire-item.cc:3698
pkgAcqArchive::HashesRequired
bool HashesRequired() const override
Definition acquire-item.cc:391
pkgAcqArchive::QueueNext
bool QueueNext()
Queue up the next available file for this version.
Definition acquire-item.cc:3642
pkgAcqArchive::IsTrusted
bool IsTrusted() const override
Definition acquire-item.cc:3680
pkgAcqArchive::Sources
pkgSourceList * Sources
The list of sources from which to pick archives to download this package from.
Definition acquire-item.h:966
pkgAcqArchive::pkgAcqArchive
pkgAcqArchive(pkgAcquire *const Owner, pkgSourceList *const Sources, pkgRecords *const Recs, pkgCache::VerIterator const &Version, std::string &StoreFilename)
Create a new pkgAcqArchive.
Definition acquire-item.cc:3447
pkgAcqAuxFile::Failed
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object couldn't be fetched.
Definition acquire-item.cc:4108
pkgAcqAuxFile::Finished
void Finished() override
Invoked by the worker when the download is completely done.
Definition acquire-item.cc:4139
pkgAcqAuxFile::Custom600Headers
std::string Custom600Headers() const override
Custom headers to be sent to the fetch process.
Definition acquire-item.cc:4130
pkgAcqAuxFile::Done
void Done(std::string const &Message, HashStringList const &CalcHashes, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object was fetched successfully.
Definition acquire-item.cc:4119
pkgAcqBaseIndex::Failed
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object couldn't be fetched.
Definition acquire-item.cc:2386
pkgAcqBaseIndex::GetFinalFilename
std::string GetFinalFilename() const override
Get the full pathname of the final file for the current URI.
Definition acquire-item.cc:539
pkgAcqChangelog::Private
Definition acquire-item.cc:3707
pkgAcqChangelog
Retrieve the changelog for the given version {{{.
Definition acquire-item.h:1030
pkgAcqChangelog::DescURI
std::string DescURI() const override
A "descriptive" URI-like string.
Definition acquire-item.h:1047
pkgAcqChangelog::GetExpectedHashes
HashStringList GetExpectedHashes() const override
Definition acquire-item.h:1040
pkgAcqChangelog::HashesRequired
bool HashesRequired() const override
Definition acquire-item.h:1041
pkgAcqChangelog::pkgAcqChangelog
pkgAcqChangelog(pkgAcquire *const Owner, pkgCache::VerIterator const &Ver, std::string const &DestDir="", std::string const &DestFilename="")
Create a new pkgAcqChangelog object.
Definition acquire-item.cc:3711
pkgAcqDiffIndex
An item that is responsible for fetching an index file of {{{ package list diffs and starting the pac...
Definition acquire-item.h:715
pkgAcqDiffIndex::Failed
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object couldn't be fetched.
Definition acquire-item.cc:2797
pkgAcqDiffIndex::Done
void Done(std::string const &Message, HashStringList const &Hashes, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object was fetched successfully.
Definition acquire-item.cc:2824
pkgAcqDiffIndex::DescURI
std::string DescURI() const override
A "descriptive" URI-like string.
Definition acquire-item.h:738
pkgAcqDiffIndex::GetFinalFilename
std::string GetFinalFilename() const override
Get the full pathname of the final file for the current URI.
Definition acquire-item.cc:526
pkgAcqDiffIndex::VerifyDone
bool VerifyDone(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker to check if the successfully fetched object is also the objected we wan...
Definition acquire-item.cc:2813
pkgAcqDiffIndex::pkgAcqDiffIndex
pkgAcqDiffIndex(pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager, IndexTarget const &Target) APT_NONNULL(2
Create a new pkgAcqDiffIndex.
Definition acquire-item.cc:2410
pkgAcqDiffIndex::QueueURI
bool QueueURI(pkgAcquire::ItemDesc &Item) override
Insert this item into its owner's queue.
Definition acquire-item.cc:512
pkgAcqDiffIndex::Debug
bool Debug
If true, debugging information will be written to std::clog.
Definition acquire-item.h:723
pkgAcqFile
Retrieve an arbitrary file to the current directory. {{{.
Definition acquire-item.h:1146
pkgAcqFile::DescURI
std::string DescURI() const override
A "descriptive" URI-like string.
Definition acquire-item.h:1160
pkgAcqFile::GetExpectedHashes
HashStringList GetExpectedHashes() const override
Definition acquire-item.cc:406
pkgAcqFile::HashesRequired
bool HashesRequired() const override
Definition acquire-item.cc:401
pkgAcqFile::Done
void Done(std::string const &Message, HashStringList const &CalcHashes, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object was fetched successfully.
Definition acquire-item.cc:4051
pkgAcqFile::pkgAcqFile
pkgAcqFile(pkgAcquire *const Owner, std::string const &URI, HashStringList const &Hashes, unsigned long long const Size, std::string const &Desc, std::string const &ShortDesc, std::string const &DestDir="", std::string const &DestFilename="", bool const IsIndexFile=false)
Create a new pkgAcqFile object.
Definition acquire-item.cc:4011
pkgAcqIndexDiffs
An item that is responsible for fetching server-merge patches {{{ that need to be applied to a given ...
Definition acquire-item.h:857
pkgAcqIndexDiffs::DescURI
std::string DescURI() const override
A "descriptive" URI-like string.
Definition acquire-item.h:923
pkgAcqIndexDiffs::pkgAcqIndexDiffs
pkgAcqIndexDiffs(pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager, IndexTarget const &Target, std::vector< DiffInfo > const &diffs=std::vector< DiffInfo >()) APT_NONNULL(2
Create an index diff item.
Definition acquire-item.cc:2874
pkgAcqIndexDiffs::available_patches
std::vector< DiffInfo > available_patches
Definition acquire-item.h:899
pkgAcqIndexDiffs::DiffState
DiffState
Definition acquire-item.h:903
pkgAcqIndexDiffs::StateApplyDiff
@ StateApplyDiff
The diff is currently being applied.
Definition acquire-item.h:908
pkgAcqIndexDiffs::StateFetchDiff
@ StateFetchDiff
The diff is currently being fetched.
Definition acquire-item.h:905
pkgAcqIndexDiffs::Debug
bool Debug
If true, debugging output will be written to std::clog.
Definition acquire-item.h:889
pkgAcqIndexMergeDiffs
An item that is responsible for fetching client-merge patches {{{ that need to be applied to a given ...
Definition acquire-item.h:782
pkgAcqIndexMergeDiffs::DescURI
std::string DescURI() const override
A "descriptive" URI-like string.
Definition acquire-item.h:822
pkgAcqIndexMergeDiffs::pkgAcqIndexMergeDiffs
pkgAcqIndexMergeDiffs(pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager, IndexTarget const &Target, DiffInfo const &patch, std::vector< pkgAcqIndexMergeDiffs * > const *const allPatches) APT_NONNULL(2
Create an index merge-diff item.
Definition acquire-item.cc:3082
pkgAcqIndexMergeDiffs::allPatches
std::vector< pkgAcqIndexMergeDiffs * > const *const allPatches
list of all download items for the patches
Definition acquire-item.h:794
pkgAcqIndexMergeDiffs::patch
struct DiffInfo const patch
information about the current patch
Definition acquire-item.h:791
pkgAcqIndexMergeDiffs::DiffState
DiffState
Definition acquire-item.h:798
pkgAcqIndexMergeDiffs::StateErrorDiff
@ StateErrorDiff
something bad happened and fallback was triggered
Definition acquire-item.h:809
pkgAcqIndexMergeDiffs::StateApplyDiff
@ StateApplyDiff
The diff is currently being applied.
Definition acquire-item.h:803
pkgAcqIndexMergeDiffs::StateFetchDiff
@ StateFetchDiff
The diff is currently being fetched.
Definition acquire-item.h:800
pkgAcqIndexMergeDiffs::StateDoneDiff
@ StateDoneDiff
the work with this diff is done
Definition acquire-item.h:806
pkgAcqIndexMergeDiffs::Debug
bool Debug
If true, debugging output will be written to std::clog.
Definition acquire-item.h:788
pkgAcqIndex
An acquire item that is responsible for fetching an index {{{ file (e.g., Packages or Sources).
Definition acquire-item.h:626
pkgAcqIndex::Failed
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object couldn't be fetched.
Definition acquire-item.cc:3331
pkgAcqIndex::Done
void Done(std::string const &Message, HashStringList const &Hashes, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object was fetched successfully.
Definition acquire-item.cc:3349
pkgAcqIndex::CompressionExtensions
std::string CompressionExtensions
The compression-related file extensions that are being added to the downloaded file one by one if fir...
Definition acquire-item.h:658
pkgAcqIndex::DescURI
std::string DescURI() const override
A "descriptive" URI-like string.
Definition acquire-item.h:677
pkgAcqIndex::GetFinalFilename
std::string GetFinalFilename() const override
Get the full pathname of the final file for the current URI.
Definition acquire-item.cc:530
pkgAcqIndex::InitByHashIfNeeded
void InitByHashIfNeeded()
Do the changes needed to fetch via AptByHash (if needed).
pkgAcqIndex::CurrentCompressionExtension
std::string CurrentCompressionExtension
The actual compression extension currently used.
Definition acquire-item.h:661
pkgAcqIndex::AllStages
AllStages
The stages the method goes through.
Definition acquire-item.h:636
pkgAcqIndex::EraseFileName
std::string EraseFileName
If set, this partially downloaded file will be removed when the download completes.
Definition acquire-item.h:653
pkgAcqIndex::Custom600Headers
std::string Custom600Headers() const override
Custom headers to be sent to the fetch process.
Definition acquire-item.cc:3294
pkgAcqMetaBase
the manager of a transaction
Definition acquire-item.h:411
pkgAcqMetaBase::TransactionStageRemoval
void TransactionStageRemoval(pkgAcqTransactionItem *const I, const std::string &FinalFile)
Stage (queue) a removal action when the transaction is committed.
Definition acquire-item.cc:1372
pkgAcqMetaBase::GetExpectedHashes
HashStringList GetExpectedHashes() const override
Definition acquire-item.cc:351
pkgAcqMetaBase::GetFinalFilename
std::string GetFinalFilename() const override
Get the full pathname of the final file for the current URI.
Definition acquire-item.cc:543
pkgAcqMetaBase::CheckAuthDone
bool CheckAuthDone(std::string const &Message, pkgAcquire::MethodConfig const *const Cnf)
Called when authentication succeeded.
Definition acquire-item.cc:1511
pkgAcqMetaBase::AuthPass
bool AuthPass
If true, the index's signature is currently being verified.
Definition acquire-item.h:418
pkgAcqMetaBase::TransactionStageCopy
void TransactionStageCopy(pkgAcqTransactionItem *const I, const std::string &From, const std::string &To)
Stage (queue) a copy action when the transaction is committed.
Definition acquire-item.cc:1363
pkgAcqMetaBase::CheckStopAuthentication
bool CheckStopAuthentication(pkgAcquire::Item *const I, const std::string &Message)
Definition acquire-item.cc:1382
pkgAcqMetaBase::HashesRequired
bool HashesRequired() const override
Definition acquire-item.cc:346
pkgAcqMetaBase::QueueURI
bool QueueURI(pkgAcquire::ItemDesc &Item) override
Insert this item into its owner's queue.
Definition acquire-item.cc:506
pkgAcqMetaBase::VerifyVendor
bool VerifyVendor(std::string const &Message)
Check that the release file is a release file for the correct distribution.
Definition acquire-item.cc:1839
pkgAcqMetaBase::CheckDownloadDone
bool CheckDownloadDone(pkgAcqTransactionItem *const I, const std::string &Message, HashStringList const &Hashes) const
Called when a file is finished being retrieved.
Definition acquire-item.cc:1451
pkgAcqMetaBase::QueueForSignatureVerify
void QueueForSignatureVerify(pkgAcqTransactionItem *const I, std::string const &File, std::string const &Signature)
Queue the downloaded Signature for verification.
Definition acquire-item.cc:1433
pkgAcqMetaBase::Custom600Headers
std::string Custom600Headers() const override
Custom headers to be sent to the fetch process.
Definition acquire-item.cc:1415
pkgAcqMetaClearSig
An item responsible for downloading clearsigned metaindexes {{{.
Definition acquire-item.h:567
pkgAcqMetaClearSig::pkgAcqMetaClearSig
pkgAcqMetaClearSig(pkgAcquire *const Owner, IndexTarget const &ClearsignedTarget, IndexTarget const &DetachedDataTarget, IndexTarget const &DetachedSigTarget, metaIndex *const MetaIndexParser)
Create a new pkgAcqMetaClearSig.
Definition acquire-item.cc:1988
pkgAcqMetaClearSig::Failed
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object couldn't be fetched.
Definition acquire-item.cc:2085
pkgAcqMetaClearSig::Done
void Done(std::string const &Message, HashStringList const &Hashes, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object was fetched successfully.
Definition acquire-item.cc:2047
pkgAcqMetaClearSig::QueueIndexes
void QueueIndexes(bool const verify)
Starts downloading the individual index files.
Definition acquire-item.cc:1570
pkgAcqMetaClearSig::Finished
void Finished() override
Invoked by the worker when the download is completely done.
Definition acquire-item.cc:2025
pkgAcqMetaClearSig::MetaIndexParser
metaIndex * MetaIndexParser
A package-system-specific parser for the meta-index file.
Definition acquire-item.h:573
pkgAcqMetaClearSig::VerifyDone
bool VerifyDone(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker to check if the successfully fetched object is also the objected we wan...
Definition acquire-item.cc:2034
pkgAcqMetaClearSig::Custom600Headers
std::string Custom600Headers() const override
Custom headers to be sent to the fetch process.
Definition acquire-item.cc:2008
pkgAcqMetaIndex
An item that is responsible for downloading the meta-index {{{ file (i.e., Release) itself and verify...
Definition acquire-item.h:504
pkgAcqMetaIndex::Failed
void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object couldn't be fetched.
Definition acquire-item.cc:2205
pkgAcqMetaIndex::Done
void Done(std::string const &Message, HashStringList const &Hashes, pkgAcquire::MethodConfig const *Cnf) override
Invoked by the acquire worker when the object was fetched successfully.
Definition acquire-item.cc:2189
pkgAcqMetaIndex::DescURI
std::string DescURI() const override
A "descriptive" URI-like string.
Definition acquire-item.cc:2224
pkgAcqMetaIndex::pkgAcqMetaIndex
pkgAcqMetaIndex(pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager, IndexTarget const &DataTarget, IndexTarget const &DetachedSigTarget) APT_NONNULL(2
Create a new pkgAcqMetaIndex.
Definition acquire-item.cc:2156
pkgAcqMetaIndex::Init
void Init(std::string const &URIDesc, std::string const &ShortDesc)
delayed constructor
pkgAcqMetaSig
An acquire item that downloads the detached signature {{{ of a meta-index (Release) file,...
Definition acquire-item.h:537
pkgAcqMetaSig::GetFinalFilename
std::string GetFinalFilename() const override
Get the full pathname of the final file for the current URI.
Definition acquire-item.cc:535
pkgAcqMetaSig::HashesRequired
bool HashesRequired() const override
Definition acquire-item.h:551
pkgAcqMetaSig::pkgAcqMetaSig
pkgAcqMetaSig(pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager, IndexTarget const &Target, pkgAcqMetaIndex *const MetaIndex) APT_NONNULL(2
Create a new pkgAcqMetaSig.
Definition acquire-item.cc:2232
pkgAcqTransactionItem
baseclass for the indexes files to manage them all together
Definition acquire-item.h:373
pkgAcqTransactionItem::DescURI
std::string DescURI() const override
A "descriptive" URI-like string.
Definition acquire-item.h:396
pkgAcqTransactionItem::TransactionManager
pkgAcqMetaClearSig *const TransactionManager
TransactionManager.
Definition acquire-item.h:387
pkgAcqTransactionItem::QueueURI
bool QueueURI(pkgAcquire::ItemDesc &Item) override
Insert this item into its owner's queue.
Definition acquire-item.cc:421
pkgAcqTransactionItem::PartialFile
std::string PartialFile
storge name until a transaction is finished
Definition acquire-item.h:384
pkgAcquire::Item
Represents the process by which a pkgAcquire object should retrieve a file or a collection of files.
Definition acquire-item.h:59
pkgAcquire::Item::Priority
int APT_HIDDEN Priority()
The priority of the item, used for queuing.
Definition acquire-item.cc:1193
pkgAcquire::Item::HashesRequired
virtual bool HashesRequired() const
Definition acquire-item.h:273
pkgAcquire::Item::RenameOnError
bool RenameOnError(RenameOnErrorState const state)
Rename failed file and set error.
Definition acquire-item.cc:1111
pkgAcquire::Item::IsTrusted
virtual bool IsTrusted() const
Definition acquire-item.cc:893
pkgAcquire::Item::QueueCounter
unsigned int QueueCounter
The number of fetch queues into which this item has been inserted.
Definition acquire-item.h:138
pkgAcquire::Item::VerifyDone
virtual bool VerifyDone(std::string const &Message, pkgAcquire::MethodConfig const *const Cnf)
Invoked by the acquire worker to check if the successfully fetched object is also the objected we wan...
Definition acquire-item.cc:1054
pkgAcquire::Item::HashSum
std::string HashSum() const
Definition acquire-item.cc:1156
pkgAcquire::Item::GetOwner
pkgAcquire * GetOwner() const
Definition acquire-item.cc:883
pkgAcquire::Item::PartialSize
unsigned long long PartialSize
How much of the object was already fetched.
Definition acquire-item.h:99
pkgAcquire::Item::Retries
unsigned int Retries
Number of retries.
Definition acquire-item.h:156
pkgAcquire::Item::QueueURI
virtual bool QueueURI(ItemDesc &Item)
Insert this item into its owner's queue.
Definition acquire-item.cc:412
pkgAcquire::Item::ExpectedAdditionalItems
unsigned int ExpectedAdditionalItems
The number of additional fetch items that are expected once this item is done.
Definition acquire-item.h:148
pkgAcquire::Item::GetFinalFilename
virtual std::string GetFinalFilename() const
Get the full pathname of the final file for the current URI.
Definition acquire-item.cc:521
pkgAcquire::Item::ActiveSubprocess
std::string ActiveSubprocess
contains the name of the subprocess that is operating on this object (for instance,...
Definition acquire-item.h:104
pkgAcquire::Item::Desc
pkgAcquire::ItemDesc Desc
The item that is currently being downloaded.
Definition acquire-item.h:316
pkgAcquire::Item::Dequeue
void Dequeue()
Remove this item from its owner's queue.
Definition acquire-item.cc:1105
pkgAcquire::Item::Finished
virtual void Finished()
Invoked by the worker when the download is completely done.
Definition acquire-item.cc:879
pkgAcquire::Item::Rename
bool Rename(std::string const &From, std::string const &To)
Rename a file without modifying its timestamp.
Definition acquire-item.cc:1089
pkgAcquire::Item::ID
unsigned long ID
A client-supplied unique identifier.
Definition acquire-item.h:113
pkgAcquire::Item::Cancelled
APT_HIDDEN void Cancelled()
Invoked by the worker when the download is cancelled before completion.
Definition acquire-item.cc:873
pkgAcquire::Item::~Item
virtual ~Item()
Remove this item from its owner's queue by invoking pkgAcquire::Remove.
Definition acquire-item.cc:794
pkgAcquire::Item::FileSize
unsigned long long FileSize
The size of the object to fetch.
Definition acquire-item.h:96
pkgAcquire::Item::Complete
bool Complete
If true, the entire object has been successfully fetched.
Definition acquire-item.h:119
pkgAcquire::Item::FetchAfter
void APT_HIDDEN FetchAfter(time_point FetchAfter)
internal clock definitions to avoid typing all that all over the place
Definition acquire-item.cc:1163
pkgAcquire::Item::GetExpectedHashes
virtual HashStringList GetExpectedHashes() const =0
pkgAcquire::Item::Local
bool Local
If true, the URI of this object is "local".
Definition acquire-item.h:126
pkgAcquire::Item::Start
virtual void Start(std::string const &Message, unsigned long long const Size)
Invoked when the worker starts to fetch this object.
Definition acquire-item.cc:1043
pkgAcquire::Item::Item
Item(pkgAcquire *const Owner)
Initialize an item.
Definition acquire-item.cc:785
pkgAcquire::Item::Done
virtual void Done(std::string const &Message, HashStringList const &Hashes, pkgAcquire::MethodConfig const *const Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition acquire-item.cc:1068
pkgAcquire::Item::ErrorText
std::string ErrorText
Contains a textual description of the error encountered if ItemState is StatError or StatAuthError.
Definition acquire-item.h:93
pkgAcquire::Item::DestFile
std::string DestFile
The name of the file into which the retrieved object will be written.
Definition acquire-item.h:153
pkgAcquire::Item::ItemState
ItemState
The current status of this item.
Definition acquire-item.h:64
pkgAcquire::Item::StatAuthError
@ StatAuthError
The item was downloaded but its authenticity could not be verified.
Definition acquire-item.h:82
pkgAcquire::Item::StatFetching
@ StatFetching
The item is currently being downloaded.
Definition acquire-item.h:69
pkgAcquire::Item::StatTransientNetworkError
@ StatTransientNetworkError
The item was could not be downloaded because of a transient network error (e.g. network down).
Definition acquire-item.h:87
pkgAcquire::Item::StatError
@ StatError
An error was encountered while downloading this item.
Definition acquire-item.h:77
pkgAcquire::Item::StatDone
@ StatDone
The item has been successfully downloaded.
Definition acquire-item.h:72
pkgAcquire::Item::StatIdle
@ StatIdle
The item is waiting to be downloaded.
Definition acquire-item.h:66
pkgAcquire::Item::Owner
pkgAcquire *const Owner
The acquire object with which this item is associated.
Definition acquire-item.h:313
pkgAcquire::Item::DescURI
virtual std::string DescURI() const =0
A "descriptive" URI-like string.
pkgAcquire::Item::ShortDesc
virtual std::string ShortDesc() const
Short item description.
Definition acquire-item.cc:868
pkgAcquire::Item::SetActiveSubprocess
void SetActiveSubprocess(std::string const &subprocess)
Set the name of the current active subprocess.
Definition acquire-item.cc:1151
pkgAcquire::Item::Custom600Headers
virtual std::string Custom600Headers() const
Custom headers to be sent to the fetch process.
Definition acquire-item.cc:800
pkgAcquire::Worker
A fetch subprocess.
Definition acquire-worker.h:48
pkgAcquire
The core download scheduler. {{{.
Definition acquire.h:94
pkgAcquire::Add
void Add(Item *Item)
Add the given item to the list of items.
Definition acquire.cc:229
pkgAcquire::pkgAcquire
pkgAcquire(pkgAcquireStatus *Log)
Construct a new pkgAcquire.
Definition acquire.cc:80
pkgAcquire::Failed
@ Failed
Some files failed to download.
Definition acquire.h:267
pkgCache::RlsFileIterator
Definition cacheiterators.h:467
pkgCache::VerIterator
Definition cacheiterators.h:218
pkgRecords
Definition pkgrecords.h:28
pkgSourceList
Definition sourcelist.h:43
pkgcache.h
pkgCache - Structure definitions for the cache file
DiffInfo
Definition acquire-item.h:691
DiffInfo::patch_hashes
HashStringList patch_hashes
Definition acquire-item.h:699
DiffInfo::result_hashes
HashStringList result_hashes
Definition acquire-item.h:696
DiffInfo::download_hashes
HashStringList download_hashes
Definition acquire-item.h:702
DiffInfo::file
std::string file
Definition acquire-item.h:693
pkgAcquire::ItemDesc
Represents a single download source from which an item should be downloaded.
Definition acquire.h:391
pkgAcquire::MethodConfig
Information about the properties of a single acquire method. {{{.
Definition acquire.h:644