]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-item.h
* merged apt--tasks, this brings in the latest changes from apt--mvo as well
[apt.git] / apt-pkg / acquire-item.h
index f9c1b5b2d39e9224d8d5f30c9e921bc1d4bb04c7..3a0a690e1e86fe3c255619b82094b5230b08ebed 100644 (file)
@@ -9,8 +9,8 @@
    the Owner Acquire class. Derived classes will then call QueueURI to 
    register all the URI's they wish to fetch at the initial moment.   
    
    the Owner Acquire class. Derived classes will then call QueueURI to 
    register all the URI's they wish to fetch at the initial moment.   
    
-   Two item classes are provided to provide functionality for downloading
-   of Index files and downloading of Packages.
+   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 Md5
    checking and source location as well as a retry algorithm.
    
    A Archive class is provided for downloading .deb files. It does Md5
    checking and source location as well as a retry algorithm.
@@ -48,7 +48,8 @@ class pkgAcquire::Item
    public:
 
    // State of the item
    public:
 
    // State of the item
-   enum {StatIdle, StatFetching, StatDone, StatError, StatAuthError} Status;
+   enum {StatIdle, StatFetching, StatDone, StatError, 
+        StatAuthError, StatTransientNetworkError} Status;
    string ErrorText;
    unsigned long FileSize;
    unsigned long PartialSize;   
    string ErrorText;
    unsigned long FileSize;
    unsigned long PartialSize;   
@@ -82,67 +83,6 @@ class pkgAcquire::Item
    virtual ~Item();
 };
 
    virtual ~Item();
 };
 
-// item for index diffs
-class pkgAcqDiffIndex : public pkgAcquire::Item
-{
- protected:
-   bool Debug;
-   string RealURI;
-
- public:
-   // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long Size,string Md5Hash,
-                    pkgAcquire::MethodConfig *Cnf);
-   virtual string DescURI() {return RealURI + "Index";};
-   virtual string Custom600Headers();
-
-   // helpers
-   bool ParseDiffIndex(string IndexDiffFile);
-   
-   pkgAcqDiffIndex(pkgAcquire *Owner,string URI,string URIDesc,
-                  string ShortDesct, string ExpectedMD5);
-}
-
-class pkgAcqIndexDiffs : public pkgAcquire::Item
-{
-   protected:
-   bool Debug;
-   pkgAcquire::ItemDesc Desc;
-   string RealURI;
-   string ExpectedMD5;
-
-   // this is the SHA-1 sum we expect after the patching
-   string ServerSha1;
-   string CurrentPackagesFile;
-   string Description;
-   struct DiffInfo {
-      string file;
-      string sha1;
-      unsigned long size;
-   };
-   vector<DiffInfo> available_patches;
-   enum {StateFetchIndex,StateFetchDiff,StateUnzipDiff,StateApplyDiff} State;
-
-   public:
-   
-   // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long Size,string Md5Hash,
-                    pkgAcquire::MethodConfig *Cnf);
-   virtual string DescURI() {return RealURI + "Index";};
-   virtual string Custom600Headers();
-
-   // various helpers
-   bool QueueNextDiff();
-   bool ApplyDiff(string PatchFile);
-   void Finish(bool allDone=false);
-
-   pkgAcqIndexDiffs(pkgAcquire *Owner,string URI,string URIDesc,
-                   string ShortDesct, string ExpectedMD5,
-                   vector<DiffInfo> diffs=vector<DiffInfo>());
-};
-
 // Item class for index files
 class pkgAcqIndex : public pkgAcquire::Item
 {
 // Item class for index files
 class pkgAcqIndex : public pkgAcquire::Item
 {
@@ -153,6 +93,7 @@ class pkgAcqIndex : public pkgAcquire::Item
    pkgAcquire::ItemDesc Desc;
    string RealURI;
    string ExpectedMD5;
    pkgAcquire::ItemDesc Desc;
    string RealURI;
    string ExpectedMD5;
+   string CompressionExtension;
 
    public:
    
 
    public:
    
@@ -161,12 +102,22 @@ class pkgAcqIndex : public pkgAcquire::Item
    virtual void Done(string Message,unsigned long Size,string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
    virtual string Custom600Headers();
    virtual void Done(string Message,unsigned long Size,string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
    virtual string Custom600Headers();
-   virtual string DescURI() {return RealURI + ".gz";};
+   virtual string DescURI() {return RealURI + CompressionExtension;};
 
    pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
               string ShortDesct, string ExpectedMD5, string compressExt="");
 };
 
 
    pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
               string ShortDesct, string ExpectedMD5, string compressExt="");
 };
 
+// Item class for translated package index files
+class pkgAcqIndexTrans : public pkgAcqIndex
+{
+   public:
+  
+   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
+   pkgAcqIndexTrans(pkgAcquire *Owner,string URI,string URIDesc,
+                   string ShortDesct);
+};
+
 struct IndexTarget
 {
    string URI;
 struct IndexTarget
 {
    string URI;
@@ -211,8 +162,10 @@ class pkgAcqMetaIndex : public pkgAcquire::Item
    const vector<struct IndexTarget*>* IndexTargets;
    indexRecords* MetaIndexParser;
    bool AuthPass;
    const vector<struct IndexTarget*>* IndexTargets;
    indexRecords* MetaIndexParser;
    bool AuthPass;
+   // required to deal gracefully with problems caused by incorrect ims hits
+   bool IMSHit; 
 
 
-   bool VerifyVendor();
+   bool VerifyVendor(string Message);
    void RetrievalDone(string Message);
    void AuthDone(string Message);
    void QueueIndexes(bool verify);
    void RetrievalDone(string Message);
    void AuthDone(string Message);
    void QueueIndexes(bool verify);
@@ -284,9 +237,14 @@ class pkgAcqFile : public pkgAcquire::Item
                     pkgAcquire::MethodConfig *Cnf);
    virtual string MD5Sum() {return Md5Hash;};
    virtual string DescURI() {return Desc.URI;};
                     pkgAcquire::MethodConfig *Cnf);
    virtual string MD5Sum() {return Md5Hash;};
    virtual string DescURI() {return Desc.URI;};
-   
-   pkgAcqFile(pkgAcquire *Owner,string URI,string MD5,unsigned long Size,
-                 string Desc,string ShortDesc);
+
+   // If DestFilename is empty, download to DestDir/<basename> if
+   // DestDir is non-empty, $CWD/<basename> otherwise.  If
+   // DestFilename is NOT empty, DestDir is ignored and DestFilename
+   // is the absolute name to which the file should be downloaded.
+   pkgAcqFile(pkgAcquire *Owner, string URI, string MD5, unsigned long Size,
+             string Desc, string ShortDesc,
+             const string &DestDir="", const string &DestFilename="");
 };
 
 #endif
 };
 
 #endif