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

Bug#264952: apt-ftparchive: optionally merge in architecture-independent packages



Package: apt-utils
Version: 0.5.27
Severity: wishlist
File: /usr/bin/apt-ftparchive
Tags: patch

Unless I'm missing something in the documentation, currently apt-ftparchive
doesn't support adding all of the packages in binary-all to the individual
package files for each architecture.  Looking at the Debian archive, this
is the expected behavior, and apt-get doesn't download the binary-all
Package file and therefore will miss any architecture-independent packages
in an archive indexed by apt-ftparchive.

Currently, other tools have to work around this by including all as an
architecture and then merging Package files together, but that doesn't
address the Contents-* files, which have a similar problem.

The attached patch fixes this.  It adds an IncludeAll boolean configuration
option, defaulting to false, that if set to true will include the binary-all
packages in every binary-$(ARCH)/Packages file (and from there, Contents
picks them up).

Please let me know if there are any problems; I'm happy to redo the patch
if needed.

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.4.26
Locale: LANG=C, LC_CTYPE=C (ignored: LC_ALL set to C)

Versions of packages apt-utils depends on:
ii  apt [libapt-pkg-libc6.3-5-3 0.5.26       Advanced front-end for dpkg
ii  libc6                       2.3.2.ds1-13 GNU C Library: Shared libraries an
ii  libdb4.2                    4.2.52-16    Berkeley v4.2 Database Libraries [
ii  libgcc1                     1:3.4.1-5    GCC support library
ii  libstdc++5                  1:3.3.4-3    The GNU Standard C++ Library v3

-- no debconf information
--- apt-0.5.27/ftparchive/apt-ftparchive.cc.orig	2004-01-02 13:48:13.000000000 -0800
+++ apt-0.5.27/ftparchive/apt-ftparchive.cc	2004-08-10 19:36:03.000000000 -0700
@@ -46,6 +46,7 @@
 {
    // General Stuff
    string BaseDir;
+   string AllDir;
    string InternalPrefix;
    string FLFile;
    string PkgExt;
@@ -185,6 +186,9 @@
    {
       if (Packages.RecursiveScan(flCombine(ArchiveDir,BaseDir)) == false)
 	 return false;
+      if (AllDir != "")
+          if (Packages.RecursiveScan(flCombine(ArchiveDir,AllDir)) == false)
+              return false;
    }
    else
    {
@@ -433,6 +437,8 @@
 			    "$(DIST)/$(SECTION)/binary-$(ARCH)/");
    string DSDir = Setup.Find("TreeDefault::SrcDirectory",
 			    "$(DIST)/$(SECTION)/source/");
+   string DADir = Setup.Find("TreeDefault::AllDirectory",
+                             "$(DIST)/$(SECTION)/binary-all/");
    string DPkg = Setup.Find("TreeDefault::Packages",
 			    "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages");
    string DIPrfx = Setup.Find("TreeDefault::InternalPrefix",
@@ -447,6 +453,9 @@
    string DFLFile = Setup.Find("TreeDefault::FileList", "");
    string DSFLFile = Setup.Find("TreeDefault::SourceFileList", "");
 
+   // Whether to include binary-all in each binary-$(ARCH).
+   bool IncludeAll = Setup.FindB("TreeDefault::IncludeAll",false);
+
    // Process 'tree' type sections
    const Configuration::Item *Top = Setup.Tree("tree");
    for (Top = (Top == 0?0:Top->Child); Top != 0;)
@@ -487,6 +496,8 @@
 	    {
 	       Itm.BinCacheDB = SubstVar(Block.Find("BinCacheDB",DBCache.c_str()),Vars);
 	       Itm.BaseDir = SubstVar(Block.Find("Directory",DDir.c_str()),Vars);
+               if (Block.FindB("IncludeAll",IncludeAll))
+                   Itm.AllDir = SubstVar(Block.Find("AllDirectory",DADir.c_str()),Vars);
 	       Itm.PkgFile = SubstVar(Block.Find("Packages",DPkg.c_str()),Vars);
 	       Itm.Tag = SubstVar("$(DIST)/$(SECTION)/$(ARCH)",Vars);
 	       Itm.Contents = SubstVar(Block.Find("Contents",DContents.c_str()),Vars);
--- apt-0.5.27/doc/apt-ftparchive.1.xml.orig	2004-03-11 10:17:08.000000000 -0800
+++ apt-0.5.27/doc/apt-ftparchive.1.xml	2004-08-10 19:56:53.000000000 -0700
@@ -263,6 +264,15 @@
       .debs will be installed, requiring a new file anyhow. The default is 10, 
       the units are in days.</para></listitem>
       </varlistentry>
+
+      <varlistentry><term>IncludeAll</term>
+      <listitem><para>
+      Determines whether all packages in
+      <filename>$(DIST)/$(SECTION)/binary-all/</filename> should be
+      included in the Packages file for each
+      <filename>$(Dest)/$(SECTION)/binary-$(ARCH)/</filename> directory at
+      the same level.  Defaults to false.</para></listitem>
+      </varlistentry>
       
       <varlistentry><term>Directory</term>
       <listitem><para>
@@ -270,6 +280,15 @@
       <filename>$(DIST)/$(SECTION)/binary-$(ARCH)/</filename></para></listitem>
       </varlistentry>
       
+      <varlistentry><term>AllDirectory</term>
+      <listitem><para>
+      Sets the top of the architecture-independent package directory
+      tree, whose contents will be included in the Packages file for each
+      architecture in the same section if <literal>IncludeAll</literal> is
+      set. Defaults to
+      <filename>$(DIST)/$(SECTION)/binary-all/</filename></para></listitem>
+      </varlistentry>
+      
       <varlistentry><term>SrcDirectory</term>
       <listitem><para>
       Sets the top of the source package directory tree. Defaults to

Reply to: