瀏覽代碼

libdpkg: Uppercase and namespace pkgstatus enum values

Guillem Jover 12 年之前
父節點
當前提交
63b138afa6
共有 30 個文件被更改,包括 311 次插入292 次删除
  1. 5 5
      dselect/pkgcmds.cc
  2. 8 8
      dselect/pkgdepcon.cc
  3. 18 18
      dselect/pkglist.cc
  4. 3 3
      lib/dpkg/dbmodify.c
  5. 8 8
      lib/dpkg/dpkg-db.h
  6. 15 15
      lib/dpkg/dump.c
  7. 21 20
      lib/dpkg/parse.c
  8. 1 1
      lib/dpkg/pkg-db.c
  9. 8 8
      lib/dpkg/pkg-namevalue.c
  10. 4 4
      lib/dpkg/pkg.c
  11. 19 19
      lib/dpkg/test/t-pkginfo.c
  12. 7 7
      lib/dpkg/triglib.c
  13. 3 3
      lib/dpkg/trignote.c
  14. 7 7
      src/archives.c
  15. 5 5
      src/cleanup.c
  16. 13 12
      src/configure.c
  17. 33 28
      src/depcon.c
  18. 22 16
      src/enquiry.c
  19. 3 3
      src/filesdb.c
  20. 8 8
      src/help.c
  21. 1 1
      src/infodb-upgrade.c
  22. 1 1
      src/main.c
  23. 20 19
      src/packages.c
  24. 8 7
      src/querycmd.c
  25. 16 15
      src/remove.c
  26. 5 5
      src/script.c
  27. 2 1
      src/select.c
  28. 13 13
      src/trigproc.c
  29. 33 31
      src/unpack.c
  30. 1 1
      src/verify.c

+ 5 - 5
dselect/pkgcmds.cc

@@ -94,9 +94,9 @@ packagelist::reallywant(pkgwant nwarg, struct perpackagestate *pkgstate)
   if (nwarg != PKG_WANT_SENTINEL)
     return nwarg;
   pkgstatus status = pkgstate->pkg->status;
-  if (status == stat_notinstalled)
+  if (status == PKG_STAT_NOTINSTALLED)
     return PKG_WANT_PURGE;
-  if (status == stat_configfiles)
+  if (status == PKG_STAT_CONFIGFILES)
     return PKG_WANT_DEINSTALL;
   return PKG_WANT_INSTALL;
 }
@@ -163,10 +163,10 @@ would_like_to_install(pkgwant wantvalue, pkginfo *pkg)
     return 1;
   if (wantvalue != PKG_WANT_HOLD)
     return 0;
-  if (pkg->status == stat_installed)
+  if (pkg->status == PKG_STAT_INSTALLED)
     return 1;
-  if (pkg->status == stat_notinstalled ||
-      pkg->status == stat_configfiles)
+  if (pkg->status == PKG_STAT_NOTINSTALLED ||
+      pkg->status == PKG_STAT_CONFIGFILES)
     return 0;
   return -1;
 }

+ 8 - 8
dselect/pkgdepcon.cc

@@ -38,9 +38,9 @@ packagelist::useavailable(pkginfo *pkg)
   if (pkg->clientdata &&
       pkg->clientdata->selected == PKG_WANT_INSTALL &&
       pkg_is_informative(pkg, &pkg->available) &&
-      (!(pkg->status == stat_installed ||
-         pkg->status == stat_triggersawaited ||
-         pkg->status == stat_triggerspending) ||
+      (!(pkg->status == PKG_STAT_INSTALLED ||
+         pkg->status == PKG_STAT_TRIGGERSAWAITED ||
+         pkg->status == PKG_STAT_TRIGGERSPENDING) ||
        dpkg_version_compare(&pkg->available.version,
                             &pkg->installed.version) > 0))
     return true;
@@ -204,7 +204,7 @@ packagelist::deselect_one_of(pkginfo *per, pkginfo *ped, dependency *dep)
 
   if (best->spriority >= sp_deselecting) return 0;
   best->suggested=
-    best->pkg->status == stat_notinstalled
+    best->pkg->status == PKG_STAT_NOTINSTALLED
       ? PKG_WANT_PURGE : PKG_WANT_DEINSTALL; // FIXME: configurable.
   best->selected= best->suggested;
   best->spriority= sp_deselecting;
@@ -328,7 +328,7 @@ int packagelist::resolvedepcon(dependency *depends) {
     /* Always remove depends, but never remove recommends. */
     if (depends->type != dep_recommends) {
       best->selected= best->suggested=
-        best->pkg->status == stat_notinstalled
+        best->pkg->status == PKG_STAT_NOTINSTALLED
           ? PKG_WANT_PURGE : PKG_WANT_DEINSTALL; // FIXME: configurable
       best->spriority= sp_deselecting;
     }
@@ -443,9 +443,9 @@ packagelist::deppossatisfied(deppossi *possi, perpackagestate **fixbyupgrade)
     if (useavailable(provider->up->up))
       return true;
     if (fixbyupgrade && !*fixbyupgrade &&
-        (!(provider->up->up->status == stat_installed ||
-           provider->up->up->status == stat_triggerspending ||
-           provider->up->up->status == stat_triggersawaited) ||
+        (!(provider->up->up->status == PKG_STAT_INSTALLED ||
+           provider->up->up->status == PKG_STAT_TRIGGERSPENDING ||
+           provider->up->up->status == PKG_STAT_TRIGGERSAWAITED) ||
          dpkg_version_compare(&provider->up->up->available.version,
                               &provider->up->up->installed.version) > 1))
       *fixbyupgrade = provider->up->up->clientdata;

+ 18 - 18
dselect/pkglist.cc

@@ -183,15 +183,15 @@ void packagelist::ensurestatsortinfo() {
             this, index, pkg_name(table[index]->pkg, pnaw_always));
       pkg= table[index]->pkg;
       switch (pkg->status) {
-      case stat_unpacked:
-      case stat_halfconfigured:
-      case stat_halfinstalled:
-      case stat_triggersawaited:
-      case stat_triggerspending:
+      case PKG_STAT_UNPACKED:
+      case PKG_STAT_HALFCONFIGURED:
+      case PKG_STAT_HALFINSTALLED:
+      case PKG_STAT_TRIGGERSAWAITED:
+      case PKG_STAT_TRIGGERSPENDING:
         table[index]->ssavail= ssa_broken;
         break;
-      case stat_notinstalled:
-      case stat_configfiles:
+      case PKG_STAT_NOTINSTALLED:
+      case PKG_STAT_CONFIGFILES:
         if (!dpkg_version_is_informative(&pkg->available.version)) {
           table[index]->ssavail= ssa_notinst_gone;
 // FIXME: Disable for now as a workaround, until dselect knows how to properly
@@ -204,7 +204,7 @@ void packagelist::ensurestatsortinfo() {
           table[index]->ssavail= ssa_notinst_seen;
         }
         break;
-      case stat_installed:
+      case PKG_STAT_INSTALLED:
         veri= &table[index]->pkg->installed.version;
         vera= &table[index]->pkg->available.version;
         if (!dpkg_version_is_informative(vera)) {
@@ -232,20 +232,20 @@ void packagelist::ensurestatsortinfo() {
       debug(dbg_general, "packagelist[%p]::ensurestatsortinfos() i=%d pkg=%s",
             this, index, pkg_name(table[index]->pkg, pnaw_always));
       switch (table[index]->pkg->status) {
-      case stat_unpacked:
-      case stat_halfconfigured:
-      case stat_halfinstalled:
-      case stat_triggersawaited:
-      case stat_triggerspending:
+      case PKG_STAT_UNPACKED:
+      case PKG_STAT_HALFCONFIGURED:
+      case PKG_STAT_HALFINSTALLED:
+      case PKG_STAT_TRIGGERSAWAITED:
+      case PKG_STAT_TRIGGERSPENDING:
         table[index]->ssstate= sss_broken;
         break;
-      case stat_notinstalled:
+      case PKG_STAT_NOTINSTALLED:
         table[index]->ssstate= sss_notinstalled;
         break;
-      case stat_configfiles:
+      case PKG_STAT_CONFIGFILES:
         table[index]->ssstate= sss_configfiles;
         break;
-      case stat_installed:
+      case PKG_STAT_INSTALLED:
         table[index]->ssstate= sss_installed;
         break;
       default:
@@ -392,7 +392,7 @@ packagelist::packagelist(keybindings *kb) : baselist(kb) {
   while ((pkg = pkg_db_iter_next_pkg(iter))) {
     struct perpackagestate *state= &datatable[nitems];
     state->pkg= pkg;
-    if (pkg->status == stat_notinstalled &&
+    if (pkg->status == PKG_STAT_NOTINSTALLED &&
         !pkg->files &&
         pkg->want != PKG_WANT_INSTALL) {
       pkg->clientdata = nullptr;
@@ -403,7 +403,7 @@ packagelist::packagelist(keybindings *kb) : baselist(kb) {
     if (modstatdb_get_status() == msdbrw_write &&
         state->original == PKG_WANT_UNKNOWN) {
       state->suggested=
-        pkg->status == stat_installed ||
+        pkg->status == PKG_STAT_INSTALLED ||
           pkg->priority <= PKG_PRIO_STANDARD /* FIXME: configurable */
             ? PKG_WANT_INSTALL : PKG_WANT_PURGE;
       state->spriority= sp_inherit;

+ 3 - 3
lib/dpkg/dbmodify.c

@@ -399,11 +399,11 @@ void modstatdb_note(struct pkginfo *pkg) {
 
   /* Clear pending triggers here so that only code that sets the status
    * to interesting (for triggers) values has to care about triggers. */
-  if (pkg->status != stat_triggerspending &&
-      pkg->status != stat_triggersawaited)
+  if (pkg->status != PKG_STAT_TRIGGERSPENDING &&
+      pkg->status != PKG_STAT_TRIGGERSAWAITED)
     pkg->trigpend_head = NULL;
 
-  if (pkg->status <= stat_configfiles) {
+  if (pkg->status <= PKG_STAT_CONFIGFILES) {
     for (ta = pkg->trigaw.head; ta; ta = ta->sameaw.next)
       ta->aw = NULL;
     pkg->trigaw.head = pkg->trigaw.tail = NULL;

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

@@ -166,14 +166,14 @@ enum pkgeflag {
 };
 
 enum pkgstatus {
-	stat_notinstalled,
-	stat_configfiles,
-	stat_halfinstalled,
-	stat_unpacked,
-	stat_halfconfigured,
-	stat_triggersawaited,
-	stat_triggerspending,
-	stat_installed,
+	PKG_STAT_NOTINSTALLED,
+	PKG_STAT_CONFIGFILES,
+	PKG_STAT_HALFINSTALLED,
+	PKG_STAT_UNPACKED,
+	PKG_STAT_HALFCONFIGURED,
+	PKG_STAT_TRIGGERSAWAITED,
+	PKG_STAT_TRIGGERSPENDING,
+	PKG_STAT_INSTALLED,
 };
 
 enum pkgpriority {

+ 15 - 15
lib/dpkg/dump.c

@@ -89,9 +89,9 @@ w_configversion(struct varbuf *vb,
     return;
   if (!dpkg_version_is_informative(&pkg->configversion))
     return;
-  if (pkg->status == stat_installed ||
-      pkg->status == stat_notinstalled ||
-      pkg->status == stat_triggerspending)
+  if (pkg->status == PKG_STAT_INSTALLED ||
+      pkg->status == PKG_STAT_NOTINSTALLED ||
+      pkg->status == PKG_STAT_TRIGGERSPENDING)
     return;
   if (flags&fw_printheader)
     varbuf_add_str(vb, "Config-Version: ");
@@ -252,24 +252,24 @@ w_status(struct varbuf *vb,
 #define PEND pkg->trigpend_head
 #define AW pkg->trigaw.head
   switch (pkg->status) {
-  case stat_notinstalled:
-  case stat_configfiles:
+  case PKG_STAT_NOTINSTALLED:
+  case PKG_STAT_CONFIGFILES:
     assert(!PEND);
     assert(!AW);
     break;
-  case stat_halfinstalled:
-  case stat_unpacked:
-  case stat_halfconfigured:
+  case PKG_STAT_HALFINSTALLED:
+  case PKG_STAT_UNPACKED:
+  case PKG_STAT_HALFCONFIGURED:
     assert(!PEND);
     break;
-  case stat_triggersawaited:
+  case PKG_STAT_TRIGGERSAWAITED:
     assert(AW);
     break;
-  case stat_triggerspending:
+  case PKG_STAT_TRIGGERSPENDING:
     assert(PEND);
     assert(!AW);
     break;
-  case stat_installed:
+  case PKG_STAT_INSTALLED:
     assert(!PEND);
     assert(!AW);
     break;
@@ -390,8 +390,8 @@ w_trigpend(struct varbuf *vb,
   if (pkgbin == &pkg->available || !pkg->trigpend_head)
     return;
 
-  assert(pkg->status >= stat_triggersawaited &&
-         pkg->status <= stat_triggerspending);
+  assert(pkg->status >= PKG_STAT_TRIGGERSAWAITED &&
+         pkg->status <= PKG_STAT_TRIGGERSPENDING);
 
   if (flags & fw_printheader)
     varbuf_add_str(vb, "Triggers-Pending:");
@@ -413,8 +413,8 @@ w_trigaw(struct varbuf *vb,
   if (pkgbin == &pkg->available || !pkg->trigaw.head)
     return;
 
-  assert(pkg->status > stat_configfiles &&
-         pkg->status <= stat_triggersawaited);
+  assert(pkg->status > PKG_STAT_CONFIGFILES &&
+         pkg->status <= PKG_STAT_TRIGGERSAWAITED);
 
   if (flags & fw_printheader)
     varbuf_add_str(vb, "Triggers-Awaited:");

+ 21 - 20
lib/dpkg/parse.c

@@ -178,13 +178,13 @@ pkg_parse_verify(struct parsedb_state *ps,
 
   parse_must_have_field(ps, pkg->set->name, "package name");
 
-  /* XXX: We need to check for status != stat_halfinstalled as while
+  /* XXX: We need to check for status != PKG_STAT_HALFINSTALLED as while
    * unpacking an unselected package, it will not have yet all data in
-   * place. But we cannot check for > stat_halfinstalled as stat_configfiles
-   * always should have those fields. */
+   * place. But we cannot check for > PKG_STAT_HALFINSTALLED as
+   * PKG_STAT_CONFIGFILES always should have those fields. */
   if ((ps->flags & pdb_recordavailable) ||
-      (pkg->status != stat_notinstalled &&
-       pkg->status != stat_halfinstalled)) {
+      (pkg->status != PKG_STAT_NOTINSTALLED &&
+       pkg->status != PKG_STAT_HALFINSTALLED)) {
     parse_ensure_have_field(ps, &pkgbin->description, "description");
     parse_ensure_have_field(ps, &pkgbin->maintainer, "maintainer");
     parse_must_have_field(ps, pkgbin->version.version, "version");
@@ -192,9 +192,9 @@ pkg_parse_verify(struct parsedb_state *ps,
 
   /* XXX: Versions before dpkg 1.10.19 did not preserve the Architecture
    * field in the status file. So there's still live systems with packages
-   * in stat_configfiles, ignore those too for now. */
+   * in PKG_STAT_CONFIGFILES, ignore those too for now. */
   if ((ps->flags & pdb_recordavailable) ||
-      pkg->status > stat_halfinstalled) {
+      pkg->status > PKG_STAT_HALFINSTALLED) {
     /* We always want usable architecture information (as long as the package
      * is in such a state that it make sense), so that it can be used safely
      * on string comparisons and the like. */
@@ -230,32 +230,33 @@ pkg_parse_verify(struct parsedb_state *ps,
    * ‘not-installed’ (in which case there is no Config-Version). */
   if (!(ps->flags & pdb_recordavailable)) {
     if (pkg->configversion.version) {
-      if (pkg->status == stat_installed || pkg->status == stat_notinstalled)
+      if (pkg->status == PKG_STAT_INSTALLED ||
+          pkg->status == PKG_STAT_NOTINSTALLED)
         parse_error(ps,
                     _("Config-Version for package with inappropriate Status"));
     } else {
-      if (pkg->status == stat_installed)
+      if (pkg->status == PKG_STAT_INSTALLED)
         pkg->configversion = pkgbin->version;
     }
   }
 
   if (pkg->trigaw.head &&
-      (pkg->status <= stat_configfiles ||
-       pkg->status >= stat_triggerspending))
+      (pkg->status <= PKG_STAT_CONFIGFILES ||
+       pkg->status >= PKG_STAT_TRIGGERSPENDING))
     parse_error(ps,
                 _("package has status %s but triggers are awaited"),
                 pkg_status_name(pkg));
-  else if (pkg->status == stat_triggersawaited && !pkg->trigaw.head)
+  else if (pkg->status == PKG_STAT_TRIGGERSAWAITED && !pkg->trigaw.head)
     parse_error(ps,
                 _("package has status triggers-awaited but no triggers awaited"));
 
   if (pkg->trigpend_head &&
-      !(pkg->status == stat_triggerspending ||
-        pkg->status == stat_triggersawaited))
+      !(pkg->status == PKG_STAT_TRIGGERSPENDING ||
+        pkg->status == PKG_STAT_TRIGGERSAWAITED))
     parse_error(ps,
                 _("package has status %s but triggers are pending"),
                 pkg_status_name(pkg));
-  else if (pkg->status == stat_triggerspending && !pkg->trigpend_head)
+  else if (pkg->status == PKG_STAT_TRIGGERSPENDING && !pkg->trigpend_head)
     parse_error(ps,
                 _("package has status triggers-pending but no triggers "
                   "pending"));
@@ -264,7 +265,7 @@ pkg_parse_verify(struct parsedb_state *ps,
    * conffiles, so we check for them here and remove them (rather than
    * calling it an error, which will do at some point). */
   if (!(ps->flags & pdb_recordavailable) &&
-      pkg->status == stat_notinstalled &&
+      pkg->status == PKG_STAT_NOTINSTALLED &&
       pkgbin->conffiles) {
     parse_warn(ps,
                _("Package which in state not-installed has conffiles, "
@@ -277,7 +278,7 @@ pkg_parse_verify(struct parsedb_state *ps,
    * there's guarantee that no leftover is found on the status file on
    * major distributions. */
   if (!(ps->flags & pdb_recordavailable) &&
-      pkg->status == stat_notinstalled &&
+      pkg->status == PKG_STAT_NOTINSTALLED &&
       pkg->eflag == PKG_EFLAG_OK &&
       (pkg->want == PKG_WANT_PURGE ||
        pkg->want == PKG_WANT_DEINSTALL ||
@@ -290,7 +291,7 @@ pkg_parse_verify(struct parsedb_state *ps,
    * might cause those selections to be unreferencable from command-line
    * interfaces when there's other more specific selections. */
   if (ps->type == pdb_file_status &&
-      pkg->status == stat_notinstalled &&
+      pkg->status == PKG_STAT_NOTINSTALLED &&
       pkg->eflag == PKG_EFLAG_OK &&
       pkg->want == PKG_WANT_INSTALL &&
       pkgbin->arch->type == DPKG_ARCH_EMPTY)
@@ -307,7 +308,7 @@ static void
 parse_count_pkg_instance(struct pkgcount *count,
                          struct pkginfo *pkg, struct pkgbin *pkgbin)
 {
-  if (pkg->status == stat_notinstalled)
+  if (pkg->status == PKG_STAT_NOTINSTALLED)
      return;
 
   if (pkgbin->multiarch == PKG_MULTIARCH_SAME)
@@ -403,7 +404,7 @@ parse_find_pkg_slot(struct parsedb_state *ps,
 
     /* If the package is part of the status file, and it's not installed
      * then this means it's just a selection. */
-    if (ps->type == pdb_file_status && new_pkg->status == stat_notinstalled)
+    if (ps->type == pdb_file_status && new_pkg->status == PKG_STAT_NOTINSTALLED)
       selection = true;
 
     /* Verify we don't allow something that will mess up the db. */

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

@@ -136,7 +136,7 @@ pkg_db_get_singleton(struct pkgset *set)
     return &set->pkg;
   case 1:
     for (pkg = &set->pkg; pkg; pkg = pkg->arch_next) {
-      if (pkg->status > stat_notinstalled)
+      if (pkg->status > PKG_STAT_NOTINSTALLED)
         return pkg;
     }
     internerr("pkgset '%s' should have one installed instance", set->name);

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

@@ -66,13 +66,13 @@ const struct namevalue eflaginfos[] = {
 };
 
 const struct namevalue statusinfos[] = {
-	NAMEVALUE_DEF("not-installed",		stat_notinstalled),
-	NAMEVALUE_DEF("config-files",		stat_configfiles),
-	NAMEVALUE_DEF("half-installed",		stat_halfinstalled),
-	NAMEVALUE_DEF("unpacked",		stat_unpacked),
-	NAMEVALUE_DEF("half-configured",	stat_halfconfigured),
-	NAMEVALUE_DEF("triggers-awaited",	stat_triggersawaited),
-	NAMEVALUE_DEF("triggers-pending",	stat_triggerspending),
-	NAMEVALUE_DEF("installed",		stat_installed),
+	NAMEVALUE_DEF("not-installed",		PKG_STAT_NOTINSTALLED),
+	NAMEVALUE_DEF("config-files",		PKG_STAT_CONFIGFILES),
+	NAMEVALUE_DEF("half-installed",		PKG_STAT_HALFINSTALLED),
+	NAMEVALUE_DEF("unpacked",		PKG_STAT_UNPACKED),
+	NAMEVALUE_DEF("half-configured",	PKG_STAT_HALFCONFIGURED),
+	NAMEVALUE_DEF("triggers-awaited",	PKG_STAT_TRIGGERSAWAITED),
+	NAMEVALUE_DEF("triggers-pending",	PKG_STAT_TRIGGERSPENDING),
+	NAMEVALUE_DEF("installed",		PKG_STAT_INSTALLED),
 	{ .name = NULL }
 };

+ 4 - 4
lib/dpkg/pkg.c

@@ -37,9 +37,9 @@ pkg_set_status(struct pkginfo *pkg, enum pkgstatus status)
 {
 	if (pkg->status == status)
 		return;
-	else if (pkg->status == stat_notinstalled)
+	else if (pkg->status == PKG_STAT_NOTINSTALLED)
 		pkg->set->installed_instances++;
-	else if (status == stat_notinstalled)
+	else if (status == PKG_STAT_NOTINSTALLED)
 		pkg->set->installed_instances--;
 
 	assert(pkg->set->installed_instances >= 0);
@@ -112,7 +112,7 @@ pkgbin_blank(struct pkgbin *pkgbin)
 void
 pkg_blank(struct pkginfo *pkg)
 {
-	pkg->status = stat_notinstalled;
+	pkg->status = PKG_STAT_NOTINSTALLED;
 	pkg->eflag = PKG_EFLAG_OK;
 	pkg->want = PKG_WANT_UNKNOWN;
 	pkg->priority = PKG_PRIO_UNKNOWN;
@@ -189,7 +189,7 @@ pkg_is_informative(struct pkginfo *pkg, struct pkgbin *pkgbin)
 	if (pkgbin == &pkg->installed &&
 	    (pkg->want != PKG_WANT_UNKNOWN ||
 	     pkg->eflag != PKG_EFLAG_OK ||
-	     pkg->status != stat_notinstalled ||
+	     pkg->status != PKG_STAT_NOTINSTALLED ||
 	     dpkg_version_is_informative(&pkg->configversion)))
 		return true;
 

+ 19 - 19
lib/dpkg/test/t-pkginfo.c

@@ -82,62 +82,62 @@ test_pkginfo_instance_tracking(void)
 	pkgset_link_pkg(&set, &pkg2);
 
 	/* Test installation state transitions. */
-	pkg_set_status(&pkg4, stat_installed);
+	pkg_set_status(&pkg4, PKG_STAT_INSTALLED);
 	test_pass(pkgset_installed_instances(&set) == 1);
 
-	pkg_set_status(&pkg4, stat_installed);
+	pkg_set_status(&pkg4, PKG_STAT_INSTALLED);
 	test_pass(pkgset_installed_instances(&set) == 1);
 
-	pkg_set_status(&pkg4, stat_triggerspending);
+	pkg_set_status(&pkg4, PKG_STAT_TRIGGERSPENDING);
 	test_pass(pkgset_installed_instances(&set) == 1);
 
-	pkg_set_status(&pkg4, stat_triggersawaited);
+	pkg_set_status(&pkg4, PKG_STAT_TRIGGERSAWAITED);
 	test_pass(pkgset_installed_instances(&set) == 1);
 
-	pkg_set_status(&pkg4, stat_halfconfigured);
+	pkg_set_status(&pkg4, PKG_STAT_HALFCONFIGURED);
 	test_pass(pkgset_installed_instances(&set) == 1);
 
-	pkg_set_status(&pkg4, stat_unpacked);
+	pkg_set_status(&pkg4, PKG_STAT_UNPACKED);
 	test_pass(pkgset_installed_instances(&set) == 1);
 
-	pkg_set_status(&pkg4, stat_halfinstalled);
+	pkg_set_status(&pkg4, PKG_STAT_HALFINSTALLED);
 	test_pass(pkgset_installed_instances(&set) == 1);
 
-	pkg_set_status(&pkg4, stat_configfiles);
+	pkg_set_status(&pkg4, PKG_STAT_CONFIGFILES);
 	test_pass(pkgset_installed_instances(&set) == 1);
 
-	pkg_set_status(&pkg4, stat_notinstalled);
+	pkg_set_status(&pkg4, PKG_STAT_NOTINSTALLED);
 	test_pass(pkgset_installed_instances(&set) == 0);
 
-	pkg_set_status(&pkg4, stat_notinstalled);
+	pkg_set_status(&pkg4, PKG_STAT_NOTINSTALLED);
 	test_pass(pkgset_installed_instances(&set) == 0);
 
 	/* Toggle installation states on various packages. */
-	pkg_set_status(&pkg4, stat_installed);
+	pkg_set_status(&pkg4, PKG_STAT_INSTALLED);
 	test_pass(pkgset_installed_instances(&set) == 1);
 
-	pkg_set_status(&pkg2, stat_halfinstalled);
+	pkg_set_status(&pkg2, PKG_STAT_HALFINSTALLED);
 	test_pass(pkgset_installed_instances(&set) == 2);
 
-	pkg_set_status(&set.pkg, stat_configfiles);
+	pkg_set_status(&set.pkg, PKG_STAT_CONFIGFILES);
 	test_pass(pkgset_installed_instances(&set) == 3);
 
-	pkg_set_status(&pkg3, stat_notinstalled);
+	pkg_set_status(&pkg3, PKG_STAT_NOTINSTALLED);
 	test_pass(pkgset_installed_instances(&set) == 3);
 
-	pkg_set_status(&pkg3, stat_unpacked);
+	pkg_set_status(&pkg3, PKG_STAT_UNPACKED);
 	test_pass(pkgset_installed_instances(&set) == 4);
 
-	pkg_set_status(&set.pkg, stat_notinstalled);
+	pkg_set_status(&set.pkg, PKG_STAT_NOTINSTALLED);
 	test_pass(pkgset_installed_instances(&set) == 3);
 
-	pkg_set_status(&pkg2, stat_notinstalled);
+	pkg_set_status(&pkg2, PKG_STAT_NOTINSTALLED);
 	test_pass(pkgset_installed_instances(&set) == 2);
 
-	pkg_set_status(&pkg3, stat_notinstalled);
+	pkg_set_status(&pkg3, PKG_STAT_NOTINSTALLED);
 	test_pass(pkgset_installed_instances(&set) == 1);
 
-	pkg_set_status(&pkg4, stat_notinstalled);
+	pkg_set_status(&pkg4, PKG_STAT_NOTINSTALLED);
 	test_pass(pkgset_installed_instances(&set) == 0);
 }
 

+ 7 - 7
lib/dpkg/triglib.c

@@ -84,7 +84,7 @@ static struct trig_hooks trigh;
 static void
 trig_record_activation(struct pkginfo *pend, struct pkginfo *aw, const char *trig)
 {
-	if (pend->status < stat_triggersawaited)
+	if (pend->status < PKG_STAT_TRIGGERSAWAITED)
 		return; /* Not interested then. */
 
 	if (trig_note_pend(pend, trig))
@@ -93,10 +93,10 @@ trig_record_activation(struct pkginfo *pend, struct pkginfo *aw, const char *tri
 	if (trigh.enqueue_deferred)
 		trigh.enqueue_deferred(pend);
 
-	if (aw && pend->status > stat_configfiles)
+	if (aw && pend->status > PKG_STAT_CONFIGFILES)
 		if (trig_note_aw(pend, aw)) {
-			if (aw->status > stat_triggersawaited)
-				pkg_set_status(aw, stat_triggersawaited);
+			if (aw->status > PKG_STAT_TRIGGERSAWAITED)
+				pkg_set_status(aw, PKG_STAT_TRIGGERSAWAITED);
 			modstatdb_note_ifwrite(aw);
 		}
 }
@@ -116,11 +116,11 @@ trig_clear_awaiters(struct pkginfo *notpend)
 		if (!aw)
 			continue;
 		LIST_UNLINK_PART(aw->trigaw, ta, sameaw.);
-		if (!aw->trigaw.head && aw->status == stat_triggersawaited) {
+		if (!aw->trigaw.head && aw->status == PKG_STAT_TRIGGERSAWAITED) {
 			if (aw->trigpend_head)
-				pkg_set_status(aw, stat_triggerspending);
+				pkg_set_status(aw, PKG_STAT_TRIGGERSPENDING);
 			else
-				pkg_set_status(aw, stat_installed);
+				pkg_set_status(aw, PKG_STAT_INSTALLED);
 			modstatdb_note(aw);
 		}
 	}

+ 3 - 3
lib/dpkg/trignote.c

@@ -4,7 +4,7 @@
  *
  * Copyright © 2007 Canonical Ltd
  * Written by Ian Jackson <ian@chiark.greenend.org.uk>
- * Copyright © 2008-2012 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
@@ -67,9 +67,9 @@ trig_note_pend(struct pkginfo *pend, const char *trig)
 		return false;
 
 	if (pend->trigaw.head)
-		pkg_set_status(pend, stat_triggersawaited);
+		pkg_set_status(pend, PKG_STAT_TRIGGERSAWAITED);
 	else
-		pkg_set_status(pend, stat_triggerspending);
+		pkg_set_status(pend, PKG_STAT_TRIGGERSPENDING);
 
 	return true;
 }

+ 7 - 7
src/archives.c

@@ -196,12 +196,12 @@ md5hash_prev_conffile(struct pkginfo *pkg, char *oldhash, const char *oldname,
       continue;
     /* The hash in the Conffiles is only meaningful if the package
      * configuration has been at least tried. */
-    if (otherpkg->status < stat_unpacked)
+    if (otherpkg->status < PKG_STAT_UNPACKED)
       continue;
     /* If we are reinstalling, even if the other package is only unpacked,
      * we can always make use of the Conffiles hash value from an initial
      * installation, if that happened at all. */
-    if (otherpkg->status == stat_unpacked &&
+    if (otherpkg->status == PKG_STAT_UNPACKED &&
         dpkg_version_compare(&otherpkg->installed.version,
                              &otherpkg->configversion) != 0)
       continue;
@@ -957,7 +957,7 @@ tarobject(void *ctx, struct tar_entry *ti)
       /* Is the package with the conflicting file in the “config files only”
        * state? If so it must be a config file and we can silenty take it
        * over. */
-      if (otherpkg->status == stat_configfiles)
+      if (otherpkg->status == PKG_STAT_CONFIGFILES)
         continue;
 
       /* Perhaps we're removing a conflicting package? */
@@ -1445,9 +1445,9 @@ void check_conflict(struct dependency *dep, struct pkginfo *pkg,
       notice(_("considering removing %s in favour of %s ..."),
              pkg_name(fixbyrm, pnaw_nonambig),
              pkgbin_name(pkg, &pkg->available, pnaw_nonambig));
-      if (!(fixbyrm->status == stat_installed ||
-            fixbyrm->status == stat_triggerspending ||
-            fixbyrm->status == stat_triggersawaited)) {
+      if (!(fixbyrm->status == PKG_STAT_INSTALLED ||
+            fixbyrm->status == PKG_STAT_TRIGGERSPENDING ||
+            fixbyrm->status == PKG_STAT_TRIGGERSAWAITED)) {
         notice(_("%s is not properly installed; ignoring any dependencies on it"),
                pkg_name(fixbyrm, pnaw_nonambig));
         pdep = NULL;
@@ -1714,7 +1714,7 @@ wanttoinstall(struct pkginfo *pkg)
 
   if (pkg->eflag & PKG_EFLAG_REINSTREQ)
     return true;
-  if (pkg->status < stat_unpacked)
+  if (pkg->status < PKG_STAT_UNPACKED)
     return true;
 
   rc = dpkg_version_compare(&pkg->available.version, &pkg->installed.version);

+ 5 - 5
src/cleanup.c

@@ -119,7 +119,7 @@ void cu_prermupgrade(int argc, void **argv) {
                        versiondescribe(&pkg->available.version, vdew_nonambig),
                        NULL);
   pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
-  post_postinst_tasks(pkg, stat_installed);
+  post_postinst_tasks(pkg, PKG_STAT_INSTALLED);
   cleanup_pkg_failed--;
 }
 
@@ -164,7 +164,7 @@ void cu_prermdeconfigure(int argc, void **argv) {
                          NULL);
   }
 
-  post_postinst_tasks(deconf, stat_installed);
+  post_postinst_tasks(deconf, PKG_STAT_INSTALLED);
 }
 
 void cu_prerminfavour(int argc, void **argv) {
@@ -180,7 +180,7 @@ void cu_prerminfavour(int argc, void **argv) {
                                        vdew_nonambig),
                        NULL);
   pkg_clear_eflags(conflictor, PKG_EFLAG_REINSTREQ);
-  post_postinst_tasks(conflictor, stat_installed);
+  post_postinst_tasks(conflictor, PKG_STAT_INSTALLED);
   cleanup_conflictor_failed--;
 }
 
@@ -192,7 +192,7 @@ void cu_preinstverynew(int argc, void **argv) {
   if (cleanup_pkg_failed++) return;
   maintscript_new(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
                   "abort-install", NULL);
-  pkg_set_status(pkg, stat_notinstalled);
+  pkg_set_status(pkg, PKG_STAT_NOTINSTALLED);
   pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
   pkgbin_blank(&pkg->installed);
   modstatdb_note(pkg);
@@ -209,7 +209,7 @@ void cu_preinstnew(int argc, void **argv) {
                   "abort-install",
                   versiondescribe(&pkg->installed.version, vdew_nonambig),
                   NULL);
-  pkg_set_status(pkg, stat_configfiles);
+  pkg_set_status(pkg, PKG_STAT_CONFIGFILES);
   pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
   modstatdb_note(pkg);
   cleanup_pkg_failed--;

+ 13 - 12
src/configure.c

@@ -341,7 +341,7 @@ deferred_configure_ghost_conffile(struct pkginfo *pkg, struct conffile *conff)
 	for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
 		if (otherpkg == pkg)
 			continue;
-		if (otherpkg->status <= stat_halfconfigured)
+		if (otherpkg->status <= PKG_STAT_HALFCONFIGURED)
 			continue;
 
 		for (otherconff = otherpkg->installed.conffiles; otherconff;
@@ -560,13 +560,14 @@ deferred_configure(struct pkginfo *pkg)
 	struct pkginfo *otherpkg;
 	enum dep_check ok;
 
-	if (pkg->status == stat_notinstalled)
+	if (pkg->status == PKG_STAT_NOTINSTALLED)
 		ohshit(_("no package named `%s' is installed, cannot configure"),
 		       pkg_name(pkg, pnaw_nonambig));
-	if (pkg->status == stat_installed)
+	if (pkg->status == PKG_STAT_INSTALLED)
 		ohshit(_("package %.250s is already installed and configured"),
 		       pkg_name(pkg, pnaw_nonambig));
-	if (pkg->status != stat_unpacked && pkg->status != stat_halfconfigured)
+	if (pkg->status != PKG_STAT_UNPACKED &&
+	    pkg->status != PKG_STAT_HALFCONFIGURED)
 		ohshit(_("package %.250s is not ready for configuration\n"
 		         " cannot configure (current status `%.250s')"),
 		       pkg_name(pkg, pnaw_nonambig),
@@ -575,10 +576,10 @@ deferred_configure(struct pkginfo *pkg)
 	for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
 		if (otherpkg == pkg)
 			continue;
-		if (otherpkg->status <= stat_configfiles)
+		if (otherpkg->status <= PKG_STAT_CONFIGFILES)
 			continue;
 
-		if (otherpkg->status < stat_unpacked)
+		if (otherpkg->status < PKG_STAT_UNPACKED)
 			ohshit(_("package %s cannot be configured because "
 			         "%s is not ready (current status '%s')"),
 			       pkg_name(pkg, pnaw_always),
@@ -614,7 +615,7 @@ deferred_configure(struct pkginfo *pkg)
 	/*
 	 * At this point removal from the queue is confirmed. This
 	 * represents irreversible progress wrt trigger cycles. Only
-	 * packages in stat_unpacked are automatically added to the
+	 * packages in PKG_STAT_UNPACKED are automatically added to the
 	 * configuration queue, and during configuration and trigger
 	 * processing new packages can't enter into unpacked.
 	 */
@@ -647,12 +648,12 @@ deferred_configure(struct pkginfo *pkg)
 	trig_activate_packageprocessing(pkg);
 
 	if (f_noact) {
-		pkg_set_status(pkg, stat_installed);
+		pkg_set_status(pkg, PKG_STAT_INSTALLED);
 		pkg->clientdata->istobe = PKG_ISTOBE_NORMAL;
 		return;
 	}
 
-	if (pkg->status == stat_unpacked) {
+	if (pkg->status == PKG_STAT_UNPACKED) {
 		debug(dbg_general, "deferred_configure updating conffiles");
 		/* This will not do at all the right thing with overridden
 		 * conffiles or conffiles that are the ‘target’ of an override;
@@ -676,10 +677,10 @@ deferred_configure(struct pkginfo *pkg)
 			deferred_configure_conffile(pkg, conff);
 		}
 
-		pkg_set_status(pkg, stat_halfconfigured);
+		pkg_set_status(pkg, PKG_STAT_HALFCONFIGURED);
 	}
 
-	assert(pkg->status == stat_halfconfigured);
+	assert(pkg->status == PKG_STAT_HALFCONFIGURED);
 
 	modstatdb_note(pkg);
 
@@ -691,7 +692,7 @@ deferred_configure(struct pkginfo *pkg)
 
 	pkg_reset_eflags(pkg);
 	pkg->trigpend_head = NULL;
-	post_postinst_tasks(pkg, stat_installed);
+	post_postinst_tasks(pkg, PKG_STAT_INSTALLED);
 }
 
 /**

+ 33 - 28
src/depcon.c

@@ -333,12 +333,15 @@ depisok(struct dependency *dep, struct varbuf *whynot,
   case PKG_ISTOBE_NORMAL:
     /* Only installed packages can be make dependency problems. */
     switch (dep->up->status) {
-    case stat_installed:
-    case stat_triggerspending:
-    case stat_triggersawaited:
+    case PKG_STAT_INSTALLED:
+    case PKG_STAT_TRIGGERSPENDING:
+    case PKG_STAT_TRIGGERSAWAITED:
       break;
-    case stat_notinstalled: case stat_configfiles: case stat_halfinstalled:
-    case stat_halfconfigured: case stat_unpacked:
+    case PKG_STAT_NOTINSTALLED:
+    case PKG_STAT_CONFIGFILES:
+    case PKG_STAT_HALFINSTALLED:
+    case PKG_STAT_HALFCONFIGURED:
+    case PKG_STAT_UNPACKED:
       return true;
     default:
       internerr("unknown status depending '%d'", dep->up->status);
@@ -392,8 +395,8 @@ depisok(struct dependency *dep, struct varbuf *whynot,
         case PKG_ISTOBE_NORMAL:
         case PKG_ISTOBE_PREINSTALL:
           switch (pkg_pos->status) {
-          case stat_installed:
-          case stat_triggerspending:
+          case PKG_STAT_INSTALLED:
+          case PKG_STAT_TRIGGERSPENDING:
             if (versionsatisfied(&pkg_pos->installed, possi)) {
               deppossi_pkg_iter_free(possi_iter);
               return true;
@@ -403,19 +406,19 @@ depisok(struct dependency *dep, struct varbuf *whynot,
                     pkg_name(pkg_pos, pnaw_nonambig),
                     versiondescribe(&pkg_pos->installed.version, vdew_nonambig));
             break;
-          case stat_notinstalled:
+          case PKG_STAT_NOTINSTALLED:
             /* Don't say anything about this yet - it might be a virtual package.
              * Later on, if nothing has put anything in linebuf, we know that it
              * isn't and issue a diagnostic then. */
             *linebuf = '\0';
             break;
-          case stat_triggersawaited:
+          case PKG_STAT_TRIGGERSAWAITED:
               if (canfixbytrigaw && versionsatisfied(&pkg_pos->installed, possi))
                 *canfixbytrigaw = pkg_pos;
               /* Fall through to have a chance to return OK due to
                * allowunconfigd and to fill the explanation */
-          case stat_unpacked:
-          case stat_halfconfigured:
+          case PKG_STAT_UNPACKED:
+          case PKG_STAT_HALFCONFIGURED:
             if (allowunconfigd) {
               if (!dpkg_version_is_informative(&pkg_pos->configversion)) {
                 sprintf(linebuf, _("  %.250s is unpacked, but has never been "
@@ -493,10 +496,10 @@ depisok(struct dependency *dep, struct varbuf *whynot,
             break;
           case PKG_ISTOBE_NORMAL:
           case PKG_ISTOBE_PREINSTALL:
-            if (provider->up->up->status == stat_installed ||
-                provider->up->up->status == stat_triggerspending)
+            if (provider->up->up->status == PKG_STAT_INSTALLED ||
+                provider->up->up->status == PKG_STAT_TRIGGERSPENDING)
               return true;
-            if (provider->up->up->status == stat_triggersawaited)
+            if (provider->up->up->status == PKG_STAT_TRIGGERSAWAITED)
               *canfixbytrigaw = provider->up->up;
             sprintf(linebuf, _("  %.250s provides %.250s but is %s.\n"),
                     pkg_name(provider->up->up, pnaw_nonambig),
@@ -564,17 +567,17 @@ depisok(struct dependency *dep, struct varbuf *whynot,
         case PKG_ISTOBE_NORMAL:
         case PKG_ISTOBE_PREINSTALL:
           switch (pkg_pos->status) {
-          case stat_notinstalled:
-          case stat_configfiles:
+          case PKG_STAT_NOTINSTALLED:
+          case PKG_STAT_CONFIGFILES:
             break;
-          case stat_halfinstalled:
-          case stat_unpacked:
-          case stat_halfconfigured:
+          case PKG_STAT_HALFINSTALLED:
+          case PKG_STAT_UNPACKED:
+          case PKG_STAT_HALFCONFIGURED:
             if (dep->type == dep_breaks)
               break; /* No problem. */
-          case stat_installed:
-          case stat_triggerspending:
-          case stat_triggersawaited:
+          case PKG_STAT_INSTALLED:
+          case PKG_STAT_TRIGGERSPENDING:
+          case PKG_STAT_TRIGGERSAWAITED:
             if (!versionsatisfied(&pkg_pos->installed, possi))
               break;
             sprintf(linebuf, _("  %.250s (version %.250s) is present and %s.\n"),
@@ -642,15 +645,17 @@ depisok(struct dependency *dep, struct varbuf *whynot,
         case PKG_ISTOBE_NORMAL:
         case PKG_ISTOBE_PREINSTALL:
           switch (provider->up->up->status) {
-          case stat_notinstalled: case stat_configfiles:
+          case PKG_STAT_NOTINSTALLED:
+          case PKG_STAT_CONFIGFILES:
             continue;
-          case stat_halfinstalled: case stat_unpacked:
-          case stat_halfconfigured:
+          case PKG_STAT_HALFINSTALLED:
+          case PKG_STAT_UNPACKED:
+          case PKG_STAT_HALFCONFIGURED:
             if (dep->type == dep_breaks)
               break; /* No problem. */
-          case stat_installed:
-          case stat_triggerspending:
-          case stat_triggersawaited:
+          case PKG_STAT_INSTALLED:
+          case PKG_STAT_TRIGGERSPENDING:
+          case PKG_STAT_TRIGGERSAWAITED:
             sprintf(linebuf,
                     _("  %.250s provides %.250s and is present and %s.\n"),
                     pkg_name(provider->up->up, pnaw_nonambig), possi->ed->name,

+ 22 - 16
src/enquiry.c

@@ -73,7 +73,7 @@ audit_status(struct pkginfo *pkg, const struct audit_problem *problem)
 static bool
 audit_infofile(struct pkginfo *pkg, const struct audit_problem *problem)
 {
-  if (pkg->status < stat_halfinstalled)
+  if (pkg->status < PKG_STAT_HALFINSTALLED)
     return false;
   return !pkg_infodb_has_file(pkg, &pkg->installed, problem->value.string);
 }
@@ -81,7 +81,7 @@ audit_infofile(struct pkginfo *pkg, const struct audit_problem *problem)
 static bool
 audit_arch(struct pkginfo *pkg, const struct audit_problem *problem)
 {
-  if (pkg->status < stat_halfinstalled)
+  if (pkg->status < PKG_STAT_HALFINSTALLED)
     return false;
   return pkg->installed.arch->type == (enum dpkg_arch_type)problem->value.number;
 }
@@ -96,35 +96,35 @@ static const struct audit_problem audit_problems[] = {
     "that depend on them) to function properly:\n")
   }, {
     .check = audit_status,
-    .value.number = stat_unpacked,
+    .value.number = PKG_STAT_UNPACKED,
     .explanation = N_(
     "The following packages have been unpacked but not yet configured.\n"
     "They must be configured using dpkg --configure or the configure\n"
     "menu option in dselect for them to work:\n")
   }, {
     .check = audit_status,
-    .value.number = stat_halfconfigured,
+    .value.number = PKG_STAT_HALFCONFIGURED,
     .explanation = N_(
     "The following packages are only half configured, probably due to problems\n"
     "configuring them the first time.  The configuration should be retried using\n"
     "dpkg --configure <package> or the configure menu option in dselect:\n")
   }, {
     .check = audit_status,
-    .value.number = stat_halfinstalled,
+    .value.number = PKG_STAT_HALFINSTALLED,
     .explanation = N_(
     "The following packages are only half installed, due to problems during\n"
     "installation.  The installation can probably be completed by retrying it;\n"
     "the packages can be removed using dselect or dpkg --remove:\n")
   }, {
     .check = audit_status,
-    .value.number = stat_triggersawaited,
+    .value.number = PKG_STAT_TRIGGERSAWAITED,
     .explanation = N_(
     "The following packages are awaiting processing of triggers that they\n"
     "have activated in other packages.  This processing can be requested using\n"
     "dselect or dpkg --configure --pending (or dpkg --triggers-only):\n")
   }, {
     .check = audit_status,
-    .value.number = stat_triggerspending,
+    .value.number = PKG_STAT_TRIGGERSPENDING,
     .explanation = N_(
     "The following packages have been triggered, but the trigger processing\n"
     "has not yet been done.  Trigger processing can be requested using\n"
@@ -181,7 +181,7 @@ pkg_array_mapper(const char *name)
   struct pkginfo *pkg;
 
   pkg = dpkg_options_parse_pkgname(cipaction, name);
-  if (pkg->status == stat_notinstalled)
+  if (pkg->status == PKG_STAT_NOTINSTALLED)
     notice(_("package '%s' is not installed"), pkg_name(pkg, pnaw_nonambig));
 
   return pkg;
@@ -249,11 +249,15 @@ yettobeunpacked(struct pkginfo *pkg, const char **thissect)
     return false;
 
   switch (pkg->status) {
-  case stat_unpacked: case stat_installed: case stat_halfconfigured:
-  case stat_triggerspending:
-  case stat_triggersawaited:
+  case PKG_STAT_UNPACKED:
+  case PKG_STAT_INSTALLED:
+  case PKG_STAT_HALFCONFIGURED:
+  case PKG_STAT_TRIGGERSPENDING:
+  case PKG_STAT_TRIGGERSAWAITED:
     return false;
-  case stat_notinstalled: case stat_halfinstalled: case stat_configfiles:
+  case PKG_STAT_NOTINSTALLED:
+  case PKG_STAT_HALFINSTALLED:
+  case PKG_STAT_CONFIGFILES:
     if (thissect)
       *thissect = str_is_set(pkg->section) ? pkg->section :
                                              C_("section", "<unknown>");
@@ -367,11 +371,13 @@ assert_version_support(const char *const *argv,
 
   pkg = pkg_db_find_singleton("dpkg");
   switch (pkg->status) {
-  case stat_installed:
-  case stat_triggerspending:
+  case PKG_STAT_INSTALLED:
+  case PKG_STAT_TRIGGERSPENDING:
     return 0;
-  case stat_unpacked: case stat_halfconfigured: case stat_halfinstalled:
-  case stat_triggersawaited:
+  case PKG_STAT_UNPACKED:
+  case PKG_STAT_HALFCONFIGURED:
+  case PKG_STAT_HALFINSTALLED:
+  case PKG_STAT_TRIGGERSAWAITED:
     if (dpkg_version_relate(&pkg->configversion, DPKG_RELATION_GE, version))
       return 0;
     printf(_("Version of dpkg with working %s support not yet configured.\n"

+ 3 - 3
src/filesdb.c

@@ -219,7 +219,7 @@ ensure_packagefiles_available(struct pkginfo *pkg)
   pkg_files_blank(pkg);
 
   /* Packages which aren't installed don't have a files list. */
-  if (pkg->status == stat_notinstalled) {
+  if (pkg->status == PKG_STAT_NOTINSTALLED) {
     pkg->clientdata->fileslistvalid = true;
     return;
   }
@@ -235,7 +235,7 @@ ensure_packagefiles_available(struct pkginfo *pkg)
       ohshite(_("unable to open files list file for package `%.250s'"),
               pkg_name(pkg, pnaw_nonambig));
     onerr_abort--;
-    if (pkg->status != stat_configfiles &&
+    if (pkg->status != PKG_STAT_CONFIGFILES &&
         dpkg_version_is_informative(&pkg->configversion)) {
       warning(_("files list file for package '%.250s' missing; assuming "
                 "package has no files currently installed"),
@@ -336,7 +336,7 @@ pkg_files_optimize_load(struct pkg_array *array)
 
     ensure_package_clientdata(pkg);
 
-    if (pkg->status == stat_notinstalled ||
+    if (pkg->status == PKG_STAT_NOTINSTALLED ||
         pkg->clientdata->listfile_phys_offs != 0)
       continue;
 

+ 8 - 8
src/help.c

@@ -41,14 +41,14 @@
 #include "main.h"
 
 const char *const statusstrings[]= {
-  [stat_notinstalled]    = N_("not installed"),
-  [stat_configfiles]     = N_("not installed but configs remain"),
-  [stat_halfinstalled]   = N_("broken due to failed removal or installation"),
-  [stat_unpacked]        = N_("unpacked but not configured"),
-  [stat_halfconfigured]  = N_("broken due to postinst failure"),
-  [stat_triggersawaited] = N_("awaiting trigger processing by another package"),
-  [stat_triggerspending] = N_("triggered"),
-  [stat_installed]       = N_("installed")
+  [PKG_STAT_NOTINSTALLED]    = N_("not installed"),
+  [PKG_STAT_CONFIGFILES]     = N_("not installed but configs remain"),
+  [PKG_STAT_HALFINSTALLED]   = N_("broken due to failed removal or installation"),
+  [PKG_STAT_UNPACKED]        = N_("unpacked but not configured"),
+  [PKG_STAT_HALFCONFIGURED]  = N_("broken due to postinst failure"),
+  [PKG_STAT_TRIGGERSAWAITED] = N_("awaiting trigger processing by another package"),
+  [PKG_STAT_TRIGGERSPENDING] = N_("triggered"),
+  [PKG_STAT_INSTALLED]       = N_("installed")
 };
 
 struct filenamenode *

+ 1 - 1
src/infodb-upgrade.c

@@ -117,7 +117,7 @@ pkg_infodb_link_multiarch_files(void)
 
 		set = pkg_db_find_set(pkgname.buf);
 		for (pkg = &set->pkg; pkg; pkg = pkg->arch_next)
-			if (pkg->status != stat_notinstalled)
+			if (pkg->status != PKG_STAT_NOTINSTALLED)
 				break;
 		if (!pkg) {
 			warning(_("info file %s/%s not associated to any package"),

+ 1 - 1
src/main.c

@@ -542,7 +542,7 @@ arch_remove(const char *const *argv)
   /* Check if it's safe to remove the architecture from the db. */
   iter = pkg_db_iter_new();
   while ((pkg = pkg_db_iter_next_pkg(iter))) {
-    if (pkg->status < stat_halfinstalled)
+    if (pkg->status < PKG_STAT_HALFINSTALLED)
       continue;
     if (pkg->installed.arch == arch) {
       if (fc_architecture)

+ 20 - 19
src/packages.c

@@ -69,8 +69,8 @@ enqueue_pending(void)
   while ((pkg = pkg_db_iter_next_pkg(it)) != NULL) {
     switch (cipaction->arg_int) {
     case act_configure:
-      if (!(pkg->status == stat_unpacked ||
-            pkg->status == stat_halfconfigured ||
+      if (!(pkg->status == PKG_STAT_UNPACKED ||
+            pkg->status == PKG_STAT_HALFCONFIGURED ||
             pkg->trigpend_head))
         continue;
       if (pkg->want != PKG_WANT_INSTALL)
@@ -87,10 +87,10 @@ enqueue_pending(void)
       if (pkg->want != PKG_WANT_PURGE) {
         if (pkg->want != PKG_WANT_DEINSTALL)
           continue;
-        if (pkg->status == stat_configfiles)
+        if (pkg->status == PKG_STAT_CONFIGFILES)
           continue;
       }
-      if (pkg->status == stat_notinstalled)
+      if (pkg->status == PKG_STAT_NOTINSTALLED)
         continue;
       break;
     default:
@@ -110,7 +110,7 @@ enqueue_specified(const char *const *argv)
     struct pkginfo *pkg;
 
     pkg = dpkg_options_parse_pkgname(cipaction, thisarg);
-    if (pkg->status == stat_notinstalled &&
+    if (pkg->status == PKG_STAT_NOTINSTALLED &&
         str_match_end(pkg->set->name, DEBEXT)) {
       badusage(_("you must specify packages by their own names, "
                  "not by quoting the names of the files they come in"));
@@ -222,8 +222,8 @@ void process_queue(void) {
       }
     }
 
-    if (pkg->status > stat_installed)
-      internerr("package status (%d) > stat_installed", pkg->status);
+    if (pkg->status > PKG_STAT_INSTALLED)
+      internerr("package status (%d) > PKG_STAT_INSTALLED", pkg->status);
 
     if (setjmp(ejbuf)) {
       /* Give up on it from the point of view of other packages, i.e. reset
@@ -247,7 +247,7 @@ void process_queue(void) {
       /* Fall through. */
     case act_install:
       /* Don't try to configure pkgs that we've just disappeared. */
-      if (pkg->status == stat_notinstalled)
+      if (pkg->status == PKG_STAT_NOTINSTALLED)
         break;
       /* Fall through. */
     case act_configure:
@@ -355,11 +355,11 @@ deppossi_ok_found(struct pkginfo *possdependee, struct pkginfo *requiredby,
     return thisf;
   }
   switch (possdependee->status) {
-  case stat_unpacked:
-  case stat_halfconfigured:
-  case stat_triggersawaited:
-  case stat_triggerspending:
-  case stat_installed:
+  case PKG_STAT_UNPACKED:
+  case PKG_STAT_HALFCONFIGURED:
+  case PKG_STAT_TRIGGERSAWAITED:
+  case PKG_STAT_TRIGGERSPENDING:
+  case PKG_STAT_INSTALLED:
     if (checkversion && !versionsatisfied(&possdependee->installed,checkversion)) {
       varbuf_printf(oemsgs, _("  Version of %s on system is %s.\n"),
                     pkg_name(possdependee, pnaw_nonambig),
@@ -372,12 +372,12 @@ deppossi_ok_found(struct pkginfo *possdependee, struct pkginfo *requiredby,
       (*interestingwarnings)++;
       return thisf;
     }
-    if (possdependee->status == stat_installed ||
-        possdependee->status == stat_triggerspending) {
+    if (possdependee->status == PKG_STAT_INSTALLED ||
+        possdependee->status == PKG_STAT_TRIGGERSPENDING) {
       debug(dbg_depcondetail,"      is installed, ok and found");
       return FOUND_OK;
     }
-    if (possdependee->status == stat_triggersawaited) {
+    if (possdependee->status == PKG_STAT_TRIGGERSAWAITED) {
       assert(possdependee->trigaw.head);
       if (removing ||
           !(f_triggers ||
@@ -416,7 +416,7 @@ deppossi_ok_found(struct pkginfo *possdependee, struct pkginfo *requiredby,
       return FOUND_DEFER;
     } else if (!removing && fc_configureany &&
                !skip_due_to_hold(possdependee) &&
-               !(possdependee->status == stat_halfconfigured)) {
+               !(possdependee->status == PKG_STAT_HALFCONFIGURED)) {
       notice(_("also configuring '%s' (required by '%s')"),
              pkg_name(possdependee, pnaw_nonambig),
              pkg_name(requiredby, pnaw_nonambig));
@@ -469,8 +469,9 @@ breaks_check_one(struct varbuf *aemsgs, enum dep_check *ok,
         pkg_name(breaker, pnaw_always),
         virtbroken ? virtbroken->name : "<none>");
 
-  if (breaker->status == stat_notinstalled ||
-      breaker->status == stat_configfiles) return;
+  if (breaker->status == PKG_STAT_NOTINSTALLED ||
+      breaker->status == PKG_STAT_CONFIGFILES)
+    return;
   if (broken == breaker) return;
   if (!versionsatisfied(&broken->installed, breaks)) return;
   /* The test below can only trigger if dep_breaks start having

+ 8 - 7
src/querycmd.c

@@ -280,7 +280,7 @@ listpackages(const char *const *argv)
   if (!*argv) {
     for (i = 0; i < array.n_pkgs; i++) {
       pkg = array.pkgs[i];
-      if (pkg->status == stat_notinstalled)
+      if (pkg->status == PKG_STAT_NOTINSTALLED)
         array.pkgs[i] = NULL;
     }
 
@@ -460,7 +460,7 @@ enqperpackage(const char *const *argv)
 
     switch (cipaction->arg_int) {
     case act_status:
-      if (pkg->status == stat_notinstalled &&
+      if (pkg->status == PKG_STAT_NOTINSTALLED &&
           pkg->priority == PKG_PRIO_UNKNOWN &&
           str_is_unset(pkg->section) &&
           !pkg->files &&
@@ -484,7 +484,7 @@ enqperpackage(const char *const *argv)
       break;
     case act_listfiles:
       switch (pkg->status) {
-      case stat_notinstalled:
+      case PKG_STAT_NOTINSTALLED:
         notice(_("package '%s' is not installed"),
                pkg_name(pkg, pnaw_nonambig));
         failures++;
@@ -567,7 +567,8 @@ showpackages(const char *const *argv)
   if (!*argv) {
     for (i = 0; i < array.n_pkgs; i++) {
       pkg = array.pkgs[i];
-      if (pkg->status == stat_notinstalled) continue;
+      if (pkg->status == PKG_STAT_NOTINSTALLED)
+        continue;
       pkg_format_show(fmt, pkg, &pkg->installed);
     }
   } else {
@@ -698,7 +699,7 @@ control_path(const char *const *argv)
   modstatdb_open(msdbrw_readonly);
 
   pkg = dpkg_options_parse_pkgname(cipaction, pkgname);
-  if (pkg->status == stat_notinstalled)
+  if (pkg->status == PKG_STAT_NOTINSTALLED)
     ohshit(_("package '%s' is not installed"),
            pkg_name(pkg, pnaw_nonambig));
 
@@ -725,7 +726,7 @@ control_list(const char *const *argv)
   modstatdb_open(msdbrw_readonly);
 
   pkg = dpkg_options_parse_pkgname(cipaction, pkgname);
-  if (pkg->status == stat_notinstalled)
+  if (pkg->status == PKG_STAT_NOTINSTALLED)
     ohshit(_("package '%s' is not installed"), pkg_name(pkg, pnaw_nonambig));
 
   pkg_infodb_foreach(pkg, &pkg->installed, pkg_infodb_print_filetype);
@@ -757,7 +758,7 @@ control_show(const char *const *argv)
   modstatdb_open(msdbrw_readonly);
 
   pkg = dpkg_options_parse_pkgname(cipaction, pkgname);
-  if (pkg->status == stat_notinstalled)
+  if (pkg->status == PKG_STAT_NOTINSTALLED)
     ohshit(_("package '%s' is not installed"), pkg_name(pkg, pnaw_nonambig));
 
   if (pkg_infodb_has_file(pkg, &pkg->installed, control_file))

+ 16 - 15
src/remove.c

@@ -63,9 +63,9 @@ static void checkforremoval(struct pkginfo *pkgtoremove,
     depender= possi->up->up;
     debug(dbg_depcon, "checking depending package '%s'",
           pkg_name(depender, pnaw_always));
-    if (!(depender->status == stat_installed ||
-          depender->status == stat_triggerspending ||
-          depender->status == stat_triggersawaited))
+    if (!(depender->status == PKG_STAT_INSTALLED ||
+          depender->status == PKG_STAT_TRIGGERSPENDING ||
+          depender->status == PKG_STAT_TRIGGERSAWAITED))
       continue;
     if (ignore_depends(depender)) {
       debug(dbg_depcon, "ignoring depending package '%s'",
@@ -103,14 +103,14 @@ void deferred_remove(struct pkginfo *pkg) {
       modstatdb_note(pkg);
   }
 
-  if (pkg->status == stat_notinstalled) {
+  if (pkg->status == PKG_STAT_NOTINSTALLED) {
     sincenothing = 0;
     warning(_("ignoring request to remove %.250s which isn't installed"),
             pkg_name(pkg, pnaw_nonambig));
     pkg->clientdata->istobe = PKG_ISTOBE_NORMAL;
     return;
   } else if (!f_pending &&
-             pkg->status == stat_configfiles &&
+             pkg->status == PKG_STAT_CONFIGFILES &&
              cipaction->arg_int != act_purge) {
     sincenothing = 0;
     warning(_("ignoring request to remove %.250s, only the config\n"
@@ -120,7 +120,7 @@ void deferred_remove(struct pkginfo *pkg) {
     return;
   }
 
-  if (pkg->installed.essential && pkg->status != stat_configfiles)
+  if (pkg->installed.essential && pkg->status != PKG_STAT_CONFIGFILES)
     forcibleerr(fc_removeessential,
                 _("this is an essential package; it should not be removed"));
 
@@ -165,7 +165,7 @@ void deferred_remove(struct pkginfo *pkg) {
     printf(_("Would remove or purge %s (%s) ...\n"),
            pkg_name(pkg, pnaw_nonambig),
            versiondescribe(&pkg->installed.version, vdew_nonambig));
-    pkg_set_status(pkg, stat_notinstalled);
+    pkg_set_status(pkg, PKG_STAT_NOTINSTALLED);
     pkg->clientdata->istobe = PKG_ISTOBE_NORMAL;
     return;
   }
@@ -176,18 +176,18 @@ void deferred_remove(struct pkginfo *pkg) {
          versiondescribe(&pkg->installed.version, vdew_nonambig));
   log_action("remove", pkg, &pkg->installed);
   trig_activate_packageprocessing(pkg);
-  if (pkg->status >= stat_halfconfigured) {
+  if (pkg->status >= PKG_STAT_HALFCONFIGURED) {
     static enum pkgstatus oldpkgstatus;
 
     oldpkgstatus= pkg->status;
-    pkg_set_status(pkg, stat_halfconfigured);
+    pkg_set_status(pkg, PKG_STAT_HALFCONFIGURED);
     modstatdb_note(pkg);
     push_cleanup(cu_prermremove, ~ehflag_normaltidy, NULL, 0, 2,
                  (void *)pkg, (void *)&oldpkgstatus);
     maintscript_installed(pkg, PRERMFILE, "pre-removal", "remove", NULL);
 
     /* Will turn into ‘half-installed’ soon ... */
-    pkg_set_status(pkg, stat_unpacked);
+    pkg_set_status(pkg, PKG_STAT_UNPACKED);
   }
 
   removal_bulk(pkg);
@@ -255,7 +255,7 @@ removal_bulk_remove_files(struct pkginfo *pkg)
   static struct varbuf fnvb;
   struct stat stab;
 
-    pkg_set_status(pkg, stat_halfinstalled);
+    pkg_set_status(pkg, PKG_STAT_HALFINSTALLED);
     modstatdb_note(pkg);
     push_checkpoint(~ehflag_bombout, ehflag_normaltidy);
 
@@ -360,7 +360,7 @@ removal_bulk_remove_files(struct pkginfo *pkg)
     pkg_infodb_foreach(pkg, &pkg->installed, removal_bulk_remove_file);
     dir_sync_path(pkg_infodb_get_dir());
 
-    pkg_set_status(pkg, stat_configfiles);
+    pkg_set_status(pkg, PKG_STAT_CONFIGFILES);
     pkg->installed.essential = false;
     modstatdb_note(pkg);
     push_checkpoint(~ehflag_bombout, ehflag_normaltidy);
@@ -600,7 +600,8 @@ void removal_bulk(struct pkginfo *pkg) {
 
   debug(dbg_general, "removal_bulk package %s", pkg_name(pkg, pnaw_always));
 
-  if (pkg->status == stat_halfinstalled || pkg->status == stat_unpacked) {
+  if (pkg->status == PKG_STAT_HALFINSTALLED ||
+      pkg->status == PKG_STAT_UNPACKED) {
     removal_bulk_remove_files(pkg);
   }
 
@@ -640,11 +641,11 @@ void removal_bulk(struct pkginfo *pkg) {
     if (unlink(filename) && errno != ENOENT)
       ohshite(_("can't remove old postrm script"));
 
-    pkg_set_status(pkg, stat_notinstalled);
+    pkg_set_status(pkg, PKG_STAT_NOTINSTALLED);
     pkg_set_want(pkg, PKG_WANT_UNKNOWN);
 
     /* This will mess up reverse links, but if we follow them
-     * we won't go back because pkg->status is stat_notinstalled. */
+     * we won't go back because pkg->status is PKG_STAT_NOTINSTALLED. */
     pkgbin_blank(&pkg->installed);
   }
 

+ 5 - 5
src/script.c

@@ -3,7 +3,7 @@
  * script.c - maintainer script routines
  *
  * Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
- * Copyright © 2007-2013 Guillem Jover <guillem@debian.org>
+ * Copyright © 2007-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
@@ -52,14 +52,14 @@
 void
 post_postinst_tasks(struct pkginfo *pkg, enum pkgstatus new_status)
 {
-	if (new_status < stat_triggersawaited)
+	if (new_status < PKG_STAT_TRIGGERSAWAITED)
 		pkg_set_status(pkg, new_status);
 	else if (pkg->trigaw.head)
-		pkg_set_status(pkg, stat_triggersawaited);
+		pkg_set_status(pkg, PKG_STAT_TRIGGERSAWAITED);
 	else if (pkg->trigpend_head)
-		pkg_set_status(pkg, stat_triggerspending);
+		pkg_set_status(pkg, PKG_STAT_TRIGGERSPENDING);
 	else
-		pkg_set_status(pkg, stat_installed);
+		pkg_set_status(pkg, PKG_STAT_INSTALLED);
 	modstatdb_note(pkg);
 
 	debug(dbg_triggersdetail, "post_postinst_tasks - trig_incorporate");

+ 2 - 1
src/select.c

@@ -73,7 +73,8 @@ getselections(const char *const *argv)
   if (!*argv) {
     for (i = 0; i < array.n_pkgs; i++) {
       pkg = array.pkgs[i];
-      if (pkg->status == stat_notinstalled) continue;
+      if (pkg->status == PKG_STAT_NOTINSTALLED)
+        continue;
       getsel1package(pkg);
     }
   } else {

+ 13 - 13
src/trigproc.c

@@ -297,9 +297,9 @@ check_trigger_cycle(struct pkginfo *processing_now)
 	debug(dbg_triggers, "check_triggers_cycle pnow=%s giveup=%p",
 	      pkg_name(processing_now, pnaw_always),
 	      pkg_name(giveup, pnaw_always));
-	assert(giveup->status == stat_triggersawaited ||
-	       giveup->status == stat_triggerspending);
-	pkg_set_status(giveup, stat_halfconfigured);
+	assert(giveup->status == PKG_STAT_TRIGGERSAWAITED ||
+	       giveup->status == PKG_STAT_TRIGGERSPENDING);
+	pkg_set_status(giveup, PKG_STAT_HALFCONFIGURED);
 	modstatdb_note(giveup);
 	print_error_perpackage(_("triggers looping, abandoned"),
 	                       pkg_name(giveup, pnaw_nonambig));
@@ -326,8 +326,8 @@ trigproc(struct pkginfo *pkg)
 	pkg->clientdata->trigprocdeferred = NULL;
 
 	if (pkg->trigpend_head) {
-		assert(pkg->status == stat_triggerspending ||
-		       pkg->status == stat_triggersawaited);
+		assert(pkg->status == PKG_STAT_TRIGGERSPENDING ||
+		       pkg->status == PKG_STAT_TRIGGERSAWAITED);
 
 		gaveup = check_trigger_cycle(pkg);
 		if (gaveup == pkg)
@@ -347,7 +347,7 @@ trigproc(struct pkginfo *pkg)
 
 		/* Setting the status to half-configured
 		 * causes modstatdb_note to clear pending triggers. */
-		pkg_set_status(pkg, stat_halfconfigured);
+		pkg_set_status(pkg, PKG_STAT_HALFCONFIGURED);
 		modstatdb_note(pkg);
 
 		if (!f_noact) {
@@ -356,7 +356,7 @@ trigproc(struct pkginfo *pkg)
 			                     namesarg.buf + 1, NULL);
 		}
 
-		post_postinst_tasks(pkg, stat_installed);
+		post_postinst_tasks(pkg, PKG_STAT_INSTALLED);
 	} else {
 		/* In other branch is done by modstatdb_note(), from inside
 		 * post_postinst_tasks(). */
@@ -376,7 +376,7 @@ transitional_interest_callback_ro(const char *trig, struct pkginfo *pkg,
 	debug(dbg_triggersdetail,
 	      "trig_transitional_interest_callback trig=%s pend=%s",
 	      trig, pkgbin_name(pend, pendbin, pnaw_always));
-	if (pend->status >= stat_triggersawaited)
+	if (pend->status >= PKG_STAT_TRIGGERSAWAITED)
 		trig_note_pend(pend, nfstrsave(trig));
 }
 
@@ -404,7 +404,7 @@ trig_transitional_activate(enum modstatdb_rw cstatus)
 
 	it = pkg_db_iter_new();
 	while ((pkg = pkg_db_iter_next_pkg(it))) {
-		if (pkg->status <= stat_halfinstalled)
+		if (pkg->status <= PKG_STAT_HALFINSTALLED)
 			continue;
 		debug(dbg_triggersdetail, "trig_transitional_activate %s %s",
 		      pkg_name(pkg, pnaw_always),
@@ -420,15 +420,15 @@ trig_transitional_activate(enum modstatdb_rw cstatus)
 		 * be written down. This should never happen in theory but
 		 * can happen if you restore an old status file that is
 		 * not in sync with the infodb files. */
-		if (pkg->status < stat_triggersawaited)
+		if (pkg->status < PKG_STAT_TRIGGERSAWAITED)
 			continue;
 
 		if (pkg->trigaw.head)
-			pkg_set_status(pkg, stat_triggersawaited);
+			pkg_set_status(pkg, PKG_STAT_TRIGGERSAWAITED);
 		else if (pkg->trigpend_head)
-			pkg_set_status(pkg, stat_triggerspending);
+			pkg_set_status(pkg, PKG_STAT_TRIGGERSPENDING);
 		else
-			pkg_set_status(pkg, stat_installed);
+			pkg_set_status(pkg, PKG_STAT_INSTALLED);
 	}
 	pkg_db_iter_free(it);
 

+ 33 - 31
src/unpack.c

@@ -357,7 +357,7 @@ pkg_disappear(struct pkginfo *pkg, struct pkginfo *infavour)
   pkg_infodb_foreach(pkg, &pkg->installed, pkg_infodb_remove_file);
   dir_sync_path(pkg_infodb_get_dir());
 
-  pkg_set_status(pkg, stat_notinstalled);
+  pkg_set_status(pkg, PKG_STAT_NOTINSTALLED);
   pkg_set_want(pkg, PKG_WANT_UNKNOWN);
   pkg_reset_eflags(pkg);
 
@@ -383,7 +383,7 @@ pkgset_getting_in_sync(struct pkginfo *pkg)
   for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
     if (otherpkg == pkg)
       continue;
-    if (otherpkg->status <= stat_configfiles)
+    if (otherpkg->status <= PKG_STAT_CONFIGFILES)
       continue;
     if (dpkg_version_compare(&pkg->available.version,
                              &otherpkg->installed.version)) {
@@ -528,7 +528,7 @@ void process_archive(const char *filename) {
   for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
     if (otherpkg == pkg)
       continue;
-    if (otherpkg->status <= stat_halfconfigured)
+    if (otherpkg->status <= PKG_STAT_HALFCONFIGURED)
       continue;
 
     if (dpkg_version_compare(&pkg->available.version,
@@ -597,7 +597,8 @@ void process_archive(const char *filename) {
 
   printf(_("Preparing to unpack %s ...\n"), pfilename);
 
-  if (pkg->status != stat_notinstalled && pkg->status != stat_configfiles) {
+  if (pkg->status != PKG_STAT_NOTINSTALLED &&
+      pkg->status != PKG_STAT_CONFIGFILES) {
     log_action("upgrade", pkg, &pkg->installed);
   } else {
     log_action("install", pkg, &pkg->available);
@@ -701,16 +702,16 @@ void process_archive(const char *filename) {
 
   oldversionstatus= pkg->status;
 
-  assert(oldversionstatus <= stat_installed);
+  assert(oldversionstatus <= PKG_STAT_INSTALLED);
   debug(dbg_general,"process_archive oldversionstatus=%s",
         statusstrings[oldversionstatus]);
 
-  if (oldversionstatus == stat_halfconfigured ||
-      oldversionstatus == stat_triggersawaited ||
-      oldversionstatus == stat_triggerspending ||
-      oldversionstatus == stat_installed) {
+  if (oldversionstatus == PKG_STAT_HALFCONFIGURED ||
+      oldversionstatus == PKG_STAT_TRIGGERSAWAITED ||
+      oldversionstatus == PKG_STAT_TRIGGERSPENDING ||
+      oldversionstatus == PKG_STAT_INSTALLED) {
     pkg_set_eflags(pkg, PKG_EFLAG_REINSTREQ);
-    pkg_set_status(pkg, stat_halfconfigured);
+    pkg_set_status(pkg, PKG_STAT_HALFCONFIGURED);
     modstatdb_note(pkg);
     push_cleanup(cu_prermupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg);
     if (dpkg_version_compare(&pkg->available.version,
@@ -724,8 +725,8 @@ void process_archive(const char *filename) {
                             versiondescribe(&pkg->available.version,
                                             vdew_nonambig),
                             NULL);
-    pkg_set_status(pkg, stat_unpacked);
-    oldversionstatus= stat_unpacked;
+    pkg_set_status(pkg, PKG_STAT_UNPACKED);
+    oldversionstatus = PKG_STAT_UNPACKED;
     modstatdb_note(pkg);
   }
 
@@ -744,7 +745,7 @@ void process_archive(const char *filename) {
              versiondescribe(&deconpil->pkg->installed.version, vdew_nonambig));
 
     trig_activate_packageprocessing(deconpil->pkg);
-    pkg_set_status(deconpil->pkg, stat_halfconfigured);
+    pkg_set_status(deconpil->pkg, PKG_STAT_HALFCONFIGURED);
     modstatdb_note(deconpil->pkg);
 
     /* This means that we *either* go and run postinst abort-deconfigure,
@@ -780,14 +781,14 @@ void process_archive(const char *filename) {
        conflictor_iter = conflictor_iter->next) {
     struct pkginfo *conflictor = conflictor_iter->pkg;
 
-    if (!(conflictor->status == stat_halfconfigured ||
-          conflictor->status == stat_triggersawaited ||
-          conflictor->status == stat_triggerspending ||
-          conflictor->status == stat_installed))
+    if (!(conflictor->status == PKG_STAT_HALFCONFIGURED ||
+          conflictor->status == PKG_STAT_TRIGGERSAWAITED ||
+          conflictor->status == PKG_STAT_TRIGGERSPENDING ||
+          conflictor->status == PKG_STAT_INSTALLED))
       continue;
 
     trig_activate_packageprocessing(conflictor);
-    pkg_set_status(conflictor, stat_halfconfigured);
+    pkg_set_status(conflictor, PKG_STAT_HALFCONFIGURED);
     modstatdb_note(conflictor);
     push_cleanup(cu_prerminfavour, ~ehflag_normaltidy, NULL, 0,
                  2, conflictor, pkg);
@@ -797,23 +798,23 @@ void process_archive(const char *filename) {
                           versiondescribe(&pkg->available.version,
                                           vdew_nonambig),
                           NULL);
-    pkg_set_status(conflictor, stat_halfinstalled);
+    pkg_set_status(conflictor, PKG_STAT_HALFINSTALLED);
     modstatdb_note(conflictor);
   }
 
   pkg_set_eflags(pkg, PKG_EFLAG_REINSTREQ);
-  if (pkg->status == stat_notinstalled) {
+  if (pkg->status == PKG_STAT_NOTINSTALLED) {
     pkg->installed.version= pkg->available.version;
     pkg->installed.multiarch = pkg->available.multiarch;
   }
-  pkg_set_status(pkg, stat_halfinstalled);
+  pkg_set_status(pkg, PKG_STAT_HALFINSTALLED);
   modstatdb_note(pkg);
-  if (oldversionstatus == stat_notinstalled) {
+  if (oldversionstatus == PKG_STAT_NOTINSTALLED) {
     push_cleanup(cu_preinstverynew, ~ehflag_normaltidy, NULL, 0,
                  3,(void*)pkg,(void*)cidir,(void*)cidirrest);
     maintscript_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
                     "install", NULL);
-  } else if (oldversionstatus == stat_configfiles) {
+  } else if (oldversionstatus == PKG_STAT_CONFIGFILES) {
     push_cleanup(cu_preinstnew, ~ehflag_normaltidy, NULL, 0,
                  3,(void*)pkg,(void*)cidir,(void*)cidirrest);
     maintscript_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
@@ -829,8 +830,8 @@ void process_archive(const char *filename) {
                     NULL);
   }
 
-  if (oldversionstatus == stat_notinstalled ||
-      oldversionstatus == stat_configfiles) {
+  if (oldversionstatus == PKG_STAT_NOTINSTALLED ||
+      oldversionstatus == PKG_STAT_CONFIGFILES) {
     printf(_("Unpacking %s (%s) ...\n"),
            pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
            versiondescribe(&pkg->available.version, vdew_nonambig));
@@ -951,10 +952,11 @@ void process_archive(const char *filename) {
 
   tar_deferred_extract(newfileslist, pkg);
 
-  if (oldversionstatus == stat_halfinstalled || oldversionstatus == stat_unpacked) {
+  if (oldversionstatus == PKG_STAT_HALFINSTALLED ||
+      oldversionstatus == PKG_STAT_UNPACKED) {
     /* Packages that were in ‘installed’ and ‘postinstfailed’ have been
      * reduced to ‘unpacked’ by now, by the running of the prerm script. */
-    pkg_set_status(pkg, stat_halfinstalled);
+    pkg_set_status(pkg, PKG_STAT_HALFINSTALLED);
     modstatdb_note(pkg);
     push_cleanup(cu_postrmupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg);
     maintscript_fallback(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
@@ -1237,7 +1239,7 @@ void process_archive(const char *filename) {
     if (otherpkg->installed.arch != pkg->installed.arch)
       continue;
 
-    assert(otherpkg->status == stat_notinstalled);
+    assert(otherpkg->status == PKG_STAT_NOTINSTALLED);
 
     pkg_blank(otherpkg);
   }
@@ -1255,8 +1257,8 @@ void process_archive(const char *filename) {
   while ((otherpkg = pkg_db_iter_next_pkg(it)) != NULL) {
     ensure_package_clientdata(otherpkg);
     if (otherpkg == pkg ||
-        otherpkg->status == stat_notinstalled ||
-        otherpkg->status == stat_configfiles ||
+        otherpkg->status == PKG_STAT_NOTINSTALLED ||
+        otherpkg->status == PKG_STAT_CONFIGFILES ||
         otherpkg->clientdata->istobe == PKG_ISTOBE_REMOVE ||
         !otherpkg->clientdata->files) continue;
     /* Do not try to disappear other packages from the same set
@@ -1395,7 +1397,7 @@ void process_archive(const char *filename) {
    * The only thing that we have left to do with it is remove
    * backup files, and we can leave the user to fix that if and when
    * it happens (we leave the reinstall required flag, of course). */
-  pkg_set_status(pkg, stat_unpacked);
+  pkg_set_status(pkg, PKG_STAT_UNPACKED);
   modstatdb_note(pkg);
 
   /* Now we delete all the backup files that we made when

+ 1 - 1
src/verify.c

@@ -150,7 +150,7 @@ verify(const char *const *argv)
 
 		while ((thisarg = *argv++)) {
 			pkg = dpkg_options_parse_pkgname(cipaction, thisarg);
-			if (pkg->status == stat_notinstalled) {
+			if (pkg->status == PKG_STAT_NOTINSTALLED) {
 				notice(_("package '%s' is not installed"),
 				       pkg_name(pkg, pnaw_nonambig));
 				rc = 1;