]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-item.h
* merged with michael.vogt@ubuntu.com--2005/apt--mvo--0 to be in sync with debian
[apt.git] / apt-pkg / acquire-item.h
index ea71153d50e0428d5779e3433736502b36a43fd4..3a6e93b1afd5a4da570795d7b4a6ddba126774f6 100644 (file)
@@ -82,6 +82,70 @@ class pkgAcquire::Item
    virtual ~Item();
 };
 
+// item for index diffs
+
+struct DiffInfo {
+   string file;
+   string sha1;
+   unsigned long size;
+};
+
+class pkgAcqDiffIndex : public pkgAcquire::Item
+{
+ protected:
+   bool Debug;
+   pkgAcquire::ItemDesc Desc;
+   string RealURI;
+   string ExpectedMD5;
+   string CurrentPackagesFile;
+   string Description;
+
+ 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 Description;
+   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";};
+
+   // 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
 {
@@ -92,7 +156,8 @@ class pkgAcqIndex : public pkgAcquire::Item
    pkgAcquire::ItemDesc Desc;
    string RealURI;
    string ExpectedMD5;
-   
+   string CompressionExtension;
+
    public:
    
    // Specialized action members
@@ -100,7 +165,7 @@ class pkgAcqIndex : public pkgAcquire::Item
    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="");