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

Bug#225947: apt-utils: please support architecture-specific extra overrides



On Sat, Jan 03, 2004 at 12:39:06PM +1000, Anthony Towns wrote:

> Please add support for architecture specific extra overrides to
> apt-ftparchive, to allow writing, eg:
> 
>     abiword/i386       Task    desktop
>     abiword-gnome/i386 Task    desktop
> 
> This support would be useful in two areas in particular. The first is for
> packages whose Priority should be different on different architectures, eg
> if i386 and hppa have different default versions of gcc, then different
> gcc-X.Y packages should have Priority: standard on each architecture. The
> second is for debootstrap, which would like to be able to use a "Base: yes"
> field to determine which packages are in base, but needs to have different
> packages included on different architectures.
> 
> The syntax above is just a suggestion, of course. It makes most sense to me
> just to extend the syntax of extra overrides rather than creating a new file,
> but either way would seem fine.
> 
> I tried implementing this at one point, but got lost in a maze of twisty
> classes, all different. :(
> 
> Hope that all makes sense.

Does this do what you want?

Index: override.h
===================================================================
RCS file: /cvs/deity/apt/ftparchive/override.h,v
retrieving revision 1.4
diff -u -u -r1.4 override.h
--- override.h  26 Jun 2001 02:50:27 -0000      1.4
+++ override.h  4 Jan 2004 03:45:21 -0000
@@ -37,12 +37,23 @@
    };
    
    map<string,Item> Mapping;
+
+   inline Item *GetItem(string Package)
+   {
+      return GetItem(Package, "");
+   }
    
-   inline Item *GetItem(string Package) 
+   inline Item *GetItem(string Package,string Architecture) 
    {
       map<string,Item>::iterator I = Mapping.find(Package);
       if (I == Mapping.end())
-        return 0;
+      {
+         I = Mapping.find(Package + "/" + Architecture);
+         if (I == Mapping.end())
+         {
+            return 0;
+         }
+      }
       return &I->second;
    };
    
Index: writer.cc
===================================================================
RCS file: /cvs/deity/apt/ftparchive/writer.cc,v
retrieving revision 1.13
diff -u -u -r1.13 writer.cc
--- writer.cc   4 Jan 2004 00:20:59 -0000       1.13
+++ writer.cc   4 Jan 2004 03:45:22 -0000
@@ -371,8 +371,9 @@
    // Lookup the overide information
    pkgTagSection &Tags = Db.Control.Section;
    string Package = Tags.FindS("Package");
+   string Architecture = Tags.FindS("Architecture");
    Override::Item Tmp;
-   Override::Item *OverItem = Over.GetItem(Package);
+   Override::Item *OverItem = Over.GetItem(Package,Architecture);
    
    if (Package.empty() == true)
       return _error->Error(_("Archive had no package field"));


-- 
 - mdz



Reply to: