[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

bz2 support



Included is a patch to add support for fetching {Sources,Packages}.bz2, in
preference to .gz.  It doesn't automatically fall back.

To enable, add 'deb-bz2' or 'deb-src-bz2' lines to /etc/apt/sources.list.

==
diff -ruN apt-0.5.22/apt-pkg/acquire-item.cc apt-0.5.22.1/apt-pkg/acquire-item.cc
--- apt-0.5.22/apt-pkg/acquire-item.cc	2003-04-20 11:48:55.000000000 -0500
+++ apt-0.5.22.1/apt-pkg/acquire-item.cc	2004-02-23 15:30:29.000000000 -0600
@@ -128,14 +128,37 @@
    }
 }
 									/*}}}*/
-
 // AcqIndex::AcqIndex - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 /* The package file is added to the queue and a second class is
    instantiated to fetch the revision file */
 pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,
 			 string URI,string URIDesc,string ShortDesc) :
-                      Item(Owner), RealURI(URI)
+                      Item(Owner), RealURI(URI), RealExt(".gz"), RealProg("gzip")
+{
+   Decompression = false;
+   Erase = false;
+
+   DestFile = _config->FindDir("Dir::State::lists") + "partial/";
+   DestFile += URItoFileName(URI);
+
+   // Create the item
+   Desc.URI = URI + RealExt;
+   Desc.Description = URIDesc;
+   Desc.Owner = this;
+   Desc.ShortDesc = ShortDesc;
+
+   QueueURI(Desc);
+}
+									/*}}}*/
+// AcqIndex::AcqIndex - Constructor					/*{{{*/
+// ---------------------------------------------------------------------
+/* The package file is added to the queue and a second class is
+   instantiated to fetch the revision file */
+pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,
+			 string URI,string URIDesc,string ShortDesc,
+			 string Ext,string Prog) :
+                      Item(Owner), RealURI(URI), RealExt(Ext), RealProg(Prog)
 {
    Decompression = false;
    Erase = false;
@@ -144,7 +167,7 @@
    DestFile += URItoFileName(URI);

    // Create the item
-   Desc.URI = URI + ".gz";
+   Desc.URI = URI + Ext;
    Desc.Description = URIDesc;
    Desc.Owner = this;
    Desc.ShortDesc = ShortDesc;
@@ -236,9 +259,9 @@

    Decompression = true;
    DestFile += ".decomp";
-   Desc.URI = "gzip:" + FileName;
+   Desc.URI = RealProg + ":" + FileName;
    QueueURI(Desc);
-   Mode = "gzip";
+   Mode = RealProg.c_str();
 }
 									/*}}}*/

diff -ruN apt-0.5.22/apt-pkg/acquire-item.h apt-0.5.22.1/apt-pkg/acquire-item.h
--- apt-0.5.22/apt-pkg/acquire-item.h	2003-04-20 11:48:55.000000000 -0500
+++ apt-0.5.22.1/apt-pkg/acquire-item.h	2004-02-23 15:49:22.000000000 -0600
@@ -84,8 +84,10 @@

    bool Decompression;
    bool Erase;
-   pkgAcquire::ItemDesc Desc;
    string RealURI;
+   string RealExt;
+   string RealProg;
+   pkgAcquire::ItemDesc Desc;

    public:

@@ -93,10 +95,12 @@
    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 + RealExt;};

    pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
 	       string ShortDesct);
+   pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
+	       string ShortDesct, string Ext, string Prog);
 };

 // Item class for index files
diff -ruN apt-0.5.22/apt-pkg/deb/debindexfile.cc apt-0.5.22.1/apt-pkg/deb/debindexfile.cc
--- apt-0.5.22/apt-pkg/deb/debindexfile.cc	2004-01-04 01:41:30.000000000 -0600
+++ apt-0.5.22.1/apt-pkg/deb/debindexfile.cc	2004-02-23 16:07:24.000000000 -0600
@@ -31,7 +31,19 @@
 // ---------------------------------------------------------------------
 /* */
 debSourcesIndex::debSourcesIndex(string URI,string Dist,string Section) :
-                                     URI(URI), Dist(Dist), Section(Section)
+                                     URI(URI), Dist(Dist), Section(Section),
+				     CompressExt(".gz"), CompressProg("gzip")
+{
+}
+									/*}}}*/
+// SourcesIndex::debSourcesIndex - Constructor				/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+debSourcesIndex::debSourcesIndex(string URI,string Dist,string Section,
+				 string CompressExt, string CompressProg) :
+                                     URI(URI), Dist(Dist), Section(Section),
+				     CompressExt(CompressExt),
+				     CompressProg(CompressProg)
 {
 }
 									/*}}}*/
@@ -134,7 +146,7 @@
 /* */
 bool debSourcesIndex::GetIndexes(pkgAcquire *Owner) const
 {
-   new pkgAcqIndex(Owner,IndexURI("Sources"),Info("Sources"),"Sources");
+   new pkgAcqIndex(Owner,IndexURI("Sources"),Info("Sources"),"Sources",CompressExt,CompressProg);
    new pkgAcqIndexRel(Owner,IndexURI("Release"),Info("Release"),"Release");
    return true;
 }
@@ -163,7 +175,18 @@
 // ---------------------------------------------------------------------
 /* */
 debPackagesIndex::debPackagesIndex(string URI,string Dist,string Section) :
-                  URI(URI), Dist(Dist), Section(Section)
+                  URI(URI), Dist(Dist), Section(Section), CompressExt(".gz"),
+		  CompressProg("gzip")
+{
+}
+									/*}}}*/
+// PackagesIndex::debPackagesIndex - Contructor				/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+debPackagesIndex::debPackagesIndex(string URI,string Dist,string Section,
+				   string CompressExt,string CompressProg) :
+                  URI(URI), Dist(Dist), Section(Section),
+		  CompressExt(CompressExt), CompressProg(CompressProg)
 {
 }
 									/*}}}*/
@@ -251,7 +274,7 @@
 /* */
 bool debPackagesIndex::GetIndexes(pkgAcquire *Owner) const
 {
-   new pkgAcqIndex(Owner,IndexURI("Packages"),Info("Packages"),"Packages");
+   new pkgAcqIndex(Owner,IndexURI("Packages"),Info("Packages"),"Packages",CompressExt,CompressProg);
    new pkgAcqIndexRel(Owner,IndexURI("Release"),Info("Release"),"Release");
    return true;
 }
@@ -460,6 +483,48 @@
 debSLTypeDeb _apt_DebType;
 debSLTypeDebSrc _apt_DebSrcType;
 									/*}}}*/
+// Source List types for Debian						/*{{{*/
+class debSLTypeDebBZ2 : public pkgSourceList::Type
+{
+   public:
+
+   bool CreateItem(vector<pkgIndexFile *> &List,string URI,
+		   string Dist,string Section,
+		   pkgSourceList::Vendor const *Vendor) const
+   {
+      List.push_back(new debPackagesIndex(URI,Dist,Section,".bz2","bzip2"));
+      return true;
+   };
+
+   debSLTypeDebBZ2()
+   {
+      Name = "deb-bz2";
+      Label = "Standard Debian binary tree(bzip2 index)";
+   }
+};
+
+class debSLTypeDebSrcBZ2 : public pkgSourceList::Type
+{
+   public:
+
+   bool CreateItem(vector<pkgIndexFile *> &List,string URI,
+		   string Dist,string Section,
+		   pkgSourceList::Vendor const *Vendor) const
+   {
+      List.push_back(new debSourcesIndex(URI,Dist,Section,".bz2","bzip2"));
+      return true;
+   };
+
+   debSLTypeDebSrcBZ2()
+   {
+      Name = "deb-src-bz2";
+      Label = "Standard Debian source tree(bzip2 index)";
+   }
+};
+
+debSLTypeDebBZ2 _apt_DebBZ2Type;
+debSLTypeDebSrcBZ2 _apt_DebSrcBZ2Type;
+									/*}}}*/
 // Index File types for Debian						/*{{{*/
 class debIFTypeSrc : public pkgIndexFile::Type
 {
diff -ruN apt-0.5.22/apt-pkg/deb/debindexfile.h apt-0.5.22.1/apt-pkg/deb/debindexfile.h
--- apt-0.5.22/apt-pkg/deb/debindexfile.h	2001-04-29 00:13:51.000000000 -0500
+++ apt-0.5.22.1/apt-pkg/deb/debindexfile.h	2004-02-23 16:00:36.000000000 -0600
@@ -48,7 +48,9 @@
    string URI;
    string Dist;
    string Section;
-
+   string CompressExt;
+   string CompressProg;
+
    string Info(const char *Type) const;
    string IndexFile(const char *Type) const;
    string IndexURI(const char *Type) const;
@@ -73,6 +75,7 @@
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;

    debPackagesIndex(string URI,string Dist,string Section);
+   debPackagesIndex(string URI,string Dist,string Section,string CompressExt,string CompressProg);
 };

 class debSourcesIndex : public pkgIndexFile
@@ -80,6 +83,8 @@
    string URI;
    string Dist;
    string Section;
+   string CompressExt;
+   string CompressProg;

    string Info(const char *Type) const;
    string IndexFile(const char *Type) const;
@@ -107,6 +112,7 @@
    virtual unsigned long Size() const;

    debSourcesIndex(string URI,string Dist,string Section);
+   debSourcesIndex(string URI,string Dist,string Section,string CompressExt,string CompressProg);
 };

 #endif
diff -ruN apt-0.5.22/debian/changelog apt-0.5.22.1/debian/changelog
--- apt-0.5.22/debian/changelog	2004-02-09 14:44:54.000000000 -0600
+++ apt-0.5.22.1/debian/changelog	2004-02-23 16:16:38.000000000 -0600
@@ -1,3 +1,13 @@
+apt (0.5.22.1) unstable; urgency=low
+
+  * Patched to support fetching of Packages.bz2(configurable).  This is done
+    by using 'deb-bz2' or 'deb-src-bz2' in sources.list.  (Closes: #37525)
+  * Fix methods/makefile, to include the ssh and bzip2 symlinks.  (Closes:
+    #214842)
+  * Added suggests on bzip2 and ssh.
+
+ -- Adam Heath <doogie@debian.org>  Mon, 23 Feb 2004 16:26:39 -0600
+
 apt (0.5.22) unstable; urgency=low

   * Updated French translation of man pages from Philippe Batailler
diff -ruN apt-0.5.22/debian/control apt-0.5.22.1/debian/control
--- apt-0.5.22/debian/control	2003-08-10 00:26:32.000000000 -0500
+++ apt-0.5.22.1/debian/control	2004-02-23 16:15:33.000000000 -0600
@@ -13,7 +13,7 @@
 Priority: important
 Replaces: libapt-pkg-doc (<< 0.3.7), libapt-pkg-dev (<< 0.3.7)
 Provides: ${libapt-pkg:provides}
-Suggests: aptitude | synaptic | gnome-apt | wajig, dpkg-dev, apt-doc
+Suggests: aptitude | synaptic | gnome-apt | wajig, dpkg-dev, apt-doc, bzip2, ssh
 Section: base
 Description: Advanced front-end for dpkg
  This is Debian's next generation front-end for the dpkg package manager.
diff -ruN apt-0.5.22/methods/makefile apt-0.5.22.1/methods/makefile
--- apt-0.5.22/methods/makefile	2002-11-23 20:22:55.000000000 -0600
+++ apt-0.5.22.1/methods/makefile	2004-02-23 16:13:51.000000000 -0600
@@ -60,7 +60,7 @@
 include $(PROGRAM_H)

 # SSH and vzip2 method symlink
-all: $(BIN)/ssh $(BIN)/bzip2
+binary: $(BIN)/ssh $(BIN)/bzip2
 veryclean: clean-$(BIN)/ssh clean-$(BIN)/bzip2
 $(BIN)/ssh:
 	echo "Installing ssh method link"



Reply to: