The following commit has been merged in the master branch:
commit e215e2795f47feec839025972ac56e647ab04822
Author: Guillem Jover <[email protected]>
Date:   Mon Jun 1 20:06:53 2009 +0200

    libdpkg: Add Multi-Arch field support
    
    This field will allow to satisfy dependencies between packages of
    different architectures (beyond Architecture: all), and co-install
    a package with the same name but different architecture.
    
    The permitted values are:
    
    * “no”
    
      This value is equivalent to the current default, the omission of the
      field.
    
    * “same“
    
      This package is co-installable with itself, but it must not be used to
      satisfy the dependency of any package of a different architecture from
      itself.
    
    * “foreign”
    
      The package is not co-installable with itself, but should be allowed
      to satisfy the dependencies of a package of a different architecture
      from itself.
    
    * “allowed”
    
      This permits the reverse-dependencies of the package to annotate their
      Depends: field to indicate that a foreign architecture version of the
      package satisfies the dependencies, but does not change the resolution
      of any existing dependencies.

diff --git a/lib/dpkg/dpkg-db.h b/lib/dpkg/dpkg-db.h
index 31b4c13..72fb6de 100644
--- a/lib/dpkg/dpkg-db.h
+++ b/lib/dpkg/dpkg-db.h
@@ -4,6 +4,7 @@
  *
  * Copyright © 1994,1995 Ian Jackson <[email protected]>
  * Copyright © 2000,2001 Wichert Akkerman
+ * Copyright © 2006-2011 Guillem Jover <[email protected]>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -108,6 +109,12 @@ struct pkgbin {
   struct deppossi *depended;
   /* The ‘essential’ flag, true = yes, false = no (absent). */
   bool essential;
+  enum pkgmultiarch {
+    multiarch_no,
+    multiarch_same,
+    multiarch_allowed,
+    multiarch_foreign,
+  } multiarch;
   const char *description;
   const char *maintainer;
   const char *source;
@@ -282,6 +289,7 @@ void copy_dependency_links(struct pkginfo *pkg,
 #include <dpkg/namevalue.h>
 
 extern const struct namevalue booleaninfos[];
+extern const struct namevalue multiarchinfos[];
 extern const struct namevalue priorityinfos[];
 extern const struct namevalue statusinfos[];
 extern const struct namevalue eflaginfos[];
diff --git a/lib/dpkg/dump.c b/lib/dpkg/dump.c
index 0e7d682..95cbffa 100644
--- a/lib/dpkg/dump.c
+++ b/lib/dpkg/dump.c
@@ -4,6 +4,7 @@
  *
  * Copyright © 1995 Ian Jackson <[email protected]>
  * Copyright © 2001 Wichert Akkerman
+ * Copyright © 2006,2008-2011 Guillem Jover <[email protected]>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -166,6 +167,26 @@ w_booleandefno(struct varbuf *vb,
 }
 
 void
+w_multiarch(struct varbuf *vb,
+            const struct pkginfo *pigp, const struct pkgbin *pifp,
+            enum fwriteflags flags, const struct fieldinfo *fip)
+{
+  int value = PKGPFIELD(pifp, fip->integer, int);
+
+  if (!(flags & fw_printheader)) {
+    varbuf_add_str(vb, multiarchinfos[value].name);
+    return;
+  }
+  if (!value)
+    return;
+
+  varbuf_add_str(vb, fip->name);
+  varbuf_add_str(vb, ": ");
+  varbuf_add_str(vb, multiarchinfos[value].name);
+  varbuf_add_char(vb, '\n');
+}
+
+void
 w_priority(struct varbuf *vb,
            const struct pkginfo *pigp, const struct pkgbin *pifp,
            enum fwriteflags flags, const struct fieldinfo *fip)
diff --git a/lib/dpkg/fields.c b/lib/dpkg/fields.c
index febe69c..b86587f 100644
--- a/lib/dpkg/fields.c
+++ b/lib/dpkg/fields.c
@@ -4,6 +4,7 @@
  *
  * Copyright © 1995 Ian Jackson <[email protected]>
  * Copyright © 2001 Wichert Akkerman
+ * Copyright © 2006-2011 Guillem Jover <[email protected]>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -157,6 +158,21 @@ f_boolean(struct pkginfo *pigp, struct pkgbin *pifp,
 }
 
 void
+f_multiarch(struct pkginfo *pigp, struct pkgbin *pifp,
+            struct parsedb_state *ps,
+            const char *value, const struct fieldinfo *fip)
+{
+  int multiarch;
+
+  if (!*value)
+    return;
+
+  multiarch = parse_nv_last(ps, _("foreign/allowed/same/no in quadstate 
field"),
+                            multiarchinfos, value);
+  PKGPFIELD(pifp, fip->integer, int) = multiarch;
+}
+
+void
 f_section(struct pkginfo *pigp, struct pkgbin *pifp,
           struct parsedb_state *ps,
           const char *value, const struct fieldinfo *fip)
diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index c31b1f6..1be7351 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -3,6 +3,7 @@
  * parse.c - database file parsing, main package/field loop
  *
  * Copyright © 1995 Ian Jackson <[email protected]>
+ * Copyright © 2006,2008-2011 Guillem Jover <[email protected]>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -51,6 +52,7 @@ const struct fieldinfo fieldinfos[]= {
   { "Package",          f_name,            w_name                              
       },
   { "Essential",        f_boolean,         w_booleandefno,   
PKGIFPOFF(essential)     },
   { "Status",           f_status,          w_status                            
       },
+  { "Multi-Arch",       f_multiarch,       w_multiarch,      
PKGIFPOFF(multiarch)     },
   { "Priority",         f_priority,        w_priority                          
       },
   { "Section",          f_section,         w_section                           
       },
   { "Installed-Size",   f_charfield,       w_charfield,      
PKGIFPOFF(installedsize) },
diff --git a/lib/dpkg/parsedump.h b/lib/dpkg/parsedump.h
index 45735c3..101daca 100644
--- a/lib/dpkg/parsedump.h
+++ b/lib/dpkg/parsedump.h
@@ -4,6 +4,7 @@
  *
  * Copyright © 1995 Ian Jackson <[email protected]>
  * Copyright © 2001 Wichert Akkerman
+ * Copyright © 2008-2011 Guillem Jover <[email protected]>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -70,6 +71,7 @@ typedef void freadfunction(struct pkginfo *pigp, struct 
pkgbin *pifp,
 freadfunction f_name, f_charfield, f_priority, f_section, f_status, 
f_filecharf;
 freadfunction f_boolean, f_dependency, f_conffiles, f_version, f_revision;
 freadfunction f_configversion;
+freadfunction f_multiarch;
 freadfunction f_trigpend, f_trigaw;
 
 enum fwriteflags {
@@ -82,6 +84,7 @@ typedef void fwritefunction(struct varbuf*,
                            enum fwriteflags flags, const struct fieldinfo*);
 fwritefunction w_name, w_charfield, w_priority, w_section, w_status, 
w_configversion;
 fwritefunction w_version, w_null, w_booleandefno, w_dependency, w_conffiles;
+fwritefunction w_multiarch;
 fwritefunction w_filecharf;
 fwritefunction w_trigpend, w_trigaw;
 
diff --git a/lib/dpkg/parsehelp.c b/lib/dpkg/parsehelp.c
index 7a2cfa4..c8e9e40 100644
--- a/lib/dpkg/parsehelp.c
+++ b/lib/dpkg/parsehelp.c
@@ -3,6 +3,7 @@
  * parsehelp.c - helpful routines for parsing and writing
  *
  * Copyright © 1995 Ian Jackson <[email protected]>
+ * Copyright © 2006-2011 Guillem Jover <[email protected]>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -76,6 +77,14 @@ const struct namevalue booleaninfos[] = {
   { .name = NULL }
 };
 
+const struct namevalue multiarchinfos[] = {
+  NAMEVALUE_DEF("no",      multiarch_no),
+  NAMEVALUE_DEF("same",    multiarch_same),
+  NAMEVALUE_DEF("allowed", multiarch_allowed),
+  NAMEVALUE_DEF("foreign", multiarch_foreign),
+  { .name = NULL }
+};
+
 const struct namevalue priorityinfos[] = {
   NAMEVALUE_DEF("required",                      pri_required),
   NAMEVALUE_DEF("important",                     pri_important),
diff --git a/lib/dpkg/pkg.c b/lib/dpkg/pkg.c
index fbd2519..3ae7d27 100644
--- a/lib/dpkg/pkg.c
+++ b/lib/dpkg/pkg.c
@@ -3,7 +3,7 @@
  * pkg.c - primitives for pkg handling
  *
  * Copyright © 1995, 1996 Ian Jackson <[email protected]>
- * Copyright © 2009 Guillem Jover <[email protected]>
+ * Copyright © 2009-2011 Guillem Jover <[email protected]>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -31,6 +31,7 @@ void
 pkgbin_blank(struct pkgbin *pkgbin)
 {
        pkgbin->essential = false;
+       pkgbin->multiarch = multiarch_no;
        pkgbin->depends = NULL;
        pkgbin->depended = NULL;
        pkgbin->description = NULL;
diff --git a/src/processarc.c b/src/processarc.c
index 58e1327..7c0201a 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -1140,6 +1140,7 @@ void process_archive(const char *filename) {
    * can find out what other packages refer to this one. So,
    * we don't copy it. We go straight on to copy the text fields. */
   pkg->installed.essential= pkg->available.essential;
+  pkg->installed.multiarch = pkg->available.multiarch;
   pkg->installed.description= pkg->available.description;
   pkg->installed.maintainer= pkg->available.maintainer;
   pkg->installed.source= pkg->available.source;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to