Преглед изворни кода

Sort entries in enum pkgstatus

Fix all users that rely on the enum sorting.
Ian Jackson пре 18 година
родитељ
комит
7a3c7d3838
9 измењених фајлова са 33 додато и 15 уклоњено
  1. 14 0
      ChangeLog
  2. 3 3
      dselect/pkgdisplay.cc
  3. 6 2
      lib/dpkg-db.h
  4. 1 1
      lib/dump.c
  5. 2 2
      lib/parsehelp.c
  6. 3 3
      src/help.c
  7. 2 2
      src/packages.c
  8. 1 1
      src/processarc.c
  9. 1 1
      src/query.c

+ 14 - 0
ChangeLog

@@ -1,3 +1,17 @@
+2008-03-22  Ian Jackson  <ian@davenant.greenend.org.uk>
+
+	* lib/dpkg-db.h (enum pkgstatus): Sort entries.
+	* lib/dump.c (w_status): Change 'stat_configfiles' to 'stat_installed'
+	in assert as that's the new last item.
+	* src/processarc.c (process_archive): Likewise.
+	* src/packages.c (process_queue): Likewise.
+	(deppossi_ok_found): Match sorting of 'enum pkgstatus'.
+	* dselect/pkgdisplay.cc (statusstrings): Likewise.
+	(statuschars): Likewise.
+	* src/help.c (statusstrings): Likewise.
+	* src/query.c (list1package): Likewise.
+	* lib/parsehelp.c (statusinfos): Likewise.
+
 2008-03-21  Guillem Jover  <guillem@debian.org>
 
 	* lib/parse.c (cu_parsedb): Remove duplicate function.

+ 3 - 3
dselect/pkgdisplay.cc

@@ -50,11 +50,11 @@ const char
 			     0 },
 
   *const statusstrings[]= { N_("not installed"),
+			    N_("removed (configs remain)"),
+			    N_("half installed"),
 			    N_("unpacked (not set up)"),
 			    N_("failed config"),
 			    N_("installed"),
-			    N_("half installed"),
-			    N_("removed (configs remain)"),
 			    0 },
 
   *const prioritystrings[]=  { N_("Required"),
@@ -89,7 +89,7 @@ const char
 			       N_("bUG"),
 			       N_("?") };
 
-const char statuschars[]=   " UC*I-";
+const char statuschars[] = " -IUC*";
 const char eflagchars[]=     " R?#";
 const char wantchars[]=     "n*=-_";
 

+ 6 - 2
lib/dpkg-db.h

@@ -126,8 +126,12 @@ struct pkginfo { /* pig */
     eflagv_obsoleteboth =    eflagf_reinstreq | eflagf_obsoletehold
   } eflag; /* bitmask, but obsoletehold no longer used except when reading */
   enum pkgstatus {
-    stat_notinstalled, stat_unpacked, stat_halfconfigured,
-    stat_installed, stat_halfinstalled, stat_configfiles
+    stat_notinstalled,
+    stat_configfiles,
+    stat_halfinstalled,
+    stat_unpacked,
+    stat_halfconfigured,
+    stat_installed
   } status;
   enum pkgpriority {
     pri_required, pri_important, pri_standard, pri_recommended,

+ 1 - 1
lib/dump.c

@@ -161,7 +161,7 @@ void w_status(struct varbuf *vb,
   if (pifp != &pigp->installed) return;
   assert(pigp->want <= want_purge);
   assert(pigp->eflag <= eflagv_reinstreq); /* hold and hold-reinstreq NOT allowed */
-  assert(pigp->status <= stat_configfiles);
+  assert(pigp->status <= stat_installed);
   if (flags&fw_printheader)
     varbufaddstr(vb,"Status: ");
   varbufaddstr(vb,wantinfos[pigp->want].name); varbufaddc(vb,' ');

+ 2 - 2
lib/parsehelp.c

@@ -83,11 +83,11 @@ const struct namevalue priorityinfos[]= {  /* Note !  These must be in order ! *
 
 const struct namevalue statusinfos[]= {  /* Note !  These must be in order ! */
   { "not-installed",   stat_notinstalled,    13 },
+  { "config-files",    stat_configfiles,     12 },
+  { "half-installed",  stat_halfinstalled,   14 },
   { "unpacked",        stat_unpacked,        8 },
   { "half-configured", stat_halfconfigured,  15, },
   { "installed",       stat_installed,       9 },
-  { "half-installed",  stat_halfinstalled,   14 },
-  { "config-files",    stat_configfiles,     12 },
   /* These are additional entries for reading only, in any order ... */
   { "postinst-failed", stat_halfconfigured,  15 }, /* fixme: backwards compat., remove */
   { "removal-failed",  stat_halfinstalled,   14 }, /* fixme: backwards compat., remove */

+ 3 - 3
src/help.c

@@ -39,11 +39,11 @@
 
 const char *const statusstrings[]= {
   N_("not installed"),
+  N_("not installed but configs remain"),
+  N_("broken due to failed removal"),
   N_("unpacked but not configured"),
   N_("broken due to postinst failure"),
-  N_("installed"),
-  N_("broken due to failed removal"),
-  N_("not installed but configs remain")
+  N_("installed")
 };
 
 struct filenamenode *namenodetouse(struct filenamenode *namenode, struct pkginfo *pkg) {

+ 2 - 2
src/packages.c

@@ -176,7 +176,7 @@ void process_queue(void) {
     
     if (!pkg) continue; /* duplicate, which we removed earlier */
 
-    assert(pkg->status <= stat_configfiles);
+    assert(pkg->status <= stat_installed);
 
     if (setjmp(ejbuf)) {
       /* give up on it from the point of view of other packages, ie reset istobe */
@@ -279,9 +279,9 @@ static int deppossi_ok_found(struct pkginfo *possdependee,
     return thisf;
   }
   switch (possdependee->status) {
-  case stat_installed:
   case stat_unpacked:
   case stat_halfconfigured:
+  case stat_installed:
     assert(possdependee->installed.valid);
     if (checkversion && !versionsatisfied(&possdependee->installed,checkversion)) {
       varbufprintf(oemsgs, _("  Version of %s on system is %s.\n"),

+ 1 - 1
src/processarc.c

@@ -383,7 +383,7 @@ void process_archive(const char *filename) {
   
   oldversionstatus= pkg->status;
 
-  assert(oldversionstatus <= stat_configfiles);
+  assert(oldversionstatus <= stat_installed);
   debug(dbg_general,"process_archive oldversionstatus=%s",
         statusstrings[oldversionstatus]);
   

+ 1 - 1
src/query.c

@@ -146,7 +146,7 @@ Desired=Unknown/Install/Remove/Purge/Hold\n\
   limiteddescription(pkg,dw,&pdesc,&l);
   printf(format,
          "uihrp"[pkg->want],
-         "nUFiHc"[pkg->status],
+         "ncHUFi"[pkg->status],
          " R?#"[pkg->eflag],
          pkg->name,
          versiondescribe(&pkg->installed.version, vdew_nonambig),