Просмотр исходного кода

libdpkg, dpkg: Use new status to names mapping functions

This gets rid of the need to export the statusinfos and wantinfos
variables from libdpkg.
Guillem Jover лет назад: 12
Родитель
Сommit
f078b51a7d
9 измененных файлов с 21 добавлено и 21 удалено
  1. 3 2
      lib/dpkg/dbmodify.c
  2. 4 4
      lib/dpkg/dump.c
  3. 0 2
      lib/dpkg/libdpkg.map
  4. 3 3
      lib/dpkg/parse.c
  5. 2 2
      src/archives.c
  6. 3 3
      src/configure.c
  7. 2 1
      src/packages.c
  8. 2 2
      src/select.c
  9. 2 2
      src/trigproc.c

+ 3 - 2
lib/dpkg/dbmodify.c

@@ -4,6 +4,7 @@
  *
  * Copyright © 1994,1995 Ian Jackson <ian@chiark.greenend.org.uk>
  * Copyright © 2001 Wichert Akkerman <wichert@debian.org>
+ * Copyright © 2006-2014 Guillem Jover <guillem@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -408,11 +409,11 @@ void modstatdb_note(struct pkginfo *pkg) {
     pkg->trigaw.head = pkg->trigaw.tail = NULL;
   }
 
-  log_message("status %s %s %s", statusinfos[pkg->status].name,
+  log_message("status %s %s %s", pkg_status_name(pkg),
               pkg_name(pkg, pnaw_always),
 	      versiondescribe(&pkg->installed.version, vdew_nonambig));
   statusfd_send("status: %s: %s", pkg_name(pkg, pnaw_nonambig),
-                statusinfos[pkg->status].name);
+                pkg_status_name(pkg));
 
   if (cstatus >= msdbrw_write)
     modstatdb_note_core(pkg);

+ 4 - 4
lib/dpkg/dump.c

@@ -4,7 +4,7 @@
  *
  * Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
  * Copyright © 2001 Wichert Akkerman
- * Copyright © 2006,2008-2012 Guillem Jover <guillem@debian.org>
+ * Copyright © 2006,2008-2014 Guillem Jover <guillem@debian.org>
  * Copyright © 2011 Linaro Limited
  * Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
  *
@@ -283,11 +283,11 @@ w_status(struct varbuf *vb,
 
   if (flags&fw_printheader)
     varbuf_add_str(vb, "Status: ");
-  varbuf_add_str(vb, wantinfos[pkg->want].name);
+  varbuf_add_str(vb, pkg_want_name(pkg));
   varbuf_add_char(vb, ' ');
-  varbuf_add_str(vb, eflaginfos[pkg->eflag].name);
+  varbuf_add_str(vb, pkg_eflag_name(pkg));
   varbuf_add_char(vb, ' ');
-  varbuf_add_str(vb, statusinfos[pkg->status].name);
+  varbuf_add_str(vb, pkg_status_name(pkg));
   if (flags&fw_printheader)
     varbuf_add_char(vb, '\n');
 }

+ 0 - 2
lib/dpkg/libdpkg.map

@@ -301,8 +301,6 @@ LIBDPKG_PRIVATE {
 	versionsatisfied;
 
 	# Package on-disk database functions
-	statusinfos;		# XXX variable, do not export
-	wantinfos;		# XXX variable, do not export
 	varbufdependency;
 	varbufrecord;
 	writerecord;

+ 3 - 3
lib/dpkg/parse.c

@@ -3,7 +3,7 @@
  * parse.c - database file parsing, main package/field loop
  *
  * Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
- * Copyright © 2006,2008-2013 Guillem Jover <guillem@debian.org>
+ * Copyright © 2006,2008-2014 Guillem Jover <guillem@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -242,7 +242,7 @@ pkg_parse_verify(struct parsedb_state *ps,
        pkg->status >= stat_triggerspending))
     parse_error(ps,
                 _("package has status %s but triggers are awaited"),
-                statusinfos[pkg->status].name);
+                pkg_status_name(pkg));
   else if (pkg->status == stat_triggersawaited && !pkg->trigaw.head)
     parse_error(ps,
                 _("package has status triggers-awaited but no triggers awaited"));
@@ -252,7 +252,7 @@ pkg_parse_verify(struct parsedb_state *ps,
         pkg->status == stat_triggersawaited))
     parse_error(ps,
                 _("package has status %s but triggers are pending"),
-                statusinfos[pkg->status].name);
+                pkg_status_name(pkg));
   else if (pkg->status == stat_triggerspending && !pkg->trigpend_head)
     parse_error(ps,
                 _("package has status triggers-pending but no triggers "

+ 2 - 2
src/archives.c

@@ -4,7 +4,7 @@
  *
  * Copyright © 1994,1995 Ian Jackson <ian@chiark.greenend.org.uk>
  * Copyright © 2000 Wichert Akkerman <wakkerma@debian.org>
- * Copyright © 2007-2013 Guillem Jover <guillem@debian.org>
+ * Copyright © 2007-2014 Guillem Jover <guillem@debian.org>
  * Copyright © 2011 Linaro Limited
  * Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
  *
@@ -216,7 +216,7 @@ md5hash_prev_conffile(struct pkginfo *pkg, char *oldhash, const char *oldname,
       debug(dbg_conffdetail,
             "tarobject found shared conffile, from pkg %s (%s); hash=%s",
             pkg_name(otherpkg, pnaw_always),
-            statusinfos[otherpkg->status].name, oldhash);
+            pkg_status_name(otherpkg), oldhash);
       break;
     }
   }

+ 3 - 3
src/configure.c

@@ -4,7 +4,7 @@
  *
  * Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
  * Copyright © 1999, 2002 Wichert Akkerman <wichert@deephackmode.org>
- * Copyright © 2007-2012 Guillem Jover <guillem@debian.org>
+ * Copyright © 2007-2014 Guillem Jover <guillem@debian.org>
  * Copyright © 2011 Linaro Limited
  * Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
  *
@@ -570,7 +570,7 @@ deferred_configure(struct pkginfo *pkg)
 		ohshit(_("package %.250s is not ready for configuration\n"
 		         " cannot configure (current status `%.250s')"),
 		       pkg_name(pkg, pnaw_nonambig),
-		       statusinfos[pkg->status].name);
+		       pkg_status_name(pkg));
 
 	for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
 		if (otherpkg == pkg)
@@ -583,7 +583,7 @@ deferred_configure(struct pkginfo *pkg)
 			         "%s is not ready (current status '%s')"),
 			       pkg_name(pkg, pnaw_always),
 			       pkg_name(otherpkg, pnaw_always),
-			       statusinfos[otherpkg->status].name);
+			       pkg_status_name(otherpkg));
 
 		if (dpkg_version_compare(&pkg->installed.version,
 		                         &otherpkg->installed.version))

+ 2 - 1
src/packages.c

@@ -3,6 +3,7 @@
  * packages.c - common to actions that process packages
  *
  * Copyright © 1994,1995 Ian Jackson <ian@chiark.greenend.org.uk>
+ * Copyright © 2006-2014 Guillem Jover <guillem@debian.org>
  * Copyright © 2011 Linaro Limited
  * Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
  *
@@ -242,7 +243,7 @@ void process_queue(void) {
       if (!pkg->trigpend_head)
         ohshit(_("package %.250s is not ready for trigger processing\n"
                  " (current status `%.250s' with no pending triggers)"),
-               pkg_name(pkg, pnaw_nonambig), statusinfos[pkg->status].name);
+               pkg_name(pkg, pnaw_nonambig), pkg_status_name(pkg));
       /* Fall through. */
     case act_install:
       /* Don't try to configure pkgs that we've just disappeared. */

+ 2 - 2
src/select.c

@@ -3,7 +3,7 @@
  * select.c - by-hand (rather than dselect-based) package selection
  *
  * Copyright © 1995,1996 Ian Jackson <ian@chiark.greenend.org.uk>
- * Copyright © 2006,2008-2012 Guillem Jover <guillem@debian.org>
+ * Copyright © 2006,2008-2014 Guillem Jover <guillem@debian.org>
  * Copyright © 2011 Linaro Limited
  * Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
  *
@@ -53,7 +53,7 @@ static void getsel1package(struct pkginfo *pkg) {
   l = 6 - l;
   if (l < 1)
     l = 1;
-  printf("%s%.*s%s\n", pkgname, l, "\t\t\t\t\t\t", wantinfos[pkg->want].name);
+  printf("%s%.*s%s\n", pkgname, l, "\t\t\t\t\t\t", pkg_want_name(pkg));
 }
 
 int

+ 2 - 2
src/trigproc.c

@@ -4,7 +4,7 @@
  *
  * Copyright © 2007 Canonical Ltd
  * written by Ian Jackson <ian@chiark.greenend.org.uk>
- * Copyright © 2008-2013 Guillem Jover <guillem@debian.org>
+ * Copyright © 2008-2014 Guillem Jover <guillem@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -408,7 +408,7 @@ trig_transitional_activate(enum modstatdb_rw cstatus)
 			continue;
 		debug(dbg_triggersdetail, "trig_transitional_activate %s %s",
 		      pkg_name(pkg, pnaw_always),
-		      statusinfos[pkg->status].name);
+		      pkg_status_name(pkg));
 		pkg->trigpend_head = NULL;
 		trig_parse_ci(pkg_infodb_get_file(pkg, &pkg->installed,
 		                                  TRIGGERSCIFILE),