20 #ifndef PKGLIB_ACQUIRE_ITEM_H
21 #define PKGLIB_ACQUIRE_ITEM_H
24 #include <apt-pkg/hashes.h>
25 #include <apt-pkg/weakptr.h>
28 #ifndef APT_8_CLEANER_HEADERS
29 #include <apt-pkg/indexfile.h>
30 #include <apt-pkg/vendor.h>
31 #include <apt-pkg/sourcelist.h>
32 #include <apt-pkg/pkgrecords.h>
33 #include <apt-pkg/indexrecords.h>
85 void Rename(std::string From,std::string To);
154 std::string UsedMirror;
205 virtual void Done(std::string Message,
unsigned long long Size,std::string Hash,
217 virtual void Start(std::string Message,
unsigned long long Size);
233 virtual std::string
DescURI() = 0;
248 virtual std::string
HashSum() {
return std::string();};
287 enum RenameOnErrorState {
335 virtual void Done(std::string Message,
unsigned long long Size,std::string Md5Hash,
339 virtual bool ParseIndex(std::string
const &IndexFile);
398 virtual void Done(std::string Message,
unsigned long long Size,std::string Md5Hash,
456 bool QueueNextDiff();
469 void Finish(
bool allDone=
false);
534 virtual void Done(std::string Message,
unsigned long long Size,std::string Md5Hash,
563 std::vector<DiffInfo> diffs=std::vector<DiffInfo>());
617 virtual void Done(std::string Message,
unsigned long long Size,std::string Md5Hash,
644 std::string compressExt=
"");
647 void Init(std::string
const &
URI, std::string
const &URIDesc, std::string
const &
ShortDesc);
699 virtual bool IsOptional()
const {
702 virtual bool IsSubIndex()
const {
710 virtual bool IsOptional()
const {
718 virtual bool IsSubIndex()
const {
726 virtual bool IsSubIndex()
const {
782 virtual void Done(std::string Message,
unsigned long long Size,std::string Md5Hash,
878 virtual void Done(std::string Message,
unsigned long long Size, std::string Hash,
885 std::string
URI,std::string URIDesc, std::string
ShortDesc,
895 std::string MetaIndexURI;
898 std::string MetaIndexURIDesc;
901 std::string MetaIndexShortDesc;
904 std::string MetaSigURI;
907 std::string MetaSigURIDesc;
910 std::string MetaSigShortDesc;
918 std::string
const &
URI, std::string
const &URIDesc, std::string
const &
ShortDesc,
919 std::string
const &MetaIndexURI, std::string
const &MetaIndexURIDesc, std::string
const &MetaIndexShortDesc,
920 std::string
const &MetaSigURI, std::string
const &MetaSigURIDesc, std::string
const &MetaSigShortDesc,
979 virtual void Done(std::string Message,
unsigned long long Size,std::string Hash,
1027 unsigned int Retries;
1036 virtual void Done(std::string Message,
unsigned long long Size,std::string CalcHash,
1039 virtual std::string
HashSum() {
return ExpectedHash.toStr(); };
1074 std::string Desc, std::string
ShortDesc,
1075 const std::string &DestDir=
"",
const std::string &DestFilename=
"",
1076 bool IsIndexFile=
false);
virtual std::string DescURI()
A "descriptive" URI-like string.
Definition: acquire-item.h:981
unsigned long ID
A client-supplied unique identifier.
Definition: acquire-item.h:140
virtual std::string DescURI()
A "descriptive" URI-like string.
Definition: acquire-item.h:400
The diff is currently being uncompressed.
Definition: acquire-item.h:519
void Dequeue(Item *Item)
Remove all fetch requests for this item from all queues.
Definition: acquire.cc:243
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object couldn't be fetched.
Definition: acquire-item.cc:256
virtual void Done(std::string Message, unsigned long long Size, std::string Md5Hash, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition: acquire-item.cc:268
unsigned long long FileSize
The size of the object to fetch.
Definition: acquire-item.h:123
std::string URI
The URI from which to download this item.
Definition: acquire.h:376
virtual void Done(std::string Message, unsigned long long Size, std::string CalcHash, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition: acquire-item.cc:2065
std::string URI
A URI from which the index file can be downloaded.
Definition: acquire-item.h:686
virtual bool IsTrusted()
Definition: acquire-item.h:254
virtual void Start(std::string Message, unsigned long long Size)
Invoked when the worker starts to fetch this object.
Definition: acquire-item.cc:101
virtual std::string DescURI()
A "descriptive" URI-like string.
Definition: acquire-item.h:536
pkgAcquire::ItemDesc Desc
The item that is currently being downloaded.
Definition: acquire-item.h:326
virtual void Done(std::string Message, unsigned long long Size, std::string Md5Hash, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition: acquire-item.cc:700
virtual ~Item()
Remove this item from its owner's queue by invoking pkgAcquire::Remove.
Definition: acquire-item.cc:58
virtual std::string DescURI()
A "descriptive" URI-like string.
Definition: acquire-item.h:620
pkgAcqDiffIndex(pkgAcquire *Owner, std::string URI, std::string URIDesc, std::string ShortDesc, HashString ExpectedHash)
Create a new pkgAcqDiffIndex.
Definition: acquire-item.cc:335
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object couldn't be fetched.
Definition: acquire-item.cc:67
bool Local
If true, the URI of this object is "local".
Definition: acquire-item.h:153
bool Debug
If true, debugging information will be written to std::clog.
Definition: acquire-item.h:323
std::string ShortDesc
A shorter description of the index file.
Definition: acquire-item.h:692
pkgRecords * Recs
A package records object, used to look up the file corresponding to each version of the package...
Definition: acquire-item.h:948
unsigned int Retries
How many (more) times to try to find a new source from which to download this package version if it f...
Definition: acquire-item.h:966
std::string sha1
Definition: acquire-item.h:307
Represents a single download source from which an item should be downloaded.
Definition: acquire.h:373
virtual std::string Custom600Headers()
Custom headers to be sent to the fetch process.
Definition: acquire-item.h:227
std::string file
Definition: acquire-item.h:304
ItemState
The current status of this item.
Definition: acquire-item.h:90
Information about an subindex index file.
Definition: acquire-item.h:724
pkgCache - Structure definitions for the cache file
virtual std::string Custom600Headers()
Custom headers to be sent to the fetch process.
Definition: acquire-item.cc:245
void Dequeue()
Remove this item from its owner's queue.
Definition: acquire-item.h:74
Item(pkgAcquire *Owner)
Initialize an item.
Definition: acquire-item.cc:47
pkgAcqIndex(pkgAcquire *Owner, std::string URI, std::string URIDesc, std::string ShortDesc, HashString ExpectedHash, std::string compressExt="")
Create a pkgAcqIndex.
Definition: acquire-item.cc:759
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object couldn't be fetched.
Definition: acquire-item.cc:2124
pkgAcqArchive(pkgAcquire *Owner, pkgSourceList *Sources, pkgRecords *Recs, pkgCache::VerIterator const &Version, std::string &StoreFilename)
Create a new pkgAcqArchive.
Definition: acquire-item.cc:1694
Information about an index file.
Definition: acquire-item.h:682
virtual std::string ShortDesc()
Short item description.
Definition: acquire-item.h:238
std::string ServerSha1
Definition: acquire-item.h:507
virtual std::string HashSum()
HashSum.
Definition: acquire-item.h:984
virtual std::string DescURI()=0
A "descriptive" URI-like string.
pkgAcquire::ItemDesc Desc
The fetch command that is currently being processed.
Definition: acquire-item.h:938
pkgAcqSubIndex(pkgAcquire *Owner, std::string const &URI, std::string const &URIDesc, std::string const &ShortDesc, HashString const &ExpectedHash)
Create a new pkgAcqSubIndex.
Definition: acquire-item.cc:220
An acquire item that is responsible for fetching an index {{{ file (e.g., Packages or Sources)...
Definition: acquire-item.h:573
DiffState
Definition: acquire-item.h:510
std::string RealURI
The URI of the package index file that is being reconstructed.
Definition: acquire-item.h:486
An item that is responsible for fetching an index file of {{{ package list diffs and starting the pac...
Definition: acquire-item.h:366
The item is currently being downloaded.
Definition: acquire-item.h:96
HashString ExpectedHash
The Hash that this file should have after download.
Definition: acquire-item.h:330
std::string CompressionExtension
The compression-related file extensions that are being added to the downloaded file one by one if fir...
Definition: acquire-item.h:611
void QueueURI(ItemDesc &Item)
Insert this item into its owner's queue.
Definition: acquire-item.h:70
The diff is currently being fetched.
Definition: acquire-item.h:516
std::string & StoreFilename
A location in which the actual filename of the package should be stored.
Definition: acquire-item.h:956
pkgAcquire::ItemDesc Desc
A description of the item that is currently being downloaded.
Definition: acquire-item.h:481
The core download scheduler. {{{.
Definition: acquire.h:93
An item that is responsible for fetching all the patches {{{ that need to be applied to a given packa...
Definition: acquire-item.h:443
pkgCache::VerFileIterator Vf
The next file for this version to try to download.
Definition: acquire-item.h:959
Definition: sourcelist.h:45
virtual void Done(std::string Message, unsigned long long Size, std::string Hash, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition: acquire-item.cc:111
std::string Description
A description of the index file.
Definition: acquire-item.h:689
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object couldn't be fetched.
Definition: acquire-item.cc:522
Information about an optional index file.
Definition: acquire-item.h:708
An item that is responsible for fetching a SubIndex {{{.
Definition: acquire-item.h:319
virtual std::string HashSum()
HashSum.
Definition: acquire-item.h:621
bool Debug
If true, debugging information will be written to std::clog.
Definition: acquire-item.h:370
An item that is responsible for fetching a package file. {{{.
Definition: acquire-item.h:931
std::string RealURI
The URI of the index file to recreate at our end (either by downloading it or by applying partial pat...
Definition: acquire-item.h:378
virtual void Done(std::string Message, unsigned long long Size, std::string Md5Hash, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition: acquire-item.cc:536
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Called when the patch file failed to be downloaded.
Definition: acquire-item.cc:602
pkgCache::VerIterator Version
The package version being fetched.
Definition: acquire-item.h:935
virtual std::string Custom600Headers()
Custom headers to be sent to the fetch process.
Definition: acquire-item.cc:2144
std::vector< DiffInfo > available_patches
Definition: acquire-item.h:504
unsigned long size
Definition: acquire-item.h:310
pkgAcqIndexDiffs(pkgAcquire *Owner, std::string URI, std::string URIDesc, std::string ShortDesc, HashString ExpectedHash, std::string ServerSha1, std::vector< DiffInfo > diffs=std::vector< DiffInfo >())
Create an index diff item.
Definition: acquire-item.cc:571
pkgAcquire::ItemDesc Desc
The download request that is currently being processed.
Definition: acquire-item.h:598
virtual std::string Custom600Headers()
Custom headers to be sent to the fetch process.
Definition: acquire-item.cc:832
bool Trusted
true if this version file is being downloaded from a trusted source.
Definition: acquire-item.h:971
Definition: cacheiterators.h:185
bool Complete
If true, the entire object has been successfully fetched.
Definition: acquire-item.h:146
std::string Description
Definition: acquire-item.h:494
std::string DestFile
The name of the file into which the retrieved object will be written.
Definition: acquire-item.h:169
Definition: indexrecords.h:20
pkgAcquire::ItemDesc Desc
The item that is currently being downloaded.
Definition: acquire-item.h:373
pkgAcquire * GetOwner()
Definition: acquire-item.h:251
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object couldn't be fetched.
Definition: acquire-item.cc:1968
unsigned long long PartialSize
How much of the object was already fetched.
Definition: acquire-item.h:126
void Rename(std::string From, std::string To)
Rename a file without modifying its timestamp.
Definition: acquire-item.cc:134
bool RenameOnError(RenameOnErrorState const state)
Rename failed file and set error.
Definition: acquire-item.cc:146
virtual std::string Custom600Headers()
Custom headers to be sent to the fetch process.
Definition: acquire-item.cc:383
Represents the process by which a pkgAcquire object should {{{ retrieve a file or a collection of fil...
Definition: acquire-item.h:58
The item was could not be downloaded because of a transient network error (e.g. network down) ...
Definition: acquire-item.h:114
bool Verify
Verify for correctness by checking if a "Package" tag is found in the index. This can be set to false...
Definition: acquire-item.h:593
virtual void Done(std::string Message, unsigned long long Size, std::string Hash, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition: acquire-item.cc:1918
Retrieve an arbitrary file to the current directory. {{{.
Definition: acquire-item.h:1016
virtual std::string ShortDesc()
Short item description.
Definition: acquire-item.h:982
The diff is in an unknown state.
Definition: acquire-item.h:513
The diff is currently being applied.
Definition: acquire-item.h:522
std::string ErrorText
Contains a textual description of the error encountered if #Status is StatError or StatAuthError...
Definition: acquire-item.h:120
The item was downloaded but its authenticity could not be verified.
Definition: acquire-item.h:109
bool Debug
If true, debugging output will be written to std::clog.
Definition: acquire-item.h:476
virtual std::string HashSum()
HashSum.
Definition: acquire-item.h:248
virtual bool IsTrusted()
Definition: acquire-item.cc:2005
void Enqueue(ItemDesc &Item)
Insert the given fetch request into the appropriate queue.
Definition: acquire.cc:200
std::string Description
A description of the Packages file (stored in pkgAcquire::ItemDesc::Description). ...
Definition: acquire-item.h:393
unsigned int QueueCounter
The number of fetch queues into which this item has been inserted.
Definition: acquire-item.h:164
std::string RealURI
The object that is actually being fetched (minus any compression-related extensions).
Definition: acquire-item.h:603
bool Decompression
If true, the index file has been decompressed.
Definition: acquire-item.h:578
virtual std::string HashSum()
HashSum.
Definition: acquire-item.h:1039
virtual void Finished()
Invoked by the worker when the download is completely done.
Definition: acquire-item.cc:2013
virtual void Done(std::string Message, unsigned long long Size, std::string Md5Hash, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition: acquire-item.cc:878
virtual void Finished()
Invoked by the worker when the download is completely done.
Definition: acquire-item.h:241
Information about an subindex index file.
Definition: acquire-item.h:716
HashString ExpectedHash
The expected hashsum of the decompressed index file.
Definition: acquire-item.h:606
virtual std::string DescURI()
A "descriptive" URI-like string.
Definition: acquire-item.h:337
virtual std::string DescURI()
A "descriptive" URI-like string.
Definition: acquire-item.h:1038
HashString ExpectedHash
The Hash that the real index file should have after all patches have been applied.
Definition: acquire-item.h:383
Definition: pkgrecords.h:24
An error was encountered while downloading this item.
Definition: acquire-item.h:104
std::string CurrentPackagesFile
The index file which will be patched to generate the new file.
Definition: acquire-item.h:388
The item is waiting to be downloaded.
Definition: acquire-item.h:93
Information about the properties of a single acquire method. {{{.
Definition: acquire.h:595
pkgSourceList * Sources
The list of sources from which to pick archives to download this package from.
Definition: acquire-item.h:943
pkgAcquire * Owner
The acquire object with which this item is associated.
Definition: acquire-item.h:63
bool Erase
If true, the partially downloaded file will be removed when the download completes.
Definition: acquire-item.h:583
void ReportMirrorFailure(std::string FailCode)
Report mirror problem.
Definition: acquire-item.cc:174
Definition: cacheiterators.h:385
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object couldn't be fetched.
Definition: acquire-item.cc:851
const char * Mode
If not NULL, contains the name of a subprocess that is operating on this object (for instance...
Definition: acquire-item.h:131
bool QueueNext()
Queue up the next available file for this version.
Definition: acquire-item.cc:1780
std::string MetaKey
The key by which this index file should be looked up within the meta signature file.
Definition: acquire-item.h:697
HashString ExpectedHash
The HashSum of the package index file that is being reconstructed.
Definition: acquire-item.h:491
bool ParseDiffIndex(std::string IndexDiffFile)
Parse the Index file for a set of Packages diffs.
Definition: acquire-item.cc:398
HashString ExpectedHash
The hashsum of this package.
Definition: acquire-item.h:951
Information about an index patch (aka diff).
Definition: acquire-item.h:302
pkgAcqFile(pkgAcquire *Owner, std::string URI, std::string Hash, unsigned long long Size, std::string Desc, std::string ShortDesc, const std::string &DestDir="", const std::string &DestFilename="", bool IsIndexFile=false)
Create a new pkgAcqFile object.
Definition: acquire-item.cc:2024
std::string ShortDesc
Definition: acquire.h:380
The item has been successfully downloaded.
Definition: acquire-item.h:99