Browse Source

libdpkg: Uppercase and namespace pkgmultiarch enum values

Guillem Jover 10 years ago
parent
commit
befc7844fd

+ 2 - 2
lib/dpkg/depcon.c

@@ -58,12 +58,12 @@ deparchsatisfied(struct pkgbin *it, const struct dpkg_arch *it_arch,
 	const struct dpkg_arch *dep_arch, *pkg_arch;
 
 	if (against->arch_is_implicit &&
-	    it->multiarch == multiarch_foreign)
+	    it->multiarch == PKG_MULTIARCH_FOREIGN)
 		return true;
 
 	dep_arch = against->arch;
 	if (dep_arch->type == DPKG_ARCH_WILDCARD &&
-	    (it->multiarch == multiarch_allowed ||
+	    (it->multiarch == PKG_MULTIARCH_ALLOWED ||
 	     against->up->type == dep_conflicts ||
 	     against->up->type == dep_replaces ||
 	     against->up->type == dep_breaks))

+ 4 - 4
lib/dpkg/dpkg-db.h

@@ -93,10 +93,10 @@ struct filedetails {
 };
 
 enum pkgmultiarch {
-	multiarch_no,
-	multiarch_same,
-	multiarch_allowed,
-	multiarch_foreign,
+	PKG_MULTIARCH_NO,
+	PKG_MULTIARCH_SAME,
+	PKG_MULTIARCH_ALLOWED,
+	PKG_MULTIARCH_FOREIGN,
 };
 
 /**

+ 8 - 8
lib/dpkg/parse.c

@@ -209,11 +209,11 @@ pkg_parse_verify(struct parsedb_state *ps,
     pkgbin->arch = dpkg_arch_get(DPKG_ARCH_EMPTY);
 
   if (pkgbin->arch->type == DPKG_ARCH_EMPTY &&
-      pkgbin->multiarch == multiarch_same)
+      pkgbin->multiarch == PKG_MULTIARCH_SAME)
     parse_error(ps, _("package has field '%s' but is missing architecture"),
                 "Multi-Arch: same");
   if (pkgbin->arch->type == DPKG_ARCH_ALL &&
-      pkgbin->multiarch == multiarch_same)
+      pkgbin->multiarch == PKG_MULTIARCH_SAME)
     parse_error(ps, _("package has field '%s' but is architecture all"),
                 "Multi-Arch: same");
 
@@ -310,7 +310,7 @@ parse_count_pkg_instance(struct pkgcount *count,
   if (pkg->status == stat_notinstalled)
      return;
 
-  if (pkgbin->multiarch == multiarch_same)
+  if (pkgbin->multiarch == PKG_MULTIARCH_SAME)
     count->multi++;
   else
     count->single++;
@@ -376,7 +376,7 @@ parse_find_set_slot(struct parsedb_state *ps,
  * slot architecture, because cross-grading is just not possible.
  *
  * If there's 1 instance, we are cross-grading and both installed and
- * candidate are not multiarch_same, we have to reuse the existing single
+ * candidate are not PKG_MULTIARCH_SAME, we have to reuse the existing single
  * slot regardless of the arch differing between the two. If we are not
  * cross-grading, then we use the entry with the matching arch.
  */
@@ -394,7 +394,7 @@ parse_find_pkg_slot(struct parsedb_state *ps,
      * “Multi-Arch: same”, then we preserve the previous behaviour of
      * possible architecture switch, for example from native to all. */
     if (pkgset_installed_instances(db_set) == 1 &&
-        new_pkgbin->multiarch != multiarch_same)
+        new_pkgbin->multiarch != PKG_MULTIARCH_SAME)
       return pkg_db_get_singleton(db_set);
     else
       return pkg_db_get_pkg(db_set, new_pkgbin->arch);
@@ -408,7 +408,7 @@ parse_find_pkg_slot(struct parsedb_state *ps,
 
     /* Verify we don't allow something that will mess up the db. */
     if (pkgset_installed_instances(db_set) > 1 &&
-        !selection && new_pkgbin->multiarch != multiarch_same)
+        !selection && new_pkgbin->multiarch != PKG_MULTIARCH_SAME)
       ohshit(_("%s %s (Multi-Arch: %s) is not co-installable with "
                "%s which has multiple installed instances"),
              pkgbin_name(new_pkg, new_pkgbin, pnaw_always),
@@ -424,8 +424,8 @@ parse_find_pkg_slot(struct parsedb_state *ps,
     if (pkgset_installed_instances(db_set) == 1) {
       db_pkg = pkg_db_get_singleton(db_set);
 
-      if (db_pkg->installed.multiarch == multiarch_same &&
-          new_pkgbin->multiarch == multiarch_same)
+      if (db_pkg->installed.multiarch == PKG_MULTIARCH_SAME &&
+          new_pkgbin->multiarch == PKG_MULTIARCH_SAME)
         return pkg_db_get_pkg(db_set, new_pkgbin->arch);
       else
         return db_pkg;

+ 4 - 4
lib/dpkg/pkg-namevalue.c

@@ -32,10 +32,10 @@ const struct namevalue booleaninfos[] = {
 };
 
 const struct namevalue multiarchinfos[] = {
-	NAMEVALUE_DEF("no",			multiarch_no),
-	NAMEVALUE_DEF("same",			multiarch_same),
-	NAMEVALUE_DEF("allowed",		multiarch_allowed),
-	NAMEVALUE_DEF("foreign",		multiarch_foreign),
+	NAMEVALUE_DEF("no",			PKG_MULTIARCH_NO),
+	NAMEVALUE_DEF("same",			PKG_MULTIARCH_SAME),
+	NAMEVALUE_DEF("allowed",		PKG_MULTIARCH_ALLOWED),
+	NAMEVALUE_DEF("foreign",		PKG_MULTIARCH_FOREIGN),
 	{ .name = NULL }
 };
 

+ 1 - 1
lib/dpkg/pkg-show.c

@@ -43,7 +43,7 @@ pkgbin_name_needs_arch(const struct pkgbin *pkgbin,
 			break;
 		return true;
 	case pnaw_nonambig:
-		if (pkgbin->multiarch != multiarch_same)
+		if (pkgbin->multiarch != PKG_MULTIARCH_SAME)
 			break;
 	/* Fall through. */
 	case pnaw_always:

+ 2 - 2
lib/dpkg/pkg.c

@@ -132,9 +132,9 @@ pkg_blank(struct pkginfo *pkg)
 	 * because they are part of the package specification, and needed
 	 * for selections. */
 	pkg->installed.arch = dpkg_arch_get(DPKG_ARCH_NONE);
-	pkg->installed.multiarch = multiarch_no;
+	pkg->installed.multiarch = PKG_MULTIARCH_NO;
 	pkg->available.arch = dpkg_arch_get(DPKG_ARCH_NONE);
-	pkg->available.multiarch = multiarch_no;
+	pkg->available.multiarch = PKG_MULTIARCH_NO;
 }
 
 void

+ 3 - 3
src/archives.c

@@ -157,7 +157,7 @@ filesavespackage(struct fileinlist *file,
     /* A Multi-Arch: same package can share files and their presence in a
      * third package of the same set is not a sign that we can get rid of
      * it. */
-    if (pkgtobesaved->installed.multiarch == multiarch_same &&
+    if (pkgtobesaved->installed.multiarch == PKG_MULTIARCH_SAME &&
         thirdpkg->set == pkgtobesaved->set)
       continue;
 
@@ -915,8 +915,8 @@ tarobject(void *ctx, struct tar_entry *ti)
        * is allowed when they are not getting in sync, otherwise the
        * file content must match the installed file. */
       if (otherpkg->set == tc->pkg->set &&
-          otherpkg->installed.multiarch == multiarch_same &&
-          tc->pkg->available.multiarch == multiarch_same) {
+          otherpkg->installed.multiarch == PKG_MULTIARCH_SAME &&
+          tc->pkg->available.multiarch == PKG_MULTIARCH_SAME) {
         if (statr == 0 && tc->pkgset_getting_in_sync)
           refcounting = true;
         debug(dbg_eachfiledetail, "tarobject ... shared with %s %s (syncing=%d)",

+ 1 - 1
src/infodb-access.c

@@ -67,7 +67,7 @@ pkg_infodb_foreach(struct pkginfo *pkg, struct pkgbin *pkgbin,
 	/* Make sure to always read and verify the format version. */
 	db_format = pkg_infodb_get_format();
 
-	if (pkgbin->multiarch == multiarch_same &&
+	if (pkgbin->multiarch == PKG_MULTIARCH_SAME &&
 	    db_format == PKG_INFODB_FORMAT_MULTIARCH)
 		pkgname = pkgbin_name(pkg, pkgbin, pnaw_always);
 	else

+ 1 - 1
src/infodb-format.c

@@ -140,7 +140,7 @@ pkg_infodb_get_file(struct pkginfo *pkg, struct pkgbin *pkgbin,
 	varbuf_add_str(&vb, pkg_infodb_get_dir());
 	varbuf_add_char(&vb, '/');
 	varbuf_add_str(&vb, pkg->set->name);
-	if (pkgbin->multiarch == multiarch_same &&
+	if (pkgbin->multiarch == PKG_MULTIARCH_SAME &&
 	    format == PKG_INFODB_FORMAT_MULTIARCH)
 		varbuf_add_archqual(&vb, pkgbin->arch);
 	varbuf_add_char(&vb, '.');

+ 1 - 1
src/infodb-upgrade.c

@@ -126,7 +126,7 @@ pkg_infodb_link_multiarch_files(void)
 		}
 
 		/* Does it need to be upgraded? */
-		if (pkg->installed.multiarch != multiarch_same)
+		if (pkg->installed.multiarch != PKG_MULTIARCH_SAME)
 			continue;
 
 		/* Skip past the full stop. */

+ 4 - 4
src/unpack.c

@@ -323,8 +323,8 @@ pkg_infodb_update(struct pkginfo *pkg, char *cidir, char *cidirrest)
   /* If the old and new versions use a different infodb layout, get rid
    * of the files using the old layout. */
   if (pkg->installed.multiarch != pkg->available.multiarch &&
-      (pkg->installed.multiarch == multiarch_same ||
-       pkg->available.multiarch == multiarch_same)) {
+      (pkg->installed.multiarch == PKG_MULTIARCH_SAME ||
+       pkg->available.multiarch == PKG_MULTIARCH_SAME)) {
     debug(dbg_scripts,
           "process_archive remove old info files after db layout switch");
     pkg_infodb_foreach(pkg, &pkg->installed, pkg_infodb_remove_file);
@@ -1261,8 +1261,8 @@ void process_archive(const char *filename) {
         !otherpkg->clientdata->files) continue;
     /* Do not try to disappear other packages from the same set
      * if they are Multi-Arch: same */
-    if (pkg->installed.multiarch == multiarch_same &&
-        otherpkg->installed.multiarch == multiarch_same &&
+    if (pkg->installed.multiarch == PKG_MULTIARCH_SAME &&
+        otherpkg->installed.multiarch == PKG_MULTIARCH_SAME &&
         otherpkg->set == pkg->set)
       continue;
     debug(dbg_veryverbose, "process_archive checking disappearance %s",