]> err.no Git - dpkg/commitdiff
Sort entries in enum pkgstatus
authorIan Jackson <ian@davenant.greenend.org.uk>
Sat, 22 Mar 2008 04:07:44 +0000 (06:07 +0200)
committerGuillem Jover <guillem@debian.org>
Sat, 22 Mar 2008 04:30:07 +0000 (06:30 +0200)
Fix all users that rely on the enum sorting.

ChangeLog
dselect/pkgdisplay.cc
lib/dpkg-db.h
lib/dump.c
lib/parsehelp.c
src/help.c
src/packages.c
src/processarc.c
src/query.c

index 2bf8e4ac9b06ca1d1a41d1ad8a5e0534b6f28d2a..8174cbbd4ca6c2d497a10d89ce03a814a0bb8654 100644 (file)
--- a/ChangeLog
+++ b/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.
index 2e78ed7d937ac7fd769d9b5a9282f90ffd29de98..8d662194960478288df647630fb0f573128fadc4 100644 (file)
@@ -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*=-_";
 
index c306f3bf7ea8c374044442c011f17edec0dcbbda..f56ab69487fa2e2c0a4b3db493a068190b173ef7 100644 (file)
@@ -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,
index 11547954a9f56efdceb5fe02eac62079acd61936..562734b5bb1abb834f8b6756a9b7b9f35d8d05d6 100644 (file)
@@ -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,' ');
index 6dc7eaa5822b6225143a535c90d041e4d0fdae42..f602fdea0f160f05d2961090d85247a0329a98da 100644 (file)
@@ -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 */
index d7f2f04016ba1bc67f448cd4e5a1c1f4c103dbb0..6bb9f2a4302193ea855784ce30778cd0bc018339 100644 (file)
 
 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) {
index 59dce61d943e73eec101f20b51f229d408273cde..00321fa16c69e35cfa6e82934d0790ca96a9d9a6 100644 (file)
@@ -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"),
index ba2aaa61c6fe3bd54b66f75b24d576f167f0ebce..271e1b86e3a23b68b44566a382f10612002b7e99 100644 (file)
@@ -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]);
   
index c50ddded9209d654f306402a60b7afcc588c5d01..ae5f0cad4d9648de98d8ba863012ed72f960c60c 100644 (file)
@@ -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),