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

Bug#217014: apt-utils: [apt-ftparchive] add Architecture filter support



Package: apt-utils
Version: 0.5.14
Severity: wishlist
Tags: patch

Hi,

I'm using apt-ftparchive with a pool style repository, but it did not
filter the debs to be put on Packages depending on Architecture. So
every package in the pool was repeated in every Packages file regardless
of its Architecture.

In the fix I've only set Architecture inside LoadTree to retain the
expected behaviour on the other functions, if you think this is not
desirable I can modify the patch.

I attach the conf I'm using and a patch that solves it. So now I can use
it with my mini-dak almost properly =P (only missing distro filtering).

regards,
guillem
Index: apt-ftparchive.cc
===================================================================
RCS file: /cvs/deity/apt/ftparchive/apt-ftparchive.cc,v
retrieving revision 1.8
diff -u -r1.8 apt-ftparchive.cc
--- apt-ftparchive.cc	18 Jul 2003 15:28:58 -0000	1.8
+++ apt-ftparchive.cc	22 Oct 2003 02:31:04 -0000
@@ -72,6 +72,7 @@
    string CntCompress;
    string SrcCompress;
    string PathPrefix;
+   string Architecture;
    unsigned int DeLinkLimit;
    mode_t Permissions;
    
@@ -168,6 +169,8 @@
    Packages.DirStrip = ArchiveDir;
    Packages.InternalPrefix = flCombine(ArchiveDir,InternalPrefix);
 
+   Packages.Architecture = Architecture;
+
    Packages.Stats.DeLinkBytes = Stats.DeLinkBytes;
    Packages.DeLinkLimit = DeLinkLimit;
 
@@ -472,6 +475,7 @@
 	    
 	    Itm.BinOverride = SubstVar(Block.Find("BinOverride"),Vars);
 	    Itm.InternalPrefix = SubstVar(Block.Find("InternalPrefix",DIPrfx.c_str()),Vars);
+	    Itm.Architecture = Arch;
 
 	    if (stringcasecmp(Arch,"source") == 0)
 	    {
Index: writer.cc
===================================================================
RCS file: /cvs/deity/apt/ftparchive/writer.cc,v
retrieving revision 1.7
diff -u -r1.7 writer.cc
--- writer.cc	10 Feb 2003 07:34:41 -0000	1.7
+++ writer.cc	22 Oct 2003 02:31:05 -0000
@@ -348,8 +348,18 @@
    if (Delink(FileName,OriginalPath,Stats.DeLinkBytes,St) == false)
       return false;
    
-   // Lookup the overide information
    pkgTagSection &Tags = Db.Control.Section;
+
+   // Test for a valid Architecture
+   if (Architecture.empty() == false)
+   {
+      string PackageArchitecture = Tags.FindS("Architecture");
+
+      if (PackageArchitecture != Architecture && PackageArchitecture != "all")
+	  return false;
+   }
+
+   // Lookup the override information
    string Package = Tags.FindS("Package");
    Override::Item Tmp;
    Override::Item *OverItem = Over.GetItem(Package);
Index: writer.h
===================================================================
RCS file: /cvs/deity/apt/ftparchive/writer.h,v
retrieving revision 1.4
diff -u -r1.4 writer.h
--- writer.h	26 Jun 2001 02:50:27 -0000	1.4
+++ writer.h	22 Oct 2003 02:31:05 -0000
@@ -87,6 +87,7 @@
    // General options
    string PathPrefix;
    string DirStrip;
+   string Architecture;
    FILE *Output;
    struct CacheDB::Stats &Stats;
    
Default {
  Packages::Compress	". gzip bzip2";
  Sources::Compress	". gzip bzip2";
};

Dir {
  ArchiveDir		"/site/ftp.gnuab.org";
  OverrideDir		"indices";
  CacheDir		"cache";
};

TreeDefault {
  Directory		"pool/";
  SrcDirectory		"pool/";
};

Tree "dists/unstable" {
  Sections		"main";
  Architectures		"source i386 hurd-i386 freebsd-i386 netbsd-i386";
};

Tree "dists/unreleased" {
  Sections		"main";
  Architectures		"source i386 hurd-i386 freebsd-i386 netbsd-i386";
};


Reply to: