]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-item.h
update symbols file
[apt.git] / apt-pkg / acquire-item.h
index d054b96af85e662d52ad1c2014100cd71b55edbb..74b5de67582fa4a6d3a33acc0360569bc4139a75 100644 (file)
@@ -133,7 +133,12 @@ class pkgAcquire::Item : public WeakPointable
    /** \brief If not \b NULL, contains the name of a subprocess that
     *  is operating on this object (for instance, "gzip" or "gpgv").
     */
-   const char *Mode;
+   APT_DEPRECATED const char *Mode;
+
+   /** \brief contains the name of the subprocess that is operating on this object
+    * (for instance, "gzip", "rred" or "gpgv"). This is obsoleting #Mode from above
+    * as it can manage the lifetime of included string properly. */
+   std::string ActiveSubprocess;
 
    /** \brief A client-supplied unique identifier.
     * 
@@ -245,12 +250,12 @@ class pkgAcquire::Item : public WeakPointable
     *
     *  \return a URI that should be used to describe what is being fetched.
     */
-   virtual std::string DescURI() const = 0;
+   virtual std::string DescURI() = 0;
    /** \brief Short item description.
     *
     *  \return a brief description of the object being fetched.
     */
-   virtual std::string ShortDesc() const {return DescURI();}
+   virtual std::string ShortDesc() {return DescURI();}
 
    /** \brief Invoked by the worker when the download is completely done. */
    virtual void Finished() {};
@@ -289,7 +294,8 @@ class pkgAcquire::Item : public WeakPointable
     *  \param Owner The new owner of this item.
     *  \param ExpectedHashes of the file represented by this item
     */
-   Item(pkgAcquire *Owner, HashStringList const &ExpectedHashes);
+   Item(pkgAcquire *Owner,
+        HashStringList const &ExpectedHashes=HashStringList());
 
    /** \brief Remove this item from its owner's queue by invoking
     *  pkgAcquire::Remove.
@@ -346,7 +352,7 @@ class pkgAcqSubIndex : public pkgAcquire::Item
    virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
    virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual std::string DescURI() const {return Desc.URI;};
+   virtual std::string DescURI() {return Desc.URI;};
    virtual std::string Custom600Headers() const;
    virtual bool ParseIndex(std::string const &IndexFile);
 
@@ -364,6 +370,27 @@ class pkgAcqSubIndex : public pkgAcquire::Item
     */
    pkgAcqSubIndex(pkgAcquire *Owner, std::string const &URI,std::string const &URIDesc,
                   std::string const &ShortDesc, HashStringList const &ExpectedHashes);
+};
+                                                                       /*}}}*/
+
+/** \brief Common base class for all classes that deal with fetching   {{{
+           indexes
+ */
+class pkgAcqBaseIndex : public pkgAcquire::Item
+{
+ protected:
+   /** \brief Pointer to the IndexTarget data
+    */
+   const struct IndexTarget * Target;
+   indexRecords *MetaIndexParser;
+
+   pkgAcqBaseIndex(pkgAcquire *Owner,
+                   struct IndexTarget const * const Target,
+                   HashStringList const &ExpectedHashes,
+                   indexRecords *MetaIndexParser)
+      : Item(Owner, ExpectedHashes), Target(Target), 
+        MetaIndexParser(MetaIndexParser) {};
+
 };
                                                                        /*}}}*/
 /** \brief An item that is responsible for fetching an index file of   {{{
@@ -375,7 +402,7 @@ class pkgAcqSubIndex : public pkgAcquire::Item
  *
  *  \sa pkgAcqIndexDiffs, pkgAcqIndex
  */
-class pkgAcqDiffIndex : public pkgAcquire::Item
+class pkgAcqDiffIndex : public pkgAcqBaseIndex
 {
  protected:
    /** \brief If \b true, debugging information will be written to std::clog. */
@@ -396,17 +423,12 @@ class pkgAcqDiffIndex : public pkgAcquire::Item
     */
    std::string Description;
 
-   /** \brief Pointer to the IndexTarget data
-    */
-   const struct IndexTarget * Target;
-   indexRecords *MetaIndexParser;
-
  public:
    // Specialized action members
    virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
    virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual std::string DescURI() const {return RealURI + "Index";};
+   virtual std::string DescURI() {return RealURI + "Index";};
    virtual std::string Custom600Headers() const;
 
    /** \brief Parse the Index file for a set of Packages diffs.
@@ -451,7 +473,7 @@ class pkgAcqDiffIndex : public pkgAcquire::Item
  *
  *  \sa pkgAcqDiffIndex, pkgAcqIndex
  */
-class pkgAcqIndexMergeDiffs : public pkgAcquire::Item
+class pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex
 {
    protected:
 
@@ -499,7 +521,7 @@ class pkgAcqIndexMergeDiffs : public pkgAcquire::Item
    virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
    virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,
         pkgAcquire::MethodConfig *Cnf);
-   virtual std::string DescURI() const {return RealURI + "Index";};
+   virtual std::string DescURI() {return RealURI + "Index";};
 
    /** \brief Create an index merge-diff item.
     *
@@ -522,9 +544,12 @@ class pkgAcqIndexMergeDiffs : public pkgAcquire::Item
     *  \param allPatches contains all related items so that each item can
     *  check if it was the last one to complete the download step
     */
-   pkgAcqIndexMergeDiffs(pkgAcquire *Owner,std::string const &URI,std::string const &URIDesc,
-                   std::string const &ShortDesc, HashStringList const &ExpectedHashes,
-                   DiffInfo const &patch, std::vector<pkgAcqIndexMergeDiffs*> const * const allPatches);
+   pkgAcqIndexMergeDiffs(pkgAcquire *Owner,
+                         struct IndexTarget const * const Target,
+                         HashStringList const &ExpectedHash,
+                         indexRecords *MetaIndexParser,
+                         DiffInfo const &patch, 
+                         std::vector<pkgAcqIndexMergeDiffs*> const * const allPatches);
 };
                                                                        /*}}}*/
 /** \brief An item that is responsible for fetching server-merge patches {{{
@@ -538,7 +563,7 @@ class pkgAcqIndexMergeDiffs : public pkgAcquire::Item
  *
  *  \sa pkgAcqDiffIndex, pkgAcqIndex
  */
-class pkgAcqIndexDiffs : public pkgAcquire::Item
+class pkgAcqIndexDiffs : public pkgAcqBaseIndex
 {
    private:
 
@@ -621,7 +646,7 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
 
    virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual std::string DescURI() const {return RealURI + "Index";};
+   virtual std::string DescURI() {return RealURI + "Index";};
 
    /** \brief Create an index diff item.
     *
@@ -647,8 +672,10 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
     *  should be ordered so that each diff appears before any diff
     *  that depends on it.
     */
-   pkgAcqIndexDiffs(pkgAcquire *Owner,std::string URI,std::string URIDesc,
-                   std::string ShortDesc, HashStringList const &ExpectedHashes,
+   pkgAcqIndexDiffs(pkgAcquire *Owner,
+                    struct IndexTarget const * const Target,
+                    HashStringList const &ExpectedHash,
+                    indexRecords *MetaIndexParser,
                    std::string ServerSha1,
                    std::vector<DiffInfo> diffs=std::vector<DiffInfo>());
 };
@@ -660,7 +687,7 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
  *
  *  \todo Why does pkgAcqIndex have protected members?
  */
-class pkgAcqIndex : public pkgAcquire::Item
+class pkgAcqIndex : public pkgAcqBaseIndex
 {
    protected:
 
@@ -672,15 +699,8 @@ class pkgAcqIndex : public pkgAcquire::Item
     */
    bool Erase;
 
-   /** \brief Verify for correctness by checking if a "Package"
-    *         tag is found in the index. This can be set to
-    *         false for optional index targets
-    *       
-    */
-   // FIXME: instead of a bool it should use a verify string that will
-   //        then be used in the pkgAcqIndex::Done method to ensure that
-   //        the downloaded file contains the expected tag
-   bool Verify;
+   // Unused, used to be used to verify that "Packages: " header was there
+   bool __DELME_ON_NEXT_ABI_BREAK_Verify;
 
    /** \brief The object that is actually being fetched (minus any
     *  compression-related extensions).
@@ -692,10 +712,17 @@ class pkgAcqIndex : public pkgAcquire::Item
     */
    std::string CompressionExtension;
 
-   /** \brief Pointer to the IndexTarget data
+
+   /** \brief Do the changes needed to fetch via AptByHash (if needed) */
+   void InitByHashIfNeeded(const std::string MetaKey);
+
+   /** \brief Get the full pathname of the final file for the given URI
     */
-   const struct IndexTarget * Target;
-   indexRecords *MetaIndexParser;
+   std::string GetFinalFilename(std::string const &URI,
+                                std::string const &compExt);
+
+   /** \brief Schedule file for verification after a IMS hit */
+   void ReverifyAfterIMS(std::string const &FileName);
 
    public:
    
@@ -704,7 +731,7 @@ class pkgAcqIndex : public pkgAcquire::Item
    virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,
                     pkgAcquire::MethodConfig *Cnf);
    virtual std::string Custom600Headers() const;
-   virtual std::string DescURI() const {return Desc.URI;};
+   virtual std::string DescURI() {return Desc.URI;};
 
    /** \brief Create a pkgAcqIndex.
     *
@@ -728,9 +755,12 @@ class pkgAcqIndex : public pkgAcquire::Item
    pkgAcqIndex(pkgAcquire *Owner,std::string URI,std::string URIDesc,
               std::string ShortDesc, HashStringList const &ExpectedHashes,
               std::string compressExt="");
-   pkgAcqIndex(pkgAcquire *Owner, IndexTarget const * const Target,
-                        HashStringList const &ExpectedHashes, indexRecords *MetaIndexParser);
-   void Init(std::string const &URI, std::string const &URIDesc, std::string const &ShortDesc);
+   pkgAcqIndex(pkgAcquire *Owner,
+               IndexTarget const * const Target,
+               HashStringList const &ExpectedHash,
+               indexRecords *MetaIndexParser);
+   void Init(std::string const &URI, std::string const &URIDesc,
+             std::string const &ShortDesc);
 };
                                                                        /*}}}*/
 /** \brief An acquire item that is responsible for fetching a          {{{
@@ -865,7 +895,7 @@ class pkgAcqMetaSig : public pkgAcquire::Item
    virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,
                     pkgAcquire::MethodConfig *Cnf);
    virtual std::string Custom600Headers() const;
-   virtual std::string DescURI() const {return RealURI; };
+   virtual std::string DescURI() {return RealURI; };
 
    /** \brief Create a new pkgAcqMetaSig. */
    pkgAcqMetaSig(pkgAcquire *Owner,std::string URI,std::string URIDesc, std::string ShortDesc,
@@ -958,7 +988,7 @@ class pkgAcqMetaIndex : public pkgAcquire::Item
    virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,
                     pkgAcquire::MethodConfig *Cnf);
    virtual std::string Custom600Headers() const;
-   virtual std::string DescURI() const {return RealURI; };
+   virtual std::string DescURI() {return RealURI; };
 
    /** \brief Create a new pkgAcqMetaIndex. */
    pkgAcqMetaIndex(pkgAcquire *Owner,
@@ -1052,8 +1082,8 @@ class pkgAcqArchive : public pkgAcquire::Item
    virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
    virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual std::string DescURI() const {return Desc.URI;};
-   virtual std::string ShortDesc() const {return Desc.ShortDesc;};
+   virtual std::string DescURI() {return Desc.URI;};
+   virtual std::string ShortDesc() {return Desc.ShortDesc;};
    virtual void Finished();
    virtual bool IsTrusted() const;
    
@@ -1102,7 +1132,7 @@ class pkgAcqFile : public pkgAcquire::Item
    virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
    virtual void Done(std::string Message,unsigned long long Size, HashStringList const &CalcHashes,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual std::string DescURI() const {return Desc.URI;};
+   virtual std::string DescURI() {return Desc.URI;};
    virtual std::string Custom600Headers() const;
 
    /** \brief Create a new pkgAcqFile object.