Am Samstag, den 30.04.2005, 12:12 +0200 schrieb Ola Lundqvist:
> Hello
> 
> On Sat, Apr 30, 2005 at 04:43:17AM +0200, Daniel Leidert wrote:
> > Package: debarchiver
> > Version: 0.1.8
> > Severity: normal
> > Tags: patch
> > 
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > Running debarchiver with apt-ftparchive creates Contents-$arch files.
> > Because packages in binary-all belong to every existing architecture,
> > Content-$arch should contain the content of Content-all too.
> > Content-all(.gz) should be removed. I cannot provide a real diff
> > (included fix for bzip2 support at my local machine), but I attached a
> > file containg the necessary changes, which need to be done to
> > generateIndexConfig() and handleIndex().
> 
> Thanks a lot. Will this apply cleanly? I'm interested in having the
> bzip2 fix too if you do not mind. Or isn't it useful for others?

I sent you the patch a while ago. You said, that you will add the
related variable to debarchiver.conf and apply the patch. Some days ago,
I sent you new READMEs, and you told me too, that you already applied
it. But your CVS does not show a patched debarchiver.pl. I attached a
diff to the current debarchiver script from 0.1.8, containing the
necessary fixes to solve bugs #304532 and #307004. For #304532: The
manpage needs an update to mention the -b|--bzip option and
debarchiver.conf should contain a line 'bzip = 0;' too.

BTW: There is another issue in the manpage: -x | --index says 'config
must be an absolute path to the configuration file to use for
apt-ftparchive generate ...'. debarchiver does not accept a path or a
file as argument. Or am I wrong?

Regards, Daniel
--- /usr/bin/debarchiver	2005-04-13 22:29:44.000000000 +0200
+++ /usr/local/bin/debarchiver2	2005-04-30 13:49:29.374001624 +0200
@@ -34,6 +34,7 @@ $inputdir = "/var/lib/debarchiver/incomi
 $destdir = "/var/lib/debarchiver/dists";
 $cinstall = "installed";
 $lockfile = "debarchiver.lock";
+$bzip2 = 0;
 $etcconfigfile = "/etc/debarchiver.conf";
 $inputconfigfile = "input.conf";
 $verifysignatures = 0;
@@ -213,6 +214,8 @@ options:
 			 packages are installed.
  --autoscansources	Automaticly run dpkg-scansources after all new
 			 packages are installed.
+ -b | --bzip            Create bzip2 compressed Packages.bz2 and Sources.bz2
+			 files. 
  -a | --autoscan       	Does both --autoscanpackages and --autoscansources.
                          Use this *or* --index, not both.
  --scanall		Scan all distributions, sections, etc.
@@ -332,6 +335,9 @@ while ($_ = shift @ARGS2) {
 	}
       }
     }
+    elsif (/^-b$/ || /^--bzip$/) {
+      $bzip = 1;
+    }
     elsif (/^--distinputcriteria/) {
       $distinputcriteria = shift @ARGS2;
     }
@@ -681,6 +687,11 @@ sub handleScan() {
 	cmdaction("gzip $archdest/Sources -c > $archdest/Sources.gz",
 		  "Zip it",
 		  3);
+			if (defined $bzip) {
+	cmdaction("bzip2 $archdest/Sources -c > $archdest/Sources.bz2",
+          "BZip it",
+          3);
+		}
       }
       elsif (defined $autoscanpackages) {
 	cmdaction("dpkg-scanpackages $archdest $over/override 2>&1 > $archdest/Packages.gen",
@@ -711,6 +722,11 @@ sub handleScan() {
 	      cmdaction("gzip $over/$d/Packages -c > $over/$d/Packages.gz",
 			"Zip it",
 			3);
+				if (defined $bzip) {
+				cmdaction("bzip2 $over/$d/Packages -c > $over/$d/Packages.bz2",
+		  "BZip it",
+		  3);
+				}
 	    }
 	  }
 	  closedir DD;
@@ -729,6 +745,11 @@ sub handleScan() {
 	  cmdaction("gzip $archdest/Packages -c > $archdest/Packages.gz",
 		    "Zip it",
 		    3);
+		if (defined $bzip) {
+				cmdaction("bzip2 $archdest/Packages -c > $archdest/Packages.bz2",
+					  "BZip it",
+					  3);
+		}
 	}
       }
     }
@@ -789,6 +810,13 @@ sub generateIndexConfig() {
   print CONF "  ArchiveDir \"$destcdir\";\n";
   print CONF "  Cachedir \"$cachedir\";\n";
   print CONF "};\n\n";
+  print CONF "Default {\n";
+  print CONF "  Packages::Compress \". gzip bzip2\";\n"
+      if defined $bzip;
+  print CONF "  Sources::Compress \". gzip bzip2\";\n"
+      if defined $bzip;
+  print CONF "  Contents::Compress \". gzip\";\n";
+  print CONF "};\n\n";
   print CONF "TreeDefault {\n";
   print CONF "  BinCacheDB \"cache.db\";\n";
   print CONF "  Release::Origin \"$release{origin}\";\n"
@@ -856,6 +884,24 @@ sub handleIndex() {
   foreach $d (keys %changedist) {
     my (@dsections, @darches);
     &findSectionsArchitectures("$destdir/$d", [EMAIL PROTECTED], [EMAIL PROTECTED]);
+    if (-s "$d/Contents-all") {
+      foreach $a (@darches) {
+        next if ($a eq 'source' || $a eq 'all');
+        action(! open(ARCH, ">> $d/Contents-$a"),
+               "Append to $d/Contents-$a",
+               2);
+        action(! open(ALL, "$d/Contents-all"),
+               "Read $d/Contents-all",
+               2);
+        print ARCH <ALL>;
+        close ALL;
+        close ARCH;
+        cmdaction("gzip $d/Contents-$a -c > $d/Contents-$a.gz",
+                  "Compress merged Contents files",
+                  3);
+      }
+    }
+    unlink("$d/Contents-all", "$d/Contents-all.gz");
     foreach $s (@dsections) {
       if (-s "$d/$s/binary-all/Packages") {
         foreach $_ (@darches) {
@@ -872,11 +918,17 @@ sub handleIndex() {
           close ALL;
           close ARCH;
           cmdaction("gzip $d/$s/$a/Packages -c > $d/$s/$a/Packages.gz",
-                    "Compress merged Packages file",
+                    "Compress merged Packages file with gzip",
                     3);
+          if (defined $bzip) {
+          	cmdaction("bzip2 $d/$s/$a/Packages -c > $d/$s/$a/Packages.bz2",
+          	          "Compress merged Packages file with bzip2",
+          	          3);
+          }
         }
       }
-      unlink("$d/$s/binary-all/Packages", "$d/$s/binary-all/Packages.gz");
+      unlink("$d/$s/binary-all/Packages", "$d/$s/binary-all/Packages.gz",
+             "$d/$s/binary-all/Packages.bz2");
     }
   }
 

Reply via email to