]> git.saurik.com Git - apt.git/blame - apt-pkg/acquire-item.h
deal better with acquiring the same URI multiple times
[apt.git] / apt-pkg / acquire-item.h
CommitLineData
0118833a
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
7db98ffc 3// $Id: acquire-item.h,v 1.26.2.3 2004/01/02 18:51:00 mdz Exp $
0118833a
AL
4/* ######################################################################
5
6 Acquire Item - Item to acquire
7
8 When an item is instantiated it will add it self to the local list in
448c38bd
DK
9 the Owner Acquire class. Derived classes will then call QueueURI to
10 register all the URI's they wish to fetch at the initial moment.
11
770c32ec 12 Three item classes are provided to provide functionality for
a52f938b 13 downloading of Index, Translation and Packages files.
448c38bd 14
495e5cb2 15 A Archive class is provided for downloading .deb files. It does Hash
17caf1b1 16 checking and source location as well as a retry algorithm.
448c38bd 17
0118833a
AL
18 ##################################################################### */
19 /*}}}*/
20#ifndef PKGLIB_ACQUIRE_ITEM_H
21#define PKGLIB_ACQUIRE_ITEM_H
22
23#include <apt-pkg/acquire.h>
e3c1cfc7 24#include <apt-pkg/indexfile.h>
495e5cb2 25#include <apt-pkg/hashes.h>
229fb1a3 26#include <apt-pkg/weakptr.h>
472ff00e 27#include <apt-pkg/pkgcache.h>
453b82a3
DK
28#include <apt-pkg/cacheiterators.h>
29
30#include <string>
31#include <vector>
d3a869e3 32#include <map>
0118833a 33
b9dadc24 34#ifndef APT_8_CLEANER_HEADERS
b9dadc24
DK
35#include <apt-pkg/vendor.h>
36#include <apt-pkg/sourcelist.h>
37#include <apt-pkg/pkgrecords.h>
38#include <apt-pkg/indexrecords.h>
39#endif
40
3174e150
MV
41/** \addtogroup acquire
42 * @{
43 *
44 * \file acquire-item.h
45 */
46
472ff00e
DK
47class indexRecords;
48class pkgRecords;
49class pkgSourceList;
715c65de 50class pkgAcqMetaBase;
472ff00e 51
448c38bd
DK
52class pkgAcquire::Item : public WeakPointable /*{{{*/
53/** \brief Represents the process by which a pkgAcquire object should
3174e150
MV
54 * retrieve a file or a collection of files.
55 *
56 * By convention, Item subclasses should insert themselves into the
57 * acquire queue when they are created by calling QueueURI(), and
58 * remove themselves by calling Dequeue() when either Done() or
59 * Failed() is invoked. Item objects are also responsible for
60 * notifying the download progress indicator (accessible via
61 * #Owner->Log) of their status.
62 *
63 * \see pkgAcquire
64 */
448c38bd 65{
0118833a
AL
66 public:
67
3174e150
MV
68 /** \brief The current status of this item. */
69 enum ItemState
70 {
71 /** \brief The item is waiting to be downloaded. */
72 StatIdle,
73
74 /** \brief The item is currently being downloaded. */
75 StatFetching,
76
77 /** \brief The item has been successfully downloaded. */
78 StatDone,
79
80 /** \brief An error was encountered while downloading this
81 * item.
82 */
83 StatError,
84
85 /** \brief The item was downloaded but its authenticity could
86 * not be verified.
87 */
6ca714d5
MV
88 StatAuthError,
89
448c38bd 90 /** \brief The item was could not be downloaded because of
6ca714d5
MV
91 * a transient network error (e.g. network down)
92 */
56472095 93 StatTransientNetworkError,
3174e150
MV
94 } Status;
95
96 /** \brief Contains a textual description of the error encountered
255c9e4b 97 * if #ItemState is #StatError or #StatAuthError.
3174e150 98 */
472ff00e 99 std::string ErrorText;
3174e150
MV
100
101 /** \brief The size of the object to fetch. */
e2c66de5 102 unsigned long long FileSize;
3174e150
MV
103
104 /** \brief How much of the object was already fetched. */
e2c66de5 105 unsigned long long PartialSize;
3174e150
MV
106
107 /** \brief If not \b NULL, contains the name of a subprocess that
108 * is operating on this object (for instance, "gzip" or "gpgv").
109 */
ffbe056d
DK
110 APT_DEPRECATED const char *Mode;
111
112 /** \brief contains the name of the subprocess that is operating on this object
113 * (for instance, "gzip", "rred" or "gpgv"). This is obsoleting #Mode from above
114 * as it can manage the lifetime of included string properly. */
115 std::string ActiveSubprocess;
3174e150
MV
116
117 /** \brief A client-supplied unique identifier.
448c38bd 118 *
3174e150
MV
119 * This field is initalized to 0; it is meant to be filled in by
120 * clients that wish to use it to uniquely identify items.
121 *
448c38bd 122 * APT progress reporting will store an ID there as shown in "Get:42 …"
3174e150 123 */
b98f2859 124 unsigned long ID;
3174e150
MV
125
126 /** \brief If \b true, the entire object has been successfully fetched.
127 *
128 * Subclasses should set this to \b true when appropriate.
129 */
8267fe24 130 bool Complete;
3174e150
MV
131
132 /** \brief If \b true, the URI of this object is "local".
133 *
134 * The only effect of this field is to exclude the object from the
135 * download progress indicator's overall statistics.
136 */
a6568219 137 bool Local;
448c38bd 138
472ff00e 139 std::string UsedMirror;
30e1eab5 140
3174e150
MV
141 /** \brief The number of fetch queues into which this item has been
142 * inserted.
143 *
144 * There is one queue for each source from which an item could be
145 * downloaded.
146 *
147 * \sa pkgAcquire
148 */
0118833a 149 unsigned int QueueCounter;
d0cfa8ad
MV
150
151 /** \brief The number of additional fetch items that are expected
152 * once this item is done.
153 *
154 * Some items like pkgAcqMeta{Index,Sig} will queue additional
155 * items. This variable can be set by the methods if it knows
156 * in advance how many items to expect to get a more accurate
157 * progress.
158 */
159 unsigned int ExpectedAdditionalItems;
448c38bd 160
3174e150
MV
161 /** \brief The name of the file into which the retrieved object
162 * will be written.
163 */
472ff00e 164 std::string DestFile;
7d8afa39 165
3174e150
MV
166 /** \brief Invoked by the acquire worker when the object couldn't
167 * be fetched.
168 *
169 * This is a branch of the continuation of the fetch process.
170 *
171 * \param Message An RFC822-formatted message from the acquire
172 * method describing what went wrong. Use LookupTag() to parse
173 * it.
174 *
175 * \param Cnf The method via which the worker tried to fetch this object.
176 *
177 * \sa pkgAcqMethod
178 */
448c38bd 179 virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf);
3174e150
MV
180
181 /** \brief Invoked by the acquire worker when the object was
182 * fetched successfully.
183 *
184 * Note that the object might \e not have been written to
185 * DestFile; check for the presence of an Alt-Filename entry in
186 * Message to find the file to which it was really written.
187 *
188 * Done is often used to switch from one stage of the processing
189 * to the next (e.g. fetching, unpacking, copying). It is one
190 * branch of the continuation of the fetch process.
191 *
192 * \param Message Data from the acquire method. Use LookupTag()
193 * to parse it.
b3501edb 194 * \param Hashes The HashSums of the object that was fetched.
3174e150
MV
195 * \param Cnf The method via which the object was fetched.
196 *
197 * \sa pkgAcqMethod
198 */
448c38bd
DK
199 virtual void Done(std::string const &Message, HashStringList const &Hashes,
200 pkgAcquire::MethodConfig const * const Cnf);
3174e150
MV
201
202 /** \brief Invoked when the worker starts to fetch this object.
203 *
204 * \param Message RFC822-formatted data from the worker process.
205 * Use LookupTag() to parse it.
206 *
448c38bd 207 * \param Hashes The expected hashes of the object being fetched.
3174e150
MV
208 *
209 * \sa pkgAcqMethod
210 */
448c38bd 211 virtual void Start(std::string const &Message, unsigned long long const Size);
3174e150
MV
212
213 /** \brief Custom headers to be sent to the fetch process.
214 *
215 * \return a string containing RFC822-style headers that are to be
216 * inserted into the 600 URI Acquire message sent to the fetch
217 * subprocess. The headers are inserted after a newline-less
218 * line, so they should (if nonempty) have a leading newline and
219 * no trailing newline.
220 */
448c38bd 221 virtual std::string Custom600Headers() const;
3174e150
MV
222
223 /** \brief A "descriptive" URI-like string.
224 *
225 * \return a URI that should be used to describe what is being fetched.
226 */
448c38bd 227 virtual std::string DescURI() const = 0;
3174e150
MV
228 /** \brief Short item description.
229 *
230 * \return a brief description of the object being fetched.
231 */
448c38bd 232 virtual std::string ShortDesc() const;
3174e150
MV
233
234 /** \brief Invoked by the worker when the download is completely done. */
448c38bd
DK
235 virtual void Finished();
236
237 /** \return HashSums the DestFile is supposed to have in this stage */
238 virtual HashStringList GetExpectedHashes() const = 0;
239 /** \return the 'best' hash for display proposes like --print-uris */
240 std::string HashSum() const;
241
242 /** \return if having no hashes is a hard failure or not
3174e150 243 *
448c38bd
DK
244 * Idealy this is always \b true for every subclass, but thanks to
245 * historical grow we don't have hashes for all files in all cases
246 * in all steps, so it is slightly more complicated than it should be.
3174e150 247 */
448c38bd 248 virtual bool HashesRequired() const { return true; }
3174e150
MV
249
250 /** \return the acquire process with which this item is associated. */
448c38bd 251 pkgAcquire *GetOwner() const;
08ea7806 252 pkgAcquire::ItemDesc &GetItemDesc();
3174e150
MV
253
254 /** \return \b true if this object is being fetched from a trusted source. */
448c38bd
DK
255 virtual bool IsTrusted() const;
256
702c84fb 257 /** \brief Report mirror problem
448c38bd 258 *
702c84fb
MV
259 * This allows reporting mirror failures back to a centralized
260 * server. The apt-report-mirror-failure script is called for this
448c38bd 261 *
702c84fb
MV
262 * \param FailCode A short failure string that is send
263 */
448c38bd 264 void ReportMirrorFailure(std::string const &FailCode);
36280399 265
eeac6897
MV
266 /** \brief Set the name of the current active subprocess
267 *
268 * See also #ActiveSubprocess
269 */
448c38bd 270 void SetActiveSubprocess(std::string const &subprocess);
eeac6897 271
3174e150
MV
272 /** \brief Initialize an item.
273 *
274 * Adds the item to the list of items known to the acquire
275 * process, but does not place it into any fetch queues (you must
276 * manually invoke QueueURI() to do so).
277 *
3174e150
MV
278 * \param Owner The new owner of this item.
279 */
448c38bd 280 Item(pkgAcquire * const Owner);
3174e150
MV
281
282 /** \brief Remove this item from its owner's queue by invoking
283 * pkgAcquire::Remove.
284 */
0118833a 285 virtual ~Item();
3c8030a4
DK
286
287 protected:
448c38bd
DK
288 /** \brief The acquire object with which this item is associated. */
289 pkgAcquire * const Owner;
290
291 /** \brief The item that is currently being downloaded. */
292 pkgAcquire::ItemDesc Desc;
3c8030a4
DK
293
294 enum RenameOnErrorState {
295 HashSumMismatch,
296 SizeMismatch,
631a7dc7
MV
297 InvalidFormat,
298 SignatureError,
299 NotClearsigned,
146f7715
DK
300 MaximumSizeExceeded,
301 PDiffError,
3c8030a4
DK
302 };
303
304 /** \brief Rename failed file and set error
305 *
306 * \param state respresenting the error we encountered
3c8030a4
DK
307 */
308 bool RenameOnError(RenameOnErrorState const state);
fa3b260f 309
448c38bd
DK
310 /** \brief Insert this item into its owner's queue.
311 *
312 * The method is designed to check if the request would end
313 * in an IMSHit and if it determines that it would, it isn't
314 * queueing the Item and instead sets it to completion instantly.
315 *
316 * \param Item Metadata about this item (its URI and
317 * description).
318 * \return true if the item was inserted, false if IMSHit was detected
319 */
320 virtual bool QueueURI(ItemDesc &Item);
321
322 /** \brief Remove this item from its owner's queue. */
323 void Dequeue();
324
325 /** \brief Rename a file without modifying its timestamp.
326 *
327 * Many item methods call this as their final action.
328 *
329 * \param From The file to be renamed.
330 *
331 * \param To The new name of \a From. If \a To exists it will be
332 * overwritten. If \a From and \a To are equal nothing happens.
333 */
334 bool Rename(std::string const &From, std::string const &To);
335
336 /** \brief Get the full pathname of the final file for the current URI */
337 virtual std::string GetFinalFilename() const;
338
339 private:
340 void *d;
341
342 friend class pkgAcqMetaBase;
343};
344 /*}}}*/
345class APT_HIDDEN pkgAcqTransactionItem: public pkgAcquire::Item /*{{{*/
346/** \brief baseclass for the indexes files to manage them all together */
347{
348 protected:
dcbbb14d 349 IndexTarget const Target;
448c38bd
DK
350 HashStringList GetExpectedHashesFor(std::string const MetaKey) const;
351
352 bool QueueURI(pkgAcquire::ItemDesc &Item);
353
354 public:
355 /** \brief storge name until a transaction is finished */
356 std::string PartialFile;
357
358 /** \brief TransactionManager */
359 pkgAcqMetaBase * const TransactionManager;
360
146f7715
DK
361 enum TransactionStates {
362 TransactionCommit,
363 TransactionAbort,
364 };
365 virtual bool TransactionState(TransactionStates const state);
366
dcbbb14d 367 virtual std::string DescURI() const { return Target.URI; }
448c38bd
DK
368 virtual HashStringList GetExpectedHashes() const;
369 virtual std::string GetMetaKey() const;
370 virtual bool HashesRequired() const;
fa3b260f 371
3174e150 372
dcbbb14d 373 pkgAcqTransactionItem(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager, IndexTarget const Target);
448c38bd 374 virtual ~pkgAcqTransactionItem();
f6d4ab9a 375
448c38bd 376 friend class pkgAcqMetaBase;
002d9943 377};
92fcbfc1 378 /*}}}*/
448c38bd
DK
379class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem /*{{{*/
380/** \brief the manager of a transaction */
e6e89390 381{
60323ed7
MV
382 void *d;
383
e6e89390 384 protected:
448c38bd 385 std::vector<pkgAcqTransactionItem*> Transaction;
715c65de 386
448c38bd 387 public:
c045cc02
MV
388 /** \brief A package-system-specific parser for the meta-index file. */
389 indexRecords *MetaIndexParser;
6bf93605 390 indexRecords *LastMetaIndexParser;
448c38bd 391 protected:
c045cc02
MV
392
393 /** \brief The index files which should be looked up in the meta-index
394 * and then downloaded.
395 */
dcbbb14d 396 std::vector<IndexTarget> const IndexTargets;
c045cc02 397
fa3a96a1
MV
398 /** \brief If \b true, the index's signature is currently being verified.
399 */
400 bool AuthPass;
401
c045cc02
MV
402 /** \brief Starts downloading the individual index files.
403 *
404 * \param verify If \b true, only indices whose expected hashsum
405 * can be determined from the meta-index will be downloaded, and
406 * the hashsums of indices will be checked (reporting
407 * #StatAuthError if there is a mismatch). If verify is \b false,
408 * no hashsum checking will be performed.
409 */
448c38bd 410 void QueueIndexes(bool const verify);
c045cc02 411
f3097647
MV
412 /** \brief Called when a file is finished being retrieved.
413 *
414 * If the file was not downloaded to DestFile, a copy process is
415 * set up to copy it to DestFile; otherwise, Complete is set to \b
416 * true and the file is moved to its final location.
417 *
418 * \param Message The message block received from the fetch
419 * subprocess.
420 */
448c38bd 421 bool CheckDownloadDone(pkgAcqTransactionItem * const I, const std::string &Message, HashStringList const &Hashes) const;
f3097647
MV
422
423 /** \brief Queue the downloaded Signature for verification */
448c38bd 424 void QueueForSignatureVerify(pkgAcqTransactionItem * const I, std::string const &File, std::string const &Signature);
f3097647 425
295d848b 426 virtual std::string Custom600Headers() const;
27e6c17a 427
f3097647
MV
428 /** \brief Called when authentication succeeded.
429 *
430 * Sanity-checks the authenticated file, queues up the individual
431 * index files for download, and saves the signature in the lists
432 * directory next to the authenticated list file.
433 *
434 * \param Message The message block received from the fetch
435 * subprocess.
436 */
448c38bd 437 bool CheckAuthDone(std::string const &Message);
f3097647 438
2d0a7bb4 439 /** Check if the current item should fail at this point */
6bf93605 440 bool CheckStopAuthentication(pkgAcquire::Item * const I, const std::string &Message);
2d0a7bb4 441
f3097647
MV
442 /** \brief Check that the release file is a release file for the
443 * correct distribution.
444 *
445 * \return \b true if no fatal errors were encountered.
446 */
448c38bd 447 bool VerifyVendor(std::string const &Message);
295d848b 448
6bf93605 449 virtual bool TransactionState(TransactionStates const state);
295d848b 450
715c65de 451 public:
ba6b79bd
DK
452 // This refers more to the Transaction-Manager than the actual file
453 bool IMSHit;
454
ba6b79bd 455 virtual bool QueueURI(pkgAcquire::ItemDesc &Item);
448c38bd
DK
456 virtual HashStringList GetExpectedHashes() const;
457 virtual bool HashesRequired() const;
295d848b 458
715c65de 459 // transaction code
448c38bd 460 void Add(pkgAcqTransactionItem * const I);
715c65de 461 void AbortTransaction();
448c38bd 462 bool TransactionHasError() const;
715c65de
MV
463 void CommitTransaction();
464
dce45dbe 465 /** \brief Stage (queue) a copy action when the transaction is committed
fa3a96a1 466 */
448c38bd
DK
467 void TransactionStageCopy(pkgAcqTransactionItem * const I,
468 const std::string &From,
fa3a96a1 469 const std::string &To);
dce45dbe 470 /** \brief Stage (queue) a removal action when the transaction is committed
fa3a96a1 471 */
448c38bd 472 void TransactionStageRemoval(pkgAcqTransactionItem * const I, const std::string &FinalFile);
fa3a96a1 473
6bf93605
DK
474 /** \brief Get the full pathname of the final file for the current URI */
475 virtual std::string GetFinalFilename() const;
476
448c38bd 477 pkgAcqMetaBase(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager,
dcbbb14d 478 std::vector<IndexTarget> const IndexTargets,
448c38bd
DK
479 IndexTarget const &DataTarget,
480 indexRecords* const MetaIndexParser);
e6e89390 481};
dce45dbe 482 /*}}}*/
56472095
MV
483/** \brief An item that is responsible for downloading the meta-index {{{
484 * file (i.e., Release) itself and verifying its signature.
485 *
486 * Once the download and verification are complete, the downloads of
487 * the individual index files are queued up using pkgAcqDiffIndex.
488 * If the meta-index file had a valid signature, the expected hashsums
489 * of the index files will be the md5sums listed in the meta-index;
490 * otherwise, the expected hashsums will be "" (causing the
491 * authentication of the index files to be bypassed).
492 */
dce45dbe 493class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase
56472095 494{
60323ed7
MV
495 void *d;
496
56472095 497 protected:
448c38bd 498 IndexTarget const DetachedSigTarget;
e05672e8
MV
499
500 /** \brief delayed constructor */
448c38bd
DK
501 void Init(std::string const &URIDesc, std::string const &ShortDesc);
502
56472095 503 public:
448c38bd 504 virtual std::string DescURI() const;
631a7dc7 505
56472095 506 // Specialized action members
448c38bd
DK
507 virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf);
508 virtual void Done(std::string const &Message, HashStringList const &Hashes,
509 pkgAcquire::MethodConfig const * const Cnf);
56472095
MV
510 virtual void Finished();
511
512 /** \brief Create a new pkgAcqMetaIndex. */
448c38bd
DK
513 pkgAcqMetaIndex(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager,
514 IndexTarget const &DataTarget, IndexTarget const &DetachedSigTarget,
dcbbb14d 515 std::vector<IndexTarget> const IndexTargets, indexRecords * const MetaIndexParser);
6bf93605
DK
516
517 friend class pkgAcqMetaSig;
518};
519 /*}}}*/
520/** \brief An acquire item that downloads the detached signature {{{
521 * of a meta-index (Release) file, then queues up the release
522 * file itself.
523 *
524 * \todo Why protected members?
525 *
526 * \sa pkgAcqMetaIndex
527 */
448c38bd 528class APT_HIDDEN pkgAcqMetaSig : public pkgAcqTransactionItem
6bf93605
DK
529{
530 void *d;
531
532 pkgAcqMetaIndex * const MetaIndex;
533
534 /** \brief The file we use to verify the MetaIndexFile with (not always set!) */
535 std::string MetaIndexFileSignature;
536
537 protected:
538
6bf93605
DK
539 /** \brief Get the full pathname of the final file for the current URI */
540 virtual std::string GetFinalFilename() const;
541
542 public:
448c38bd 543 virtual bool HashesRequired() const { return false; }
6bf93605
DK
544
545 // Specialized action members
448c38bd
DK
546 virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf);
547 virtual void Done(std::string const &Message, HashStringList const &Hashes,
548 pkgAcquire::MethodConfig const * const Cnf);
6bf93605
DK
549
550 /** \brief Create a new pkgAcqMetaSig. */
dcbbb14d 551 pkgAcqMetaSig(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager, IndexTarget const Target,
448c38bd 552 pkgAcqMetaIndex * const MetaIndex);
6bf93605 553 virtual ~pkgAcqMetaSig();
56472095
MV
554};
555 /*}}}*/
556/** \brief An item repsonsible for downloading clearsigned metaindexes {{{*/
dce45dbe 557class APT_HIDDEN pkgAcqMetaClearSig : public pkgAcqMetaIndex
56472095 558{
60323ed7
MV
559 void *d;
560
448c38bd
DK
561 IndexTarget const ClearsignedTarget;
562 IndexTarget const DetachedDataTarget;
563 IndexTarget const DetachedSigTarget;
56472095
MV
564
565public:
448c38bd 566 virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf);
56472095 567 virtual std::string Custom600Headers() const;
448c38bd
DK
568 virtual void Done(std::string const &Message, HashStringList const &Hashes,
569 pkgAcquire::MethodConfig const * const Cnf);
56472095
MV
570
571 /** \brief Create a new pkgAcqMetaClearSig. */
448c38bd
DK
572 pkgAcqMetaClearSig(pkgAcquire * const Owner,
573 IndexTarget const &ClearsignedTarget,
574 IndexTarget const &DetachedDataTarget,
575 IndexTarget const &DetachedSigTarget,
dcbbb14d 576 std::vector<IndexTarget> const IndexTargets,
448c38bd 577 indexRecords * const MetaIndexParser);
56472095
MV
578 virtual ~pkgAcqMetaClearSig();
579};
580 /*}}}*/
448c38bd
DK
581/** \brief Common base class for all classes that deal with fetching indexes {{{*/
582class APT_HIDDEN pkgAcqBaseIndex : public pkgAcqTransactionItem
c2184314 583{
60323ed7
MV
584 void *d;
585
448c38bd 586 public:
295d848b
DK
587 /** \brief Get the full pathname of the final file for the current URI */
588 virtual std::string GetFinalFilename() const;
589
448c38bd 590 pkgAcqBaseIndex(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager,
dcbbb14d 591 IndexTarget const Target);
c2184314 592};
0b58b3f8 593 /*}}}*/
92fcbfc1 594/** \brief An item that is responsible for fetching an index file of {{{
3174e150
MV
595 * package list diffs and starting the package list's download.
596 *
597 * This item downloads the Index file and parses it, then enqueues
598 * additional downloads of either the individual patches (using
599 * pkgAcqIndexDiffs) or the entire Packages file (using pkgAcqIndex).
600 *
601 * \sa pkgAcqIndexDiffs, pkgAcqIndex
602 */
dce45dbe 603class APT_HIDDEN pkgAcqDiffIndex : public pkgAcqBaseIndex
2237bd01 604{
60323ed7
MV
605 void *d;
606
2237bd01 607 protected:
3174e150 608 /** \brief If \b true, debugging information will be written to std::clog. */
2237bd01 609 bool Debug;
3174e150 610
3174e150
MV
611 /** \brief A description of the Packages file (stored in
612 * pkgAcquire::ItemDesc::Description).
613 */
472ff00e 614 std::string Description;
2237bd01 615
295d848b
DK
616 /** \brief Get the full pathname of the final file for the current URI */
617 virtual std::string GetFinalFilename() const;
618
ba6b79bd 619 virtual bool QueueURI(pkgAcquire::ItemDesc &Item);
146f7715
DK
620
621 virtual bool TransactionState(TransactionStates const state);
2237bd01
MV
622 public:
623 // Specialized action members
448c38bd
DK
624 virtual void Failed(std::string const &Message, pkgAcquire::MethodConfig const * const Cnf);
625 virtual void Done(std::string const &Message, HashStringList const &Hashes,
626 pkgAcquire::MethodConfig const * const Cnf);
dcbbb14d 627 virtual std::string DescURI() const {return Target.URI + "Index";};
b3501edb 628 virtual std::string Custom600Headers() const;
448c38bd 629 virtual std::string GetMetaKey() const;
2237bd01 630
3174e150
MV
631 /** \brief Parse the Index file for a set of Packages diffs.
632 *
633 * Parses the Index file and creates additional download items as
634 * necessary.
635 *
636 * \param IndexDiffFile The name of the Index file.
637 *
638 * \return \b true if the Index file was successfully parsed, \b
639 * false otherwise.
640 */
448c38bd 641 bool ParseDiffIndex(std::string const &IndexDiffFile);
3174e150
MV
642
643 /** \brief Create a new pkgAcqDiffIndex.
644 *
645 * \param Owner The Acquire object that owns this item.
646 *
647 * \param URI The URI of the list file to download.
648 *
649 * \param URIDesc A long description of the list file to download.
650 *
651 * \param ShortDesc A short description of the list file to download.
3174e150 652 */
448c38bd 653 pkgAcqDiffIndex(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager,
dcbbb14d 654 IndexTarget const Target);
ba6b79bd
DK
655 private:
656 APT_HIDDEN void QueueOnIMSHit() const;
002d9943 657};
92fcbfc1 658 /*}}}*/
448c38bd
DK
659struct APT_HIDDEN DiffInfo { /*{{{*/
660 /** The filename of the diff. */
661 std::string file;
662
4f51fd86 663 /** The hashes of the file after the diff is applied */
448c38bd
DK
664 HashStringList result_hashes;
665
4f51fd86 666 /** The hashes of the diff */
448c38bd
DK
667 HashStringList patch_hashes;
668
4f51fd86
DK
669 /** The hashes of the compressed diff */
670 HashStringList download_hashes;
448c38bd
DK
671};
672 /*}}}*/
47d2bc78
DK
673/** \brief An item that is responsible for fetching client-merge patches {{{
674 * that need to be applied to a given package index file.
675 *
676 * Instead of downloading and applying each patch one by one like its
677 * sister #pkgAcqIndexDiffs this class will download all patches at once
678 * and call rred with all the patches downloaded once. Rred will then
679 * merge and apply them in one go, which should be a lot faster – but is
680 * incompatible with server-based merges of patches like reprepro can do.
681 *
682 * \sa pkgAcqDiffIndex, pkgAcqIndex
683 */
dce45dbe 684class APT_HIDDEN pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex
47d2bc78 685{
60323ed7
MV
686 void *d;
687
47d2bc78
DK
688 protected:
689
690 /** \brief If \b true, debugging output will be written to
691 * std::clog.
692 */
693 bool Debug;
694
47d2bc78
DK
695 /** \brief description of the file being downloaded. */
696 std::string Description;
697
698 /** \brief information about the current patch */
699 struct DiffInfo const patch;
700
701 /** \brief list of all download items for the patches */
702 std::vector<pkgAcqIndexMergeDiffs*> const * const allPatches;
703
704 /** The current status of this patch. */
705 enum DiffState
706 {
707 /** \brief The diff is currently being fetched. */
708 StateFetchDiff,
709
710 /** \brief The diff is currently being applied. */
711 StateApplyDiff,
712
713 /** \brief the work with this diff is done */
714 StateDoneDiff,
715
716 /** \brief something bad happened and fallback was triggered */
717 StateErrorDiff
718 } State;
719
720 public:
721 /** \brief Called when the patch file failed to be downloaded.
722 *
723 * This method will fall back to downloading the whole index file
724 * outright; its arguments are ignored.
725 */
448c38bd
DK
726 virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf);
727 virtual void Done(std::string const &Message, HashStringList const &Hashes,
728 pkgAcquire::MethodConfig const * const Cnf);
36795154 729 virtual std::string Custom600Headers() const;
dcbbb14d 730 virtual std::string DescURI() const {return Target.URI + "Index";};
448c38bd
DK
731 virtual HashStringList GetExpectedHashes() const;
732 virtual bool HashesRequired() const;
47d2bc78
DK
733
734 /** \brief Create an index merge-diff item.
735 *
736 * \param Owner The pkgAcquire object that owns this item.
737 *
738 * \param URI The URI of the package index file being
739 * reconstructed.
740 *
741 * \param URIDesc A long description of this item.
742 *
743 * \param ShortDesc A brief description of this item.
744 *
47d2bc78
DK
745 * \param patch contains infos about the patch this item is supposed
746 * to download which were read from the index
747 *
748 * \param allPatches contains all related items so that each item can
749 * check if it was the last one to complete the download step
750 */
448c38bd 751 pkgAcqIndexMergeDiffs(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager,
dcbbb14d 752 IndexTarget const Target, DiffInfo const &patch,
c2184314 753 std::vector<pkgAcqIndexMergeDiffs*> const * const allPatches);
47d2bc78
DK
754};
755 /*}}}*/
756/** \brief An item that is responsible for fetching server-merge patches {{{
3174e150
MV
757 * that need to be applied to a given package index file.
758 *
759 * After downloading and applying a single patch, this item will
760 * enqueue a new pkgAcqIndexDiffs to download and apply the remaining
761 * patches. If no patch can be found that applies to an intermediate
762 * file or if one of the patches cannot be downloaded, falls back to
763 * downloading the entire package index file using pkgAcqIndex.
764 *
765 * \sa pkgAcqDiffIndex, pkgAcqIndex
766 */
dce45dbe 767class APT_HIDDEN pkgAcqIndexDiffs : public pkgAcqBaseIndex
ac5b205a 768{
60323ed7
MV
769 void *d;
770
3174e150
MV
771 private:
772
773 /** \brief Queue up the next diff download.
774 *
775 * Search for the next available diff that applies to the file
776 * that currently exists on disk, and enqueue it by calling
777 * QueueURI().
778 *
779 * \return \b true if an applicable diff was found, \b false
780 * otherwise.
781 */
3809194b 782 APT_HIDDEN bool QueueNextDiff();
3174e150
MV
783
784 /** \brief Handle tasks that must be performed after the item
785 * finishes downloading.
786 *
b3501edb
DK
787 * Dequeues the item and checks the resulting file's hashsums
788 * against ExpectedHashes after the last patch was applied.
3174e150
MV
789 * There is no need to check the md5/sha1 after a "normal"
790 * patch because QueueNextDiff() will check the sha1 later.
791 *
792 * \param allDone If \b true, the file was entirely reconstructed,
793 * and its md5sum is verified.
794 */
448c38bd 795 APT_HIDDEN void Finish(bool const allDone=false);
3174e150 796
ac5b205a 797 protected:
3174e150
MV
798
799 /** \brief If \b true, debugging output will be written to
800 * std::clog.
801 */
ac5b205a 802 bool Debug;
3174e150 803
3174e150 804 /** A description of the file being downloaded. */
472ff00e 805 std::string Description;
3174e150
MV
806
807 /** The patches that remain to be downloaded, including the patch
808 * being downloaded right now. This list should be ordered so
809 * that each diff appears before any diff that depends on it.
810 *
811 * \todo These are indexed by sha1sum; why not use some sort of
812 * dictionary instead of relying on ordering and stripping them
813 * off the front?
814 */
472ff00e 815 std::vector<DiffInfo> available_patches;
8a3207f4 816
3174e150
MV
817 /** The current status of this patch. */
818 enum DiffState
819 {
820 /** \brief The diff is in an unknown state. */
821 StateFetchUnkown,
822
823 /** \brief The diff is currently being fetched. */
824 StateFetchDiff,
3174e150
MV
825
826 /** \brief The diff is currently being applied. */
827 StateApplyDiff
828 } State;
6cb30d01 829
ac5b205a 830 public:
448c38bd 831
3174e150
MV
832 /** \brief Called when the patch file failed to be downloaded.
833 *
834 * This method will fall back to downloading the whole index file
835 * outright; its arguments are ignored.
836 */
448c38bd 837 virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf);
3174e150 838
448c38bd
DK
839 virtual void Done(std::string const &Message, HashStringList const &Hashes,
840 pkgAcquire::MethodConfig const * const Cnf);
36795154 841 virtual std::string Custom600Headers() const;
dcbbb14d 842 virtual std::string DescURI() const {return Target.URI + "IndexDiffs";};
448c38bd
DK
843 virtual HashStringList GetExpectedHashes() const;
844 virtual bool HashesRequired() const;
ac5b205a 845
3174e150
MV
846 /** \brief Create an index diff item.
847 *
848 * After filling in its basic fields, this invokes Finish(true) if
255c9e4b 849 * \a diffs is empty, or QueueNextDiff() otherwise.
3174e150
MV
850 *
851 * \param Owner The pkgAcquire object that owns this item.
852 *
853 * \param URI The URI of the package index file being
854 * reconstructed.
855 *
856 * \param URIDesc A long description of this item.
857 *
858 * \param ShortDesc A brief description of this item.
859 *
3174e150
MV
860 * \param diffs The remaining diffs from the index of diffs. They
861 * should be ordered so that each diff appears before any diff
862 * that depends on it.
863 */
448c38bd 864 pkgAcqIndexDiffs(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager,
dcbbb14d 865 IndexTarget const Target,
448c38bd 866 std::vector<DiffInfo> const &diffs=std::vector<DiffInfo>());
ac5b205a 867};
92fcbfc1
DK
868 /*}}}*/
869/** \brief An acquire item that is responsible for fetching an index {{{
3174e150
MV
870 * file (e.g., Packages or Sources).
871 *
872 * \sa pkgAcqDiffIndex, pkgAcqIndexDiffs, pkgAcqIndexTrans
873 *
874 * \todo Why does pkgAcqIndex have protected members?
875 */
dce45dbe 876class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex
0118833a 877{
60323ed7
MV
878 void *d;
879
0118833a 880 protected:
3174e150 881
651bddad
MV
882 /** \brief The stages the method goes through
883 *
884 * The method first downloads the indexfile, then its decompressed (or
885 * copied) and verified
3174e150 886 */
651bddad
MV
887 enum AllStages {
888 STAGE_DOWNLOAD,
889 STAGE_DECOMPRESS_AND_VERIFY,
890 };
891 AllStages Stage;
3174e150 892
651bddad 893 /** \brief Handle what needs to be done when the download is done */
448c38bd 894 void StageDownloadDone(std::string const &Message,
651bddad 895 HashStringList const &Hashes,
448c38bd 896 pkgAcquire::MethodConfig const * const Cfg);
651bddad
MV
897
898 /** \brief Handle what needs to be done when the decompression/copy is
899 * done
3174e150 900 */
448c38bd 901 void StageDecompressDone(std::string const &Message,
651bddad 902 HashStringList const &Hashes,
448c38bd 903 pkgAcquire::MethodConfig const * const Cfg);
3174e150 904
1e8ba0d4
MV
905 /** \brief If \b set, this partially downloaded file will be
906 * removed when the download completes.
907 */
908 std::string EraseFileName;
909
5d885723
DK
910 /** \brief The compression-related file extensions that are being
911 * added to the downloaded file one by one if first fails (e.g., "gz bz2").
3174e150 912 */
651bddad
MV
913 std::string CompressionExtensions;
914
915 /** \brief The actual compression extension currently used */
1e8ba0d4 916 std::string CurrentCompressionExtension;
13e8426f 917
59194959 918 /** \brief Do the changes needed to fetch via AptByHash (if needed) */
448c38bd 919 void InitByHashIfNeeded();
59194959 920
56472095
MV
921 /** \brief Auto select the right compression to use */
922 void AutoSelectCompression();
923
63b7249e 924 /** \brief Schedule file for verification after a IMS hit */
916b8910 925 void ReverifyAfterIMS();
63b7249e 926
295d848b
DK
927 /** \brief Get the full pathname of the final file for the current URI */
928 virtual std::string GetFinalFilename() const;
929
146f7715
DK
930 virtual bool TransactionState(TransactionStates const state);
931
0118833a 932 public:
17caf1b1 933 // Specialized action members
448c38bd
DK
934 virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf);
935 virtual void Done(std::string const &Message, HashStringList const &Hashes,
936 pkgAcquire::MethodConfig const * const Cnf);
b3501edb 937 virtual std::string Custom600Headers() const;
448c38bd
DK
938 virtual std::string DescURI() const {return Desc.URI;};
939 virtual std::string GetMetaKey() const;
940
941 pkgAcqIndex(pkgAcquire * const Owner, pkgAcqMetaBase * const TransactionManager,
dcbbb14d 942 IndexTarget const Target);
0118833a 943
0b58b3f8
MV
944 void Init(std::string const &URI, std::string const &URIDesc,
945 std::string const &ShortDesc);
0118833a 946};
92fcbfc1 947 /*}}}*/
92fcbfc1 948/** \brief An item that is responsible for fetching a package file. {{{
3174e150
MV
949 *
950 * If the package file already exists in the cache, nothing will be
951 * done.
952 */
03e39e59
AL
953class pkgAcqArchive : public pkgAcquire::Item
954{
60323ed7
MV
955 void *d;
956
448c38bd
DK
957 bool LocalSource;
958 HashStringList ExpectedHashes;
959
03e39e59 960 protected:
3174e150 961 /** \brief The package version being fetched. */
03e39e59 962 pkgCache::VerIterator Version;
3174e150 963
3174e150
MV
964 /** \brief The list of sources from which to pick archives to
965 * download this package from.
966 */
03e39e59 967 pkgSourceList *Sources;
3174e150
MV
968
969 /** \brief A package records object, used to look up the file
970 * corresponding to each version of the package.
971 */
03e39e59 972 pkgRecords *Recs;
3174e150 973
3174e150
MV
974 /** \brief A location in which the actual filename of the package
975 * should be stored.
976 */
472ff00e 977 std::string &StoreFilename;
3174e150
MV
978
979 /** \brief The next file for this version to try to download. */
b185acc2 980 pkgCache::VerFileIterator Vf;
3174e150
MV
981
982 /** \brief How many (more) times to try to find a new source from
983 * which to download this package version if it fails.
984 *
985 * Set from Acquire::Retries.
986 */
7d8afa39 987 unsigned int Retries;
3174e150
MV
988
989 /** \brief \b true if this version file is being downloaded from a
990 * trusted source.
991 */
448c38bd 992 bool Trusted;
17caf1b1 993
3174e150 994 /** \brief Queue up the next available file for this version. */
b185acc2 995 bool QueueNext();
295d848b
DK
996
997 /** \brief Get the full pathname of the final file for the current URI */
998 virtual std::string GetFinalFilename() const;
999
03e39e59 1000 public:
295d848b 1001
448c38bd
DK
1002 virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf);
1003 virtual void Done(std::string const &Message, HashStringList const &Hashes,
1004 pkgAcquire::MethodConfig const * const Cnf);
1005 virtual std::string DescURI() const;
1006 virtual std::string ShortDesc() const;
ab559b35 1007 virtual void Finished();
b3501edb 1008 virtual bool IsTrusted() const;
448c38bd
DK
1009 virtual HashStringList GetExpectedHashes() const;
1010 virtual bool HashesRequired() const;
02e20767 1011
3174e150
MV
1012 /** \brief Create a new pkgAcqArchive.
1013 *
1014 * \param Owner The pkgAcquire object with which this item is
1015 * associated.
1016 *
1017 * \param Sources The sources from which to download version
1018 * files.
1019 *
1020 * \param Recs A package records object, used to look up the file
1021 * corresponding to each version of the package.
1022 *
1023 * \param Version The package version to download.
1024 *
3c8030a4 1025 * \param[out] StoreFilename A location in which the actual filename of
3174e150
MV
1026 * the package should be stored. It will be set to a guessed
1027 * basename in the constructor, and filled in with a fully
1028 * qualified filename once the download finishes.
1029 */
448c38bd
DK
1030 pkgAcqArchive(pkgAcquire * const Owner,pkgSourceList * const Sources,
1031 pkgRecords * const Recs,pkgCache::VerIterator const &Version,
472ff00e 1032 std::string &StoreFilename);
03e39e59 1033};
92fcbfc1 1034 /*}}}*/
d56e2917
DK
1035/** \brief Retrieve the changelog for the given version {{{
1036 *
1037 * Downloads the changelog to a temporary file it will also remove again
1038 * while it is deconstructed or downloads it to a named location.
1039 */
1040class pkgAcqChangelog : public pkgAcquire::Item
1041{
1042 void *d;
1043 std::string TemporaryDirectory;
1044 std::string const SrcName;
1045 std::string const SrcVersion;
1046
1047 public:
1048 // we will never have hashes for changelogs.
1049 // If you need verified ones, download the deb and extract the changelog.
1050 virtual HashStringList GetExpectedHashes() const { return HashStringList(); }
1051 virtual bool HashesRequired() const { return false; }
1052
1053 // Specialized action members
1054 virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf);
1055 virtual void Done(std::string const &Message, HashStringList const &CalcHashes,
1056 pkgAcquire::MethodConfig const * const Cnf);
1057 virtual std::string DescURI() const {return Desc.URI;};
1058
1059 /** returns the URI to the changelog of this version
1060 *
1061 * @param Ver is the version to get the changelog for
1062 * @return the URI which will be used to acquire the changelog
1063 */
1064 static std::string URI(pkgCache::VerIterator const &Ver);
1065
1066 /** returns the URI to the changelog of this version
1067 *
1068 * \param Rls is the Release file the package comes from
1069 * \param Component in which the package resides, can be empty
1070 * \param SrcName is the source package name
1071 * \param SrcVersion is the source package version
1072 * @return the URI which will be used to acquire the changelog
1073 */
1074 static std::string URI(pkgCache::RlsFileIterator const &Rls,
1075 char const * const Component, char const * const SrcName,
1076 char const * const SrcVersion);
1077
1078 /** returns the URI to the changelog of this version
1079 *
1080 * \param Template URI where CHANGEPATH has to be filled in
1081 * \param Component in which the package resides, can be empty
1082 * \param SrcName is the source package name
1083 * \param SrcVersion is the source package version
1084 * @return the URI which will be used to acquire the changelog
1085 */
1086 static std::string URI(std::string const &Template,
1087 char const * const Component, char const * const SrcName,
1088 char const * const SrcVersion);
1089
1090 /** returns the URI template for this release file
1091 *
1092 * \param Rls is a Release file
1093 * @return the URI template to use for this release file
1094 */
1095 static std::string URITemplate(pkgCache::RlsFileIterator const &Rls);
1096
1097 /** \brief Create a new pkgAcqChangelog object.
1098 *
1099 * \param Owner The pkgAcquire object with which this object is
1100 * associated.
1101 * \param Ver is the version to get the changelog for
1102 * \param DestDir The directory the file should be downloaded into.
1103 * Will be an autocreated (and cleaned up) temporary directory if not set.
1104 * \param DestFilename The filename the file should have in #DestDir
1105 * Defaults to sourcepackagename.changelog if not set.
1106 */
1107 pkgAcqChangelog(pkgAcquire * const Owner, pkgCache::VerIterator const &Ver,
1108 std::string const &DestDir="", std::string const &DestFilename="");
1109
1110 /** \brief Create a new pkgAcqChangelog object.
1111 *
1112 * \param Owner The pkgAcquire object with which this object is
1113 * associated.
1114 * \param Rls is the Release file the package comes from
1115 * \param Component in which the package resides, can be empty
1116 * \param SrcName is the source package name
1117 * \param SrcVersion is the source package version
1118 * \param DestDir The directory the file should be downloaded into.
1119 * Will be an autocreated (and cleaned up) temporary directory if not set.
1120 * \param DestFilename The filename the file should have in #DestDir
1121 * Defaults to sourcepackagename.changelog if not set.
1122 */
1123 pkgAcqChangelog(pkgAcquire * const Owner, pkgCache::RlsFileIterator const &Rls,
1124 char const * const Component, char const * const SrcName, char const * const SrcVersion,
1125 std::string const &DestDir="", std::string const &DestFilename="");
1126
1127 /** \brief Create a new pkgAcqChangelog object.
1128 *
1129 * \param Owner The pkgAcquire object with which this object is
1130 * associated.
1131 * \param URI is to be used to get the changelog
1132 * \param SrcName is the source package name
1133 * \param SrcVersion is the source package version
1134 * \param DestDir The directory the file should be downloaded into.
1135 * Will be an autocreated (and cleaned up) temporary directory if not set.
1136 * \param DestFilename The filename the file should have in #DestDir
1137 * Defaults to sourcepackagename.changelog if not set.
1138 */
1139 pkgAcqChangelog(pkgAcquire * const Owner, std::string const &URI,
1140 char const * const SrcName, char const * const SrcVersion,
1141 std::string const &DestDir="", std::string const &DestFilename="");
1142
1143 virtual ~pkgAcqChangelog();
1144
1145private:
1146 APT_HIDDEN void Init(std::string const &DestDir, std::string const &DestFilename);
1147};
1148 /*}}}*/
92fcbfc1 1149/** \brief Retrieve an arbitrary file to the current directory. {{{
3174e150
MV
1150 *
1151 * The file is retrieved even if it is accessed via a URL type that
1152 * normally is a NOP, such as "file". If the download fails, the
1153 * partial file is renamed to get a ".FAILED" extension.
1154 */
36375005
AL
1155class pkgAcqFile : public pkgAcquire::Item
1156{
60323ed7
MV
1157 void *d;
1158
3174e150
MV
1159 /** \brief How many times to retry the download, set from
1160 * Acquire::Retries.
1161 */
08cfc005 1162 unsigned int Retries;
448c38bd 1163
77278c2b
MV
1164 /** \brief Should this file be considered a index file */
1165 bool IsIndexFile;
1166
448c38bd 1167 HashStringList const ExpectedHashes;
36375005 1168 public:
448c38bd
DK
1169 virtual HashStringList GetExpectedHashes() const;
1170 virtual bool HashesRequired() const;
1171
36375005 1172 // Specialized action members
448c38bd
DK
1173 virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf);
1174 virtual void Done(std::string const &Message, HashStringList const &CalcHashes,
1175 pkgAcquire::MethodConfig const * const Cnf);
1176 virtual std::string DescURI() const {return Desc.URI;};
b3501edb 1177 virtual std::string Custom600Headers() const;
3174e150
MV
1178
1179 /** \brief Create a new pkgAcqFile object.
1180 *
1181 * \param Owner The pkgAcquire object with which this object is
1182 * associated.
1183 *
1184 * \param URI The URI to download.
1185 *
b3501edb
DK
1186 * \param Hashes The hashsums of the file to download, if they are known;
1187 * otherwise empty list.
3174e150
MV
1188 *
1189 * \param Size The size of the file to download, if it is known;
1190 * otherwise 0.
1191 *
1192 * \param Desc A description of the file being downloaded.
1193 *
1194 * \param ShortDesc A brief description of the file being
1195 * downloaded.
39c7baef
MV
1196 *
1197 * \param DestDir The directory the file should be downloaded into.
1198 *
1199 * \param DestFilename The filename+path the file is downloaded to.
1200 *
77278c2b
MV
1201 * \param IsIndexFile The file is considered a IndexFile and cache-control
1202 * headers like "cache-control: max-age=0" are send
39c7baef 1203 *
255c9e4b
DK
1204 * If DestFilename is empty, download to DestDir/\<basename\> if
1205 * DestDir is non-empty, $CWD/\<basename\> otherwise. If
39c7baef
MV
1206 * DestFilename is NOT empty, DestDir is ignored and DestFilename
1207 * is the absolute name to which the file should be downloaded.
3174e150 1208 */
39c7baef 1209
448c38bd
DK
1210 pkgAcqFile(pkgAcquire * const Owner, std::string const &URI, HashStringList const &Hashes, unsigned long long const Size,
1211 std::string const &Desc, std::string const &ShortDesc,
1212 std::string const &DestDir="", std::string const &DestFilename="",
1213 bool const IsIndexFile=false);
36375005 1214};
92fcbfc1 1215 /*}}}*/
3174e150
MV
1216/** @} */
1217
0118833a 1218#endif