Sfoglia il codice sorgente

libdpkg: Uppercase and namespace pkgstatus enum values

Guillem Jover 12 anni fa
parent
commit
63b138afa6

+ 5 - 5
dselect/pkgcmds.cc

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

+ 8 - 8
dselect/pkgdepcon.cc

@@ -38,9 +38,9 @@ packagelist::useavailable(pkginfo *pkg)
   if (pkg->clientdata &&
   if (pkg->clientdata &&
       pkg->clientdata->selected == PKG_WANT_INSTALL &&
       pkg->clientdata->selected == PKG_WANT_INSTALL &&
       pkg_is_informative(pkg, &pkg->available) &&
       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,
        dpkg_version_compare(&pkg->available.version,
                             &pkg->installed.version) > 0))
                             &pkg->installed.version) > 0))
     return true;
     return true;
@@ -204,7 +204,7 @@ packagelist::deselect_one_of(pkginfo *per, pkginfo *ped, dependency *dep)
 
 
   if (best->spriority >= sp_deselecting) return 0;
   if (best->spriority >= sp_deselecting) return 0;
   best->suggested=
   best->suggested=
-    best->pkg->status == stat_notinstalled
+    best->pkg->status == PKG_STAT_NOTINSTALLED
       ? PKG_WANT_PURGE : PKG_WANT_DEINSTALL; // FIXME: configurable.
       ? PKG_WANT_PURGE : PKG_WANT_DEINSTALL; // FIXME: configurable.
   best->selected= best->suggested;
   best->selected= best->suggested;
   best->spriority= sp_deselecting;
   best->spriority= sp_deselecting;
@@ -328,7 +328,7 @@ int packagelist::resolvedepcon(dependency *depends) {
     /* Always remove depends, but never remove recommends. */
     /* Always remove depends, but never remove recommends. */
     if (depends->type != dep_recommends) {
     if (depends->type != dep_recommends) {
       best->selected= best->suggested=
       best->selected= best->suggested=
-        best->pkg->status == stat_notinstalled
+        best->pkg->status == PKG_STAT_NOTINSTALLED
           ? PKG_WANT_PURGE : PKG_WANT_DEINSTALL; // FIXME: configurable
           ? PKG_WANT_PURGE : PKG_WANT_DEINSTALL; // FIXME: configurable
       best->spriority= sp_deselecting;
       best->spriority= sp_deselecting;
     }
     }
@@ -443,9 +443,9 @@ packagelist::deppossatisfied(deppossi *possi, perpackagestate **fixbyupgrade)
     if (useavailable(provider->up->up))
     if (useavailable(provider->up->up))
       return true;
       return true;
     if (fixbyupgrade && !*fixbyupgrade &&
     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,
          dpkg_version_compare(&provider->up->up->available.version,
                               &provider->up->up->installed.version) > 1))
                               &provider->up->up->installed.version) > 1))
       *fixbyupgrade = provider->up->up->clientdata;
       *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));
             this, index, pkg_name(table[index]->pkg, pnaw_always));
       pkg= table[index]->pkg;
       pkg= table[index]->pkg;
       switch (pkg->status) {
       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;
         table[index]->ssavail= ssa_broken;
         break;
         break;
-      case stat_notinstalled:
-      case stat_configfiles:
+      case PKG_STAT_NOTINSTALLED:
+      case PKG_STAT_CONFIGFILES:
         if (!dpkg_version_is_informative(&pkg->available.version)) {
         if (!dpkg_version_is_informative(&pkg->available.version)) {
           table[index]->ssavail= ssa_notinst_gone;
           table[index]->ssavail= ssa_notinst_gone;
 // FIXME: Disable for now as a workaround, until dselect knows how to properly
 // 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;
           table[index]->ssavail= ssa_notinst_seen;
         }
         }
         break;
         break;
-      case stat_installed:
+      case PKG_STAT_INSTALLED:
         veri= &table[index]->pkg->installed.version;
         veri= &table[index]->pkg->installed.version;
         vera= &table[index]->pkg->available.version;
         vera= &table[index]->pkg->available.version;
         if (!dpkg_version_is_informative(vera)) {
         if (!dpkg_version_is_informative(vera)) {
@@ -232,20 +232,20 @@ void packagelist::ensurestatsortinfo() {
       debug(dbg_general, "packagelist[%p]::ensurestatsortinfos() i=%d pkg=%s",
       debug(dbg_general, "packagelist[%p]::ensurestatsortinfos() i=%d pkg=%s",
             this, index, pkg_name(table[index]->pkg, pnaw_always));
             this, index, pkg_name(table[index]->pkg, pnaw_always));
       switch (table[index]->pkg->status) {
       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;
         table[index]->ssstate= sss_broken;
         break;
         break;
-      case stat_notinstalled:
+      case PKG_STAT_NOTINSTALLED:
         table[index]->ssstate= sss_notinstalled;
         table[index]->ssstate= sss_notinstalled;
         break;
         break;
-      case stat_configfiles:
+      case PKG_STAT_CONFIGFILES:
         table[index]->ssstate= sss_configfiles;
         table[index]->ssstate= sss_configfiles;
         break;
         break;
-      case stat_installed:
+      case PKG_STAT_INSTALLED:
         table[index]->ssstate= sss_installed;
         table[index]->ssstate= sss_installed;
         break;
         break;
       default:
       default:
@@ -392,7 +392,7 @@ packagelist::packagelist(keybindings *kb) : baselist(kb) {
   while ((pkg = pkg_db_iter_next_pkg(iter))) {
   while ((pkg = pkg_db_iter_next_pkg(iter))) {
     struct perpackagestate *state= &datatable[nitems];
     struct perpackagestate *state= &datatable[nitems];
     state->pkg= pkg;
     state->pkg= pkg;
-    if (pkg->status == stat_notinstalled &&
+    if (pkg->status == PKG_STAT_NOTINSTALLED &&
         !pkg->files &&
         !pkg->files &&
         pkg->want != PKG_WANT_INSTALL) {
         pkg->want != PKG_WANT_INSTALL) {
       pkg->clientdata = nullptr;
       pkg->clientdata = nullptr;
@@ -403,7 +403,7 @@ packagelist::packagelist(keybindings *kb) : baselist(kb) {
     if (modstatdb_get_status() == msdbrw_write &&
     if (modstatdb_get_status() == msdbrw_write &&
         state->original == PKG_WANT_UNKNOWN) {
         state->original == PKG_WANT_UNKNOWN) {
       state->suggested=
       state->suggested=
-        pkg->status == stat_installed ||
+        pkg->status == PKG_STAT_INSTALLED ||
           pkg->priority <= PKG_PRIO_STANDARD /* FIXME: configurable */
           pkg->priority <= PKG_PRIO_STANDARD /* FIXME: configurable */
             ? PKG_WANT_INSTALL : PKG_WANT_PURGE;
             ? PKG_WANT_INSTALL : PKG_WANT_PURGE;
       state->spriority= sp_inherit;
       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
   /* Clear pending triggers here so that only code that sets the status
    * to interesting (for triggers) values has to care about triggers. */
    * 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;
     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)
     for (ta = pkg->trigaw.head; ta; ta = ta->sameaw.next)
       ta->aw = NULL;
       ta->aw = NULL;
     pkg->trigaw.head = pkg->trigaw.tail = NULL;
     pkg->trigaw.head = pkg->trigaw.tail = NULL;

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

@@ -166,14 +166,14 @@ enum pkgeflag {
 };
 };
 
 
 enum pkgstatus {
 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 {
 enum pkgpriority {

+ 15 - 15
lib/dpkg/dump.c

@@ -89,9 +89,9 @@ w_configversion(struct varbuf *vb,
     return;
     return;
   if (!dpkg_version_is_informative(&pkg->configversion))
   if (!dpkg_version_is_informative(&pkg->configversion))
     return;
     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;
     return;
   if (flags&fw_printheader)
   if (flags&fw_printheader)
     varbuf_add_str(vb, "Config-Version: ");
     varbuf_add_str(vb, "Config-Version: ");
@@ -252,24 +252,24 @@ w_status(struct varbuf *vb,
 #define PEND pkg->trigpend_head
 #define PEND pkg->trigpend_head
 #define AW pkg->trigaw.head
 #define AW pkg->trigaw.head
   switch (pkg->status) {
   switch (pkg->status) {
-  case stat_notinstalled:
-  case stat_configfiles:
+  case PKG_STAT_NOTINSTALLED:
+  case PKG_STAT_CONFIGFILES:
     assert(!PEND);
     assert(!PEND);
     assert(!AW);
     assert(!AW);
     break;
     break;
-  case stat_halfinstalled:
-  case stat_unpacked:
-  case stat_halfconfigured:
+  case PKG_STAT_HALFINSTALLED:
+  case PKG_STAT_UNPACKED:
+  case PKG_STAT_HALFCONFIGURED:
     assert(!PEND);
     assert(!PEND);
     break;
     break;
-  case stat_triggersawaited:
+  case PKG_STAT_TRIGGERSAWAITED:
     assert(AW);
     assert(AW);
     break;
     break;
-  case stat_triggerspending:
+  case PKG_STAT_TRIGGERSPENDING:
     assert(PEND);
     assert(PEND);
     assert(!AW);
     assert(!AW);
     break;
     break;
-  case stat_installed:
+  case PKG_STAT_INSTALLED:
     assert(!PEND);
     assert(!PEND);
     assert(!AW);
     assert(!AW);
     break;
     break;
@@ -390,8 +390,8 @@ w_trigpend(struct varbuf *vb,
   if (pkgbin == &pkg->available || !pkg->trigpend_head)
   if (pkgbin == &pkg->available || !pkg->trigpend_head)
     return;
     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)
   if (flags & fw_printheader)
     varbuf_add_str(vb, "Triggers-Pending:");
     varbuf_add_str(vb, "Triggers-Pending:");
@@ -413,8 +413,8 @@ w_trigaw(struct varbuf *vb,
   if (pkgbin == &pkg->available || !pkg->trigaw.head)
   if (pkgbin == &pkg->available || !pkg->trigaw.head)
     return;
     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)
   if (flags & fw_printheader)
     varbuf_add_str(vb, "Triggers-Awaited:");
     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");
   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
    * 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) ||
   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->description, "description");
     parse_ensure_have_field(ps, &pkgbin->maintainer, "maintainer");
     parse_ensure_have_field(ps, &pkgbin->maintainer, "maintainer");
     parse_must_have_field(ps, pkgbin->version.version, "version");
     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
   /* 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
    * 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) ||
   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
     /* 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
      * is in such a state that it make sense), so that it can be used safely
      * on string comparisons and the like. */
      * 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). */
    * ‘not-installed’ (in which case there is no Config-Version). */
   if (!(ps->flags & pdb_recordavailable)) {
   if (!(ps->flags & pdb_recordavailable)) {
     if (pkg->configversion.version) {
     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,
         parse_error(ps,
                     _("Config-Version for package with inappropriate Status"));
                     _("Config-Version for package with inappropriate Status"));
     } else {
     } else {
-      if (pkg->status == stat_installed)
+      if (pkg->status == PKG_STAT_INSTALLED)
         pkg->configversion = pkgbin->version;
         pkg->configversion = pkgbin->version;
     }
     }
   }
   }
 
 
   if (pkg->trigaw.head &&
   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,
     parse_error(ps,
                 _("package has status %s but triggers are awaited"),
                 _("package has status %s but triggers are awaited"),
                 pkg_status_name(pkg));
                 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,
     parse_error(ps,
                 _("package has status triggers-awaited but no triggers awaited"));
                 _("package has status triggers-awaited but no triggers awaited"));
 
 
   if (pkg->trigpend_head &&
   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,
     parse_error(ps,
                 _("package has status %s but triggers are pending"),
                 _("package has status %s but triggers are pending"),
                 pkg_status_name(pkg));
                 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,
     parse_error(ps,
                 _("package has status triggers-pending but no triggers "
                 _("package has status triggers-pending but no triggers "
                   "pending"));
                   "pending"));
@@ -264,7 +265,7 @@ pkg_parse_verify(struct parsedb_state *ps,
    * conffiles, so we check for them here and remove them (rather than
    * conffiles, so we check for them here and remove them (rather than
    * calling it an error, which will do at some point). */
    * calling it an error, which will do at some point). */
   if (!(ps->flags & pdb_recordavailable) &&
   if (!(ps->flags & pdb_recordavailable) &&
-      pkg->status == stat_notinstalled &&
+      pkg->status == PKG_STAT_NOTINSTALLED &&
       pkgbin->conffiles) {
       pkgbin->conffiles) {
     parse_warn(ps,
     parse_warn(ps,
                _("Package which in state not-installed has conffiles, "
                _("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
    * there's guarantee that no leftover is found on the status file on
    * major distributions. */
    * major distributions. */
   if (!(ps->flags & pdb_recordavailable) &&
   if (!(ps->flags & pdb_recordavailable) &&
-      pkg->status == stat_notinstalled &&
+      pkg->status == PKG_STAT_NOTINSTALLED &&
       pkg->eflag == PKG_EFLAG_OK &&
       pkg->eflag == PKG_EFLAG_OK &&
       (pkg->want == PKG_WANT_PURGE ||
       (pkg->want == PKG_WANT_PURGE ||
        pkg->want == PKG_WANT_DEINSTALL ||
        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
    * might cause those selections to be unreferencable from command-line
    * interfaces when there's other more specific selections. */
    * interfaces when there's other more specific selections. */
   if (ps->type == pdb_file_status &&
   if (ps->type == pdb_file_status &&
-      pkg->status == stat_notinstalled &&
+      pkg->status == PKG_STAT_NOTINSTALLED &&
       pkg->eflag == PKG_EFLAG_OK &&
       pkg->eflag == PKG_EFLAG_OK &&
       pkg->want == PKG_WANT_INSTALL &&
       pkg->want == PKG_WANT_INSTALL &&
       pkgbin->arch->type == DPKG_ARCH_EMPTY)
       pkgbin->arch->type == DPKG_ARCH_EMPTY)
@@ -307,7 +308,7 @@ static void
 parse_count_pkg_instance(struct pkgcount *count,
 parse_count_pkg_instance(struct pkgcount *count,
                          struct pkginfo *pkg, struct pkgbin *pkgbin)
                          struct pkginfo *pkg, struct pkgbin *pkgbin)
 {
 {
-  if (pkg->status == stat_notinstalled)
+  if (pkg->status == PKG_STAT_NOTINSTALLED)
      return;
      return;
 
 
   if (pkgbin->multiarch == PKG_MULTIARCH_SAME)
   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
     /* If the package is part of the status file, and it's not installed
      * then this means it's just a selection. */
      * 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;
       selection = true;
 
 
     /* Verify we don't allow something that will mess up the db. */
     /* 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;
     return &set->pkg;
   case 1:
   case 1:
     for (pkg = &set->pkg; pkg; pkg = pkg->arch_next) {
     for (pkg = &set->pkg; pkg; pkg = pkg->arch_next) {
-      if (pkg->status > stat_notinstalled)
+      if (pkg->status > PKG_STAT_NOTINSTALLED)
         return pkg;
         return pkg;
     }
     }
     internerr("pkgset '%s' should have one installed instance", set->name);
     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[] = {
 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 }
 	{ .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)
 	if (pkg->status == status)
 		return;
 		return;
-	else if (pkg->status == stat_notinstalled)
+	else if (pkg->status == PKG_STAT_NOTINSTALLED)
 		pkg->set->installed_instances++;
 		pkg->set->installed_instances++;
-	else if (status == stat_notinstalled)
+	else if (status == PKG_STAT_NOTINSTALLED)
 		pkg->set->installed_instances--;
 		pkg->set->installed_instances--;
 
 
 	assert(pkg->set->installed_instances >= 0);
 	assert(pkg->set->installed_instances >= 0);
@@ -112,7 +112,7 @@ pkgbin_blank(struct pkgbin *pkgbin)
 void
 void
 pkg_blank(struct pkginfo *pkg)
 pkg_blank(struct pkginfo *pkg)
 {
 {
-	pkg->status = stat_notinstalled;
+	pkg->status = PKG_STAT_NOTINSTALLED;
 	pkg->eflag = PKG_EFLAG_OK;
 	pkg->eflag = PKG_EFLAG_OK;
 	pkg->want = PKG_WANT_UNKNOWN;
 	pkg->want = PKG_WANT_UNKNOWN;
 	pkg->priority = PKG_PRIO_UNKNOWN;
 	pkg->priority = PKG_PRIO_UNKNOWN;
@@ -189,7 +189,7 @@ pkg_is_informative(struct pkginfo *pkg, struct pkgbin *pkgbin)
 	if (pkgbin == &pkg->installed &&
 	if (pkgbin == &pkg->installed &&
 	    (pkg->want != PKG_WANT_UNKNOWN ||
 	    (pkg->want != PKG_WANT_UNKNOWN ||
 	     pkg->eflag != PKG_EFLAG_OK ||
 	     pkg->eflag != PKG_EFLAG_OK ||
-	     pkg->status != stat_notinstalled ||
+	     pkg->status != PKG_STAT_NOTINSTALLED ||
 	     dpkg_version_is_informative(&pkg->configversion)))
 	     dpkg_version_is_informative(&pkg->configversion)))
 		return true;
 		return true;
 
 

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

@@ -82,62 +82,62 @@ test_pkginfo_instance_tracking(void)
 	pkgset_link_pkg(&set, &pkg2);
 	pkgset_link_pkg(&set, &pkg2);
 
 
 	/* Test installation state transitions. */
 	/* Test installation state transitions. */
-	pkg_set_status(&pkg4, stat_installed);
+	pkg_set_status(&pkg4, PKG_STAT_INSTALLED);
 	test_pass(pkgset_installed_instances(&set) == 1);
 	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);
 	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);
 	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);
 	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);
 	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);
 	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);
 	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);
 	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);
 	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);
 	test_pass(pkgset_installed_instances(&set) == 0);
 
 
 	/* Toggle installation states on various packages. */
 	/* 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);
 	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);
 	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);
 	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);
 	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);
 	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);
 	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);
 	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);
 	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);
 	test_pass(pkgset_installed_instances(&set) == 0);
 }
 }
 
 

+ 7 - 7
lib/dpkg/triglib.c

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

+ 3 - 3
lib/dpkg/trignote.c

@@ -4,7 +4,7 @@
  *
  *
  * Copyright © 2007 Canonical Ltd
  * Copyright © 2007 Canonical Ltd
  * Written by Ian Jackson <ian@chiark.greenend.org.uk>
  * 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
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * 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;
 		return false;
 
 
 	if (pend->trigaw.head)
 	if (pend->trigaw.head)
-		pkg_set_status(pend, stat_triggersawaited);
+		pkg_set_status(pend, PKG_STAT_TRIGGERSAWAITED);
 	else
 	else
-		pkg_set_status(pend, stat_triggerspending);
+		pkg_set_status(pend, PKG_STAT_TRIGGERSPENDING);
 
 
 	return true;
 	return true;
 }
 }

+ 7 - 7
src/archives.c

@@ -196,12 +196,12 @@ md5hash_prev_conffile(struct pkginfo *pkg, char *oldhash, const char *oldname,
       continue;
       continue;
     /* The hash in the Conffiles is only meaningful if the package
     /* The hash in the Conffiles is only meaningful if the package
      * configuration has been at least tried. */
      * configuration has been at least tried. */
-    if (otherpkg->status < stat_unpacked)
+    if (otherpkg->status < PKG_STAT_UNPACKED)
       continue;
       continue;
     /* If we are reinstalling, even if the other package is only unpacked,
     /* 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
      * we can always make use of the Conffiles hash value from an initial
      * installation, if that happened at all. */
      * installation, if that happened at all. */
-    if (otherpkg->status == stat_unpacked &&
+    if (otherpkg->status == PKG_STAT_UNPACKED &&
         dpkg_version_compare(&otherpkg->installed.version,
         dpkg_version_compare(&otherpkg->installed.version,
                              &otherpkg->configversion) != 0)
                              &otherpkg->configversion) != 0)
       continue;
       continue;
@@ -957,7 +957,7 @@ tarobject(void *ctx, struct tar_entry *ti)
       /* Is the package with the conflicting file in the “config files only”
       /* 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
        * state? If so it must be a config file and we can silenty take it
        * over. */
        * over. */
-      if (otherpkg->status == stat_configfiles)
+      if (otherpkg->status == PKG_STAT_CONFIGFILES)
         continue;
         continue;
 
 
       /* Perhaps we're removing a conflicting package? */
       /* 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 ..."),
       notice(_("considering removing %s in favour of %s ..."),
              pkg_name(fixbyrm, pnaw_nonambig),
              pkg_name(fixbyrm, pnaw_nonambig),
              pkgbin_name(pkg, &pkg->available, 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"),
         notice(_("%s is not properly installed; ignoring any dependencies on it"),
                pkg_name(fixbyrm, pnaw_nonambig));
                pkg_name(fixbyrm, pnaw_nonambig));
         pdep = NULL;
         pdep = NULL;
@@ -1714,7 +1714,7 @@ wanttoinstall(struct pkginfo *pkg)
 
 
   if (pkg->eflag & PKG_EFLAG_REINSTREQ)
   if (pkg->eflag & PKG_EFLAG_REINSTREQ)
     return true;
     return true;
-  if (pkg->status < stat_unpacked)
+  if (pkg->status < PKG_STAT_UNPACKED)
     return true;
     return true;
 
 
   rc = dpkg_version_compare(&pkg->available.version, &pkg->installed.version);
   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),
                        versiondescribe(&pkg->available.version, vdew_nonambig),
                        NULL);
                        NULL);
   pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
   pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
-  post_postinst_tasks(pkg, stat_installed);
+  post_postinst_tasks(pkg, PKG_STAT_INSTALLED);
   cleanup_pkg_failed--;
   cleanup_pkg_failed--;
 }
 }
 
 
@@ -164,7 +164,7 @@ void cu_prermdeconfigure(int argc, void **argv) {
                          NULL);
                          NULL);
   }
   }
 
 
-  post_postinst_tasks(deconf, stat_installed);
+  post_postinst_tasks(deconf, PKG_STAT_INSTALLED);
 }
 }
 
 
 void cu_prerminfavour(int argc, void **argv) {
 void cu_prerminfavour(int argc, void **argv) {
@@ -180,7 +180,7 @@ void cu_prerminfavour(int argc, void **argv) {
                                        vdew_nonambig),
                                        vdew_nonambig),
                        NULL);
                        NULL);
   pkg_clear_eflags(conflictor, PKG_EFLAG_REINSTREQ);
   pkg_clear_eflags(conflictor, PKG_EFLAG_REINSTREQ);
-  post_postinst_tasks(conflictor, stat_installed);
+  post_postinst_tasks(conflictor, PKG_STAT_INSTALLED);
   cleanup_conflictor_failed--;
   cleanup_conflictor_failed--;
 }
 }
 
 
@@ -192,7 +192,7 @@ void cu_preinstverynew(int argc, void **argv) {
   if (cleanup_pkg_failed++) return;
   if (cleanup_pkg_failed++) return;
   maintscript_new(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
   maintscript_new(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
                   "abort-install", NULL);
                   "abort-install", NULL);
-  pkg_set_status(pkg, stat_notinstalled);
+  pkg_set_status(pkg, PKG_STAT_NOTINSTALLED);
   pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
   pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
   pkgbin_blank(&pkg->installed);
   pkgbin_blank(&pkg->installed);
   modstatdb_note(pkg);
   modstatdb_note(pkg);
@@ -209,7 +209,7 @@ void cu_preinstnew(int argc, void **argv) {
                   "abort-install",
                   "abort-install",
                   versiondescribe(&pkg->installed.version, vdew_nonambig),
                   versiondescribe(&pkg->installed.version, vdew_nonambig),
                   NULL);
                   NULL);
-  pkg_set_status(pkg, stat_configfiles);
+  pkg_set_status(pkg, PKG_STAT_CONFIGFILES);
   pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
   pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
   modstatdb_note(pkg);
   modstatdb_note(pkg);
   cleanup_pkg_failed--;
   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) {
 	for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
 		if (otherpkg == pkg)
 		if (otherpkg == pkg)
 			continue;
 			continue;
-		if (otherpkg->status <= stat_halfconfigured)
+		if (otherpkg->status <= PKG_STAT_HALFCONFIGURED)
 			continue;
 			continue;
 
 
 		for (otherconff = otherpkg->installed.conffiles; otherconff;
 		for (otherconff = otherpkg->installed.conffiles; otherconff;
@@ -560,13 +560,14 @@ deferred_configure(struct pkginfo *pkg)
 	struct pkginfo *otherpkg;
 	struct pkginfo *otherpkg;
 	enum dep_check ok;
 	enum dep_check ok;
 
 
-	if (pkg->status == stat_notinstalled)
+	if (pkg->status == PKG_STAT_NOTINSTALLED)
 		ohshit(_("no package named `%s' is installed, cannot configure"),
 		ohshit(_("no package named `%s' is installed, cannot configure"),
 		       pkg_name(pkg, pnaw_nonambig));
 		       pkg_name(pkg, pnaw_nonambig));
-	if (pkg->status == stat_installed)
+	if (pkg->status == PKG_STAT_INSTALLED)
 		ohshit(_("package %.250s is already installed and configured"),
 		ohshit(_("package %.250s is already installed and configured"),
 		       pkg_name(pkg, pnaw_nonambig));
 		       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"
 		ohshit(_("package %.250s is not ready for configuration\n"
 		         " cannot configure (current status `%.250s')"),
 		         " cannot configure (current status `%.250s')"),
 		       pkg_name(pkg, pnaw_nonambig),
 		       pkg_name(pkg, pnaw_nonambig),
@@ -575,10 +576,10 @@ deferred_configure(struct pkginfo *pkg)
 	for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
 	for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
 		if (otherpkg == pkg)
 		if (otherpkg == pkg)
 			continue;
 			continue;
-		if (otherpkg->status <= stat_configfiles)
+		if (otherpkg->status <= PKG_STAT_CONFIGFILES)
 			continue;
 			continue;
 
 
-		if (otherpkg->status < stat_unpacked)
+		if (otherpkg->status < PKG_STAT_UNPACKED)
 			ohshit(_("package %s cannot be configured because "
 			ohshit(_("package %s cannot be configured because "
 			         "%s is not ready (current status '%s')"),
 			         "%s is not ready (current status '%s')"),
 			       pkg_name(pkg, pnaw_always),
 			       pkg_name(pkg, pnaw_always),
@@ -614,7 +615,7 @@ deferred_configure(struct pkginfo *pkg)
 	/*
 	/*
 	 * At this point removal from the queue is confirmed. This
 	 * At this point removal from the queue is confirmed. This
 	 * represents irreversible progress wrt trigger cycles. Only
 	 * 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
 	 * configuration queue, and during configuration and trigger
 	 * processing new packages can't enter into unpacked.
 	 * processing new packages can't enter into unpacked.
 	 */
 	 */
@@ -647,12 +648,12 @@ deferred_configure(struct pkginfo *pkg)
 	trig_activate_packageprocessing(pkg);
 	trig_activate_packageprocessing(pkg);
 
 
 	if (f_noact) {
 	if (f_noact) {
-		pkg_set_status(pkg, stat_installed);
+		pkg_set_status(pkg, PKG_STAT_INSTALLED);
 		pkg->clientdata->istobe = PKG_ISTOBE_NORMAL;
 		pkg->clientdata->istobe = PKG_ISTOBE_NORMAL;
 		return;
 		return;
 	}
 	}
 
 
-	if (pkg->status == stat_unpacked) {
+	if (pkg->status == PKG_STAT_UNPACKED) {
 		debug(dbg_general, "deferred_configure updating conffiles");
 		debug(dbg_general, "deferred_configure updating conffiles");
 		/* This will not do at all the right thing with overridden
 		/* This will not do at all the right thing with overridden
 		 * conffiles or conffiles that are the ‘target’ of an override;
 		 * conffiles or conffiles that are the ‘target’ of an override;
@@ -676,10 +677,10 @@ deferred_configure(struct pkginfo *pkg)
 			deferred_configure_conffile(pkg, conff);
 			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);
 	modstatdb_note(pkg);
 
 
@@ -691,7 +692,7 @@ deferred_configure(struct pkginfo *pkg)
 
 
 	pkg_reset_eflags(pkg);
 	pkg_reset_eflags(pkg);
 	pkg->trigpend_head = NULL;
 	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:
   case PKG_ISTOBE_NORMAL:
     /* Only installed packages can be make dependency problems. */
     /* Only installed packages can be make dependency problems. */
     switch (dep->up->status) {
     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;
       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;
       return true;
     default:
     default:
       internerr("unknown status depending '%d'", dep->up->status);
       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_NORMAL:
         case PKG_ISTOBE_PREINSTALL:
         case PKG_ISTOBE_PREINSTALL:
           switch (pkg_pos->status) {
           switch (pkg_pos->status) {
-          case stat_installed:
-          case stat_triggerspending:
+          case PKG_STAT_INSTALLED:
+          case PKG_STAT_TRIGGERSPENDING:
             if (versionsatisfied(&pkg_pos->installed, possi)) {
             if (versionsatisfied(&pkg_pos->installed, possi)) {
               deppossi_pkg_iter_free(possi_iter);
               deppossi_pkg_iter_free(possi_iter);
               return true;
               return true;
@@ -403,19 +406,19 @@ depisok(struct dependency *dep, struct varbuf *whynot,
                     pkg_name(pkg_pos, pnaw_nonambig),
                     pkg_name(pkg_pos, pnaw_nonambig),
                     versiondescribe(&pkg_pos->installed.version, vdew_nonambig));
                     versiondescribe(&pkg_pos->installed.version, vdew_nonambig));
             break;
             break;
-          case stat_notinstalled:
+          case PKG_STAT_NOTINSTALLED:
             /* Don't say anything about this yet - it might be a virtual package.
             /* 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
              * Later on, if nothing has put anything in linebuf, we know that it
              * isn't and issue a diagnostic then. */
              * isn't and issue a diagnostic then. */
             *linebuf = '\0';
             *linebuf = '\0';
             break;
             break;
-          case stat_triggersawaited:
+          case PKG_STAT_TRIGGERSAWAITED:
               if (canfixbytrigaw && versionsatisfied(&pkg_pos->installed, possi))
               if (canfixbytrigaw && versionsatisfied(&pkg_pos->installed, possi))
                 *canfixbytrigaw = pkg_pos;
                 *canfixbytrigaw = pkg_pos;
               /* Fall through to have a chance to return OK due to
               /* Fall through to have a chance to return OK due to
                * allowunconfigd and to fill the explanation */
                * allowunconfigd and to fill the explanation */
-          case stat_unpacked:
-          case stat_halfconfigured:
+          case PKG_STAT_UNPACKED:
+          case PKG_STAT_HALFCONFIGURED:
             if (allowunconfigd) {
             if (allowunconfigd) {
               if (!dpkg_version_is_informative(&pkg_pos->configversion)) {
               if (!dpkg_version_is_informative(&pkg_pos->configversion)) {
                 sprintf(linebuf, _("  %.250s is unpacked, but has never been "
                 sprintf(linebuf, _("  %.250s is unpacked, but has never been "
@@ -493,10 +496,10 @@ depisok(struct dependency *dep, struct varbuf *whynot,
             break;
             break;
           case PKG_ISTOBE_NORMAL:
           case PKG_ISTOBE_NORMAL:
           case PKG_ISTOBE_PREINSTALL:
           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;
               return true;
-            if (provider->up->up->status == stat_triggersawaited)
+            if (provider->up->up->status == PKG_STAT_TRIGGERSAWAITED)
               *canfixbytrigaw = provider->up->up;
               *canfixbytrigaw = provider->up->up;
             sprintf(linebuf, _("  %.250s provides %.250s but is %s.\n"),
             sprintf(linebuf, _("  %.250s provides %.250s but is %s.\n"),
                     pkg_name(provider->up->up, pnaw_nonambig),
                     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_NORMAL:
         case PKG_ISTOBE_PREINSTALL:
         case PKG_ISTOBE_PREINSTALL:
           switch (pkg_pos->status) {
           switch (pkg_pos->status) {
-          case stat_notinstalled:
-          case stat_configfiles:
+          case PKG_STAT_NOTINSTALLED:
+          case PKG_STAT_CONFIGFILES:
             break;
             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)
             if (dep->type == dep_breaks)
               break; /* No problem. */
               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))
             if (!versionsatisfied(&pkg_pos->installed, possi))
               break;
               break;
             sprintf(linebuf, _("  %.250s (version %.250s) is present and %s.\n"),
             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_NORMAL:
         case PKG_ISTOBE_PREINSTALL:
         case PKG_ISTOBE_PREINSTALL:
           switch (provider->up->up->status) {
           switch (provider->up->up->status) {
-          case stat_notinstalled: case stat_configfiles:
+          case PKG_STAT_NOTINSTALLED:
+          case PKG_STAT_CONFIGFILES:
             continue;
             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)
             if (dep->type == dep_breaks)
               break; /* No problem. */
               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,
             sprintf(linebuf,
                     _("  %.250s provides %.250s and is present and %s.\n"),
                     _("  %.250s provides %.250s and is present and %s.\n"),
                     pkg_name(provider->up->up, pnaw_nonambig), possi->ed->name,
                     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
 static bool
 audit_infofile(struct pkginfo *pkg, const struct audit_problem *problem)
 audit_infofile(struct pkginfo *pkg, const struct audit_problem *problem)
 {
 {
-  if (pkg->status < stat_halfinstalled)
+  if (pkg->status < PKG_STAT_HALFINSTALLED)
     return false;
     return false;
   return !pkg_infodb_has_file(pkg, &pkg->installed, problem->value.string);
   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
 static bool
 audit_arch(struct pkginfo *pkg, const struct audit_problem *problem)
 audit_arch(struct pkginfo *pkg, const struct audit_problem *problem)
 {
 {
-  if (pkg->status < stat_halfinstalled)
+  if (pkg->status < PKG_STAT_HALFINSTALLED)
     return false;
     return false;
   return pkg->installed.arch->type == (enum dpkg_arch_type)problem->value.number;
   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")
     "that depend on them) to function properly:\n")
   }, {
   }, {
     .check = audit_status,
     .check = audit_status,
-    .value.number = stat_unpacked,
+    .value.number = PKG_STAT_UNPACKED,
     .explanation = N_(
     .explanation = N_(
     "The following packages have been unpacked but not yet configured.\n"
     "The following packages have been unpacked but not yet configured.\n"
     "They must be configured using dpkg --configure or the configure\n"
     "They must be configured using dpkg --configure or the configure\n"
     "menu option in dselect for them to work:\n")
     "menu option in dselect for them to work:\n")
   }, {
   }, {
     .check = audit_status,
     .check = audit_status,
-    .value.number = stat_halfconfigured,
+    .value.number = PKG_STAT_HALFCONFIGURED,
     .explanation = N_(
     .explanation = N_(
     "The following packages are only half configured, probably due to problems\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"
     "configuring them the first time.  The configuration should be retried using\n"
     "dpkg --configure <package> or the configure menu option in dselect:\n")
     "dpkg --configure <package> or the configure menu option in dselect:\n")
   }, {
   }, {
     .check = audit_status,
     .check = audit_status,
-    .value.number = stat_halfinstalled,
+    .value.number = PKG_STAT_HALFINSTALLED,
     .explanation = N_(
     .explanation = N_(
     "The following packages are only half installed, due to problems during\n"
     "The following packages are only half installed, due to problems during\n"
     "installation.  The installation can probably be completed by retrying it;\n"
     "installation.  The installation can probably be completed by retrying it;\n"
     "the packages can be removed using dselect or dpkg --remove:\n")
     "the packages can be removed using dselect or dpkg --remove:\n")
   }, {
   }, {
     .check = audit_status,
     .check = audit_status,
-    .value.number = stat_triggersawaited,
+    .value.number = PKG_STAT_TRIGGERSAWAITED,
     .explanation = N_(
     .explanation = N_(
     "The following packages are awaiting processing of triggers that they\n"
     "The following packages are awaiting processing of triggers that they\n"
     "have activated in other packages.  This processing can be requested using\n"
     "have activated in other packages.  This processing can be requested using\n"
     "dselect or dpkg --configure --pending (or dpkg --triggers-only):\n")
     "dselect or dpkg --configure --pending (or dpkg --triggers-only):\n")
   }, {
   }, {
     .check = audit_status,
     .check = audit_status,
-    .value.number = stat_triggerspending,
+    .value.number = PKG_STAT_TRIGGERSPENDING,
     .explanation = N_(
     .explanation = N_(
     "The following packages have been triggered, but the trigger processing\n"
     "The following packages have been triggered, but the trigger processing\n"
     "has not yet been done.  Trigger processing can be requested using\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;
   struct pkginfo *pkg;
 
 
   pkg = dpkg_options_parse_pkgname(cipaction, name);
   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));
     notice(_("package '%s' is not installed"), pkg_name(pkg, pnaw_nonambig));
 
 
   return pkg;
   return pkg;
@@ -249,11 +249,15 @@ yettobeunpacked(struct pkginfo *pkg, const char **thissect)
     return false;
     return false;
 
 
   switch (pkg->status) {
   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;
     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)
     if (thissect)
       *thissect = str_is_set(pkg->section) ? pkg->section :
       *thissect = str_is_set(pkg->section) ? pkg->section :
                                              C_("section", "<unknown>");
                                              C_("section", "<unknown>");
@@ -367,11 +371,13 @@ assert_version_support(const char *const *argv,
 
 
   pkg = pkg_db_find_singleton("dpkg");
   pkg = pkg_db_find_singleton("dpkg");
   switch (pkg->status) {
   switch (pkg->status) {
-  case stat_installed:
-  case stat_triggerspending:
+  case PKG_STAT_INSTALLED:
+  case PKG_STAT_TRIGGERSPENDING:
     return 0;
     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))
     if (dpkg_version_relate(&pkg->configversion, DPKG_RELATION_GE, version))
       return 0;
       return 0;
     printf(_("Version of dpkg with working %s support not yet configured.\n"
     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);
   pkg_files_blank(pkg);
 
 
   /* Packages which aren't installed don't have a files list. */
   /* 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;
     pkg->clientdata->fileslistvalid = true;
     return;
     return;
   }
   }
@@ -235,7 +235,7 @@ ensure_packagefiles_available(struct pkginfo *pkg)
       ohshite(_("unable to open files list file for package `%.250s'"),
       ohshite(_("unable to open files list file for package `%.250s'"),
               pkg_name(pkg, pnaw_nonambig));
               pkg_name(pkg, pnaw_nonambig));
     onerr_abort--;
     onerr_abort--;
-    if (pkg->status != stat_configfiles &&
+    if (pkg->status != PKG_STAT_CONFIGFILES &&
         dpkg_version_is_informative(&pkg->configversion)) {
         dpkg_version_is_informative(&pkg->configversion)) {
       warning(_("files list file for package '%.250s' missing; assuming "
       warning(_("files list file for package '%.250s' missing; assuming "
                 "package has no files currently installed"),
                 "package has no files currently installed"),
@@ -336,7 +336,7 @@ pkg_files_optimize_load(struct pkg_array *array)
 
 
     ensure_package_clientdata(pkg);
     ensure_package_clientdata(pkg);
 
 
-    if (pkg->status == stat_notinstalled ||
+    if (pkg->status == PKG_STAT_NOTINSTALLED ||
         pkg->clientdata->listfile_phys_offs != 0)
         pkg->clientdata->listfile_phys_offs != 0)
       continue;
       continue;
 
 

+ 8 - 8
src/help.c

@@ -41,14 +41,14 @@
 #include "main.h"
 #include "main.h"
 
 
 const char *const statusstrings[]= {
 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 *
 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);
 		set = pkg_db_find_set(pkgname.buf);
 		for (pkg = &set->pkg; pkg; pkg = pkg->arch_next)
 		for (pkg = &set->pkg; pkg; pkg = pkg->arch_next)
-			if (pkg->status != stat_notinstalled)
+			if (pkg->status != PKG_STAT_NOTINSTALLED)
 				break;
 				break;
 		if (!pkg) {
 		if (!pkg) {
 			warning(_("info file %s/%s not associated to any package"),
 			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. */
   /* Check if it's safe to remove the architecture from the db. */
   iter = pkg_db_iter_new();
   iter = pkg_db_iter_new();
   while ((pkg = pkg_db_iter_next_pkg(iter))) {
   while ((pkg = pkg_db_iter_next_pkg(iter))) {
-    if (pkg->status < stat_halfinstalled)
+    if (pkg->status < PKG_STAT_HALFINSTALLED)
       continue;
       continue;
     if (pkg->installed.arch == arch) {
     if (pkg->installed.arch == arch) {
       if (fc_architecture)
       if (fc_architecture)

+ 20 - 19
src/packages.c

@@ -69,8 +69,8 @@ enqueue_pending(void)
   while ((pkg = pkg_db_iter_next_pkg(it)) != NULL) {
   while ((pkg = pkg_db_iter_next_pkg(it)) != NULL) {
     switch (cipaction->arg_int) {
     switch (cipaction->arg_int) {
     case act_configure:
     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))
             pkg->trigpend_head))
         continue;
         continue;
       if (pkg->want != PKG_WANT_INSTALL)
       if (pkg->want != PKG_WANT_INSTALL)
@@ -87,10 +87,10 @@ enqueue_pending(void)
       if (pkg->want != PKG_WANT_PURGE) {
       if (pkg->want != PKG_WANT_PURGE) {
         if (pkg->want != PKG_WANT_DEINSTALL)
         if (pkg->want != PKG_WANT_DEINSTALL)
           continue;
           continue;
-        if (pkg->status == stat_configfiles)
+        if (pkg->status == PKG_STAT_CONFIGFILES)
           continue;
           continue;
       }
       }
-      if (pkg->status == stat_notinstalled)
+      if (pkg->status == PKG_STAT_NOTINSTALLED)
         continue;
         continue;
       break;
       break;
     default:
     default:
@@ -110,7 +110,7 @@ enqueue_specified(const char *const *argv)
     struct pkginfo *pkg;
     struct pkginfo *pkg;
 
 
     pkg = dpkg_options_parse_pkgname(cipaction, thisarg);
     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)) {
         str_match_end(pkg->set->name, DEBEXT)) {
       badusage(_("you must specify packages by their own names, "
       badusage(_("you must specify packages by their own names, "
                  "not by quoting the names of the files they come in"));
                  "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)) {
     if (setjmp(ejbuf)) {
       /* Give up on it from the point of view of other packages, i.e. reset
       /* 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. */
       /* Fall through. */
     case act_install:
     case act_install:
       /* Don't try to configure pkgs that we've just disappeared. */
       /* Don't try to configure pkgs that we've just disappeared. */
-      if (pkg->status == stat_notinstalled)
+      if (pkg->status == PKG_STAT_NOTINSTALLED)
         break;
         break;
       /* Fall through. */
       /* Fall through. */
     case act_configure:
     case act_configure:
@@ -355,11 +355,11 @@ deppossi_ok_found(struct pkginfo *possdependee, struct pkginfo *requiredby,
     return thisf;
     return thisf;
   }
   }
   switch (possdependee->status) {
   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)) {
     if (checkversion && !versionsatisfied(&possdependee->installed,checkversion)) {
       varbuf_printf(oemsgs, _("  Version of %s on system is %s.\n"),
       varbuf_printf(oemsgs, _("  Version of %s on system is %s.\n"),
                     pkg_name(possdependee, pnaw_nonambig),
                     pkg_name(possdependee, pnaw_nonambig),
@@ -372,12 +372,12 @@ deppossi_ok_found(struct pkginfo *possdependee, struct pkginfo *requiredby,
       (*interestingwarnings)++;
       (*interestingwarnings)++;
       return thisf;
       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");
       debug(dbg_depcondetail,"      is installed, ok and found");
       return FOUND_OK;
       return FOUND_OK;
     }
     }
-    if (possdependee->status == stat_triggersawaited) {
+    if (possdependee->status == PKG_STAT_TRIGGERSAWAITED) {
       assert(possdependee->trigaw.head);
       assert(possdependee->trigaw.head);
       if (removing ||
       if (removing ||
           !(f_triggers ||
           !(f_triggers ||
@@ -416,7 +416,7 @@ deppossi_ok_found(struct pkginfo *possdependee, struct pkginfo *requiredby,
       return FOUND_DEFER;
       return FOUND_DEFER;
     } else if (!removing && fc_configureany &&
     } else if (!removing && fc_configureany &&
                !skip_due_to_hold(possdependee) &&
                !skip_due_to_hold(possdependee) &&
-               !(possdependee->status == stat_halfconfigured)) {
+               !(possdependee->status == PKG_STAT_HALFCONFIGURED)) {
       notice(_("also configuring '%s' (required by '%s')"),
       notice(_("also configuring '%s' (required by '%s')"),
              pkg_name(possdependee, pnaw_nonambig),
              pkg_name(possdependee, pnaw_nonambig),
              pkg_name(requiredby, 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),
         pkg_name(breaker, pnaw_always),
         virtbroken ? virtbroken->name : "<none>");
         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 (broken == breaker) return;
   if (!versionsatisfied(&broken->installed, breaks)) return;
   if (!versionsatisfied(&broken->installed, breaks)) return;
   /* The test below can only trigger if dep_breaks start having
   /* 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) {
   if (!*argv) {
     for (i = 0; i < array.n_pkgs; i++) {
     for (i = 0; i < array.n_pkgs; i++) {
       pkg = array.pkgs[i];
       pkg = array.pkgs[i];
-      if (pkg->status == stat_notinstalled)
+      if (pkg->status == PKG_STAT_NOTINSTALLED)
         array.pkgs[i] = NULL;
         array.pkgs[i] = NULL;
     }
     }
 
 
@@ -460,7 +460,7 @@ enqperpackage(const char *const *argv)
 
 
     switch (cipaction->arg_int) {
     switch (cipaction->arg_int) {
     case act_status:
     case act_status:
-      if (pkg->status == stat_notinstalled &&
+      if (pkg->status == PKG_STAT_NOTINSTALLED &&
           pkg->priority == PKG_PRIO_UNKNOWN &&
           pkg->priority == PKG_PRIO_UNKNOWN &&
           str_is_unset(pkg->section) &&
           str_is_unset(pkg->section) &&
           !pkg->files &&
           !pkg->files &&
@@ -484,7 +484,7 @@ enqperpackage(const char *const *argv)
       break;
       break;
     case act_listfiles:
     case act_listfiles:
       switch (pkg->status) {
       switch (pkg->status) {
-      case stat_notinstalled:
+      case PKG_STAT_NOTINSTALLED:
         notice(_("package '%s' is not installed"),
         notice(_("package '%s' is not installed"),
                pkg_name(pkg, pnaw_nonambig));
                pkg_name(pkg, pnaw_nonambig));
         failures++;
         failures++;
@@ -567,7 +567,8 @@ showpackages(const char *const *argv)
   if (!*argv) {
   if (!*argv) {
     for (i = 0; i < array.n_pkgs; i++) {
     for (i = 0; i < array.n_pkgs; i++) {
       pkg = array.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);
       pkg_format_show(fmt, pkg, &pkg->installed);
     }
     }
   } else {
   } else {
@@ -698,7 +699,7 @@ control_path(const char *const *argv)
   modstatdb_open(msdbrw_readonly);
   modstatdb_open(msdbrw_readonly);
 
 
   pkg = dpkg_options_parse_pkgname(cipaction, pkgname);
   pkg = dpkg_options_parse_pkgname(cipaction, pkgname);
-  if (pkg->status == stat_notinstalled)
+  if (pkg->status == PKG_STAT_NOTINSTALLED)
     ohshit(_("package '%s' is not installed"),
     ohshit(_("package '%s' is not installed"),
            pkg_name(pkg, pnaw_nonambig));
            pkg_name(pkg, pnaw_nonambig));
 
 
@@ -725,7 +726,7 @@ control_list(const char *const *argv)
   modstatdb_open(msdbrw_readonly);
   modstatdb_open(msdbrw_readonly);
 
 
   pkg = dpkg_options_parse_pkgname(cipaction, pkgname);
   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));
     ohshit(_("package '%s' is not installed"), pkg_name(pkg, pnaw_nonambig));
 
 
   pkg_infodb_foreach(pkg, &pkg->installed, pkg_infodb_print_filetype);
   pkg_infodb_foreach(pkg, &pkg->installed, pkg_infodb_print_filetype);
@@ -757,7 +758,7 @@ control_show(const char *const *argv)
   modstatdb_open(msdbrw_readonly);
   modstatdb_open(msdbrw_readonly);
 
 
   pkg = dpkg_options_parse_pkgname(cipaction, pkgname);
   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));
     ohshit(_("package '%s' is not installed"), pkg_name(pkg, pnaw_nonambig));
 
 
   if (pkg_infodb_has_file(pkg, &pkg->installed, control_file))
   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;
     depender= possi->up->up;
     debug(dbg_depcon, "checking depending package '%s'",
     debug(dbg_depcon, "checking depending package '%s'",
           pkg_name(depender, pnaw_always));
           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;
       continue;
     if (ignore_depends(depender)) {
     if (ignore_depends(depender)) {
       debug(dbg_depcon, "ignoring depending package '%s'",
       debug(dbg_depcon, "ignoring depending package '%s'",
@@ -103,14 +103,14 @@ void deferred_remove(struct pkginfo *pkg) {
       modstatdb_note(pkg);
       modstatdb_note(pkg);
   }
   }
 
 
-  if (pkg->status == stat_notinstalled) {
+  if (pkg->status == PKG_STAT_NOTINSTALLED) {
     sincenothing = 0;
     sincenothing = 0;
     warning(_("ignoring request to remove %.250s which isn't installed"),
     warning(_("ignoring request to remove %.250s which isn't installed"),
             pkg_name(pkg, pnaw_nonambig));
             pkg_name(pkg, pnaw_nonambig));
     pkg->clientdata->istobe = PKG_ISTOBE_NORMAL;
     pkg->clientdata->istobe = PKG_ISTOBE_NORMAL;
     return;
     return;
   } else if (!f_pending &&
   } else if (!f_pending &&
-             pkg->status == stat_configfiles &&
+             pkg->status == PKG_STAT_CONFIGFILES &&
              cipaction->arg_int != act_purge) {
              cipaction->arg_int != act_purge) {
     sincenothing = 0;
     sincenothing = 0;
     warning(_("ignoring request to remove %.250s, only the config\n"
     warning(_("ignoring request to remove %.250s, only the config\n"
@@ -120,7 +120,7 @@ void deferred_remove(struct pkginfo *pkg) {
     return;
     return;
   }
   }
 
 
-  if (pkg->installed.essential && pkg->status != stat_configfiles)
+  if (pkg->installed.essential && pkg->status != PKG_STAT_CONFIGFILES)
     forcibleerr(fc_removeessential,
     forcibleerr(fc_removeessential,
                 _("this is an essential package; it should not be removed"));
                 _("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"),
     printf(_("Would remove or purge %s (%s) ...\n"),
            pkg_name(pkg, pnaw_nonambig),
            pkg_name(pkg, pnaw_nonambig),
            versiondescribe(&pkg->installed.version, vdew_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;
     pkg->clientdata->istobe = PKG_ISTOBE_NORMAL;
     return;
     return;
   }
   }
@@ -176,18 +176,18 @@ void deferred_remove(struct pkginfo *pkg) {
          versiondescribe(&pkg->installed.version, vdew_nonambig));
          versiondescribe(&pkg->installed.version, vdew_nonambig));
   log_action("remove", pkg, &pkg->installed);
   log_action("remove", pkg, &pkg->installed);
   trig_activate_packageprocessing(pkg);
   trig_activate_packageprocessing(pkg);
-  if (pkg->status >= stat_halfconfigured) {
+  if (pkg->status >= PKG_STAT_HALFCONFIGURED) {
     static enum pkgstatus oldpkgstatus;
     static enum pkgstatus oldpkgstatus;
 
 
     oldpkgstatus= pkg->status;
     oldpkgstatus= pkg->status;
-    pkg_set_status(pkg, stat_halfconfigured);
+    pkg_set_status(pkg, PKG_STAT_HALFCONFIGURED);
     modstatdb_note(pkg);
     modstatdb_note(pkg);
     push_cleanup(cu_prermremove, ~ehflag_normaltidy, NULL, 0, 2,
     push_cleanup(cu_prermremove, ~ehflag_normaltidy, NULL, 0, 2,
                  (void *)pkg, (void *)&oldpkgstatus);
                  (void *)pkg, (void *)&oldpkgstatus);
     maintscript_installed(pkg, PRERMFILE, "pre-removal", "remove", NULL);
     maintscript_installed(pkg, PRERMFILE, "pre-removal", "remove", NULL);
 
 
     /* Will turn into ‘half-installed’ soon ... */
     /* Will turn into ‘half-installed’ soon ... */
-    pkg_set_status(pkg, stat_unpacked);
+    pkg_set_status(pkg, PKG_STAT_UNPACKED);
   }
   }
 
 
   removal_bulk(pkg);
   removal_bulk(pkg);
@@ -255,7 +255,7 @@ removal_bulk_remove_files(struct pkginfo *pkg)
   static struct varbuf fnvb;
   static struct varbuf fnvb;
   struct stat stab;
   struct stat stab;
 
 
-    pkg_set_status(pkg, stat_halfinstalled);
+    pkg_set_status(pkg, PKG_STAT_HALFINSTALLED);
     modstatdb_note(pkg);
     modstatdb_note(pkg);
     push_checkpoint(~ehflag_bombout, ehflag_normaltidy);
     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);
     pkg_infodb_foreach(pkg, &pkg->installed, removal_bulk_remove_file);
     dir_sync_path(pkg_infodb_get_dir());
     dir_sync_path(pkg_infodb_get_dir());
 
 
-    pkg_set_status(pkg, stat_configfiles);
+    pkg_set_status(pkg, PKG_STAT_CONFIGFILES);
     pkg->installed.essential = false;
     pkg->installed.essential = false;
     modstatdb_note(pkg);
     modstatdb_note(pkg);
     push_checkpoint(~ehflag_bombout, ehflag_normaltidy);
     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));
   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);
     removal_bulk_remove_files(pkg);
   }
   }
 
 
@@ -640,11 +641,11 @@ void removal_bulk(struct pkginfo *pkg) {
     if (unlink(filename) && errno != ENOENT)
     if (unlink(filename) && errno != ENOENT)
       ohshite(_("can't remove old postrm script"));
       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);
     pkg_set_want(pkg, PKG_WANT_UNKNOWN);
 
 
     /* This will mess up reverse links, but if we follow them
     /* 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);
     pkgbin_blank(&pkg->installed);
   }
   }
 
 

+ 5 - 5
src/script.c

@@ -3,7 +3,7 @@
  * script.c - maintainer script routines
  * script.c - maintainer script routines
  *
  *
  * Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
  * 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
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * it under the terms of the GNU General Public License as published by
@@ -52,14 +52,14 @@
 void
 void
 post_postinst_tasks(struct pkginfo *pkg, enum pkgstatus new_status)
 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);
 		pkg_set_status(pkg, new_status);
 	else if (pkg->trigaw.head)
 	else if (pkg->trigaw.head)
-		pkg_set_status(pkg, stat_triggersawaited);
+		pkg_set_status(pkg, PKG_STAT_TRIGGERSAWAITED);
 	else if (pkg->trigpend_head)
 	else if (pkg->trigpend_head)
-		pkg_set_status(pkg, stat_triggerspending);
+		pkg_set_status(pkg, PKG_STAT_TRIGGERSPENDING);
 	else
 	else
-		pkg_set_status(pkg, stat_installed);
+		pkg_set_status(pkg, PKG_STAT_INSTALLED);
 	modstatdb_note(pkg);
 	modstatdb_note(pkg);
 
 
 	debug(dbg_triggersdetail, "post_postinst_tasks - trig_incorporate");
 	debug(dbg_triggersdetail, "post_postinst_tasks - trig_incorporate");

+ 2 - 1
src/select.c

@@ -73,7 +73,8 @@ getselections(const char *const *argv)
   if (!*argv) {
   if (!*argv) {
     for (i = 0; i < array.n_pkgs; i++) {
     for (i = 0; i < array.n_pkgs; i++) {
       pkg = array.pkgs[i];
       pkg = array.pkgs[i];
-      if (pkg->status == stat_notinstalled) continue;
+      if (pkg->status == PKG_STAT_NOTINSTALLED)
+        continue;
       getsel1package(pkg);
       getsel1package(pkg);
     }
     }
   } else {
   } 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",
 	debug(dbg_triggers, "check_triggers_cycle pnow=%s giveup=%p",
 	      pkg_name(processing_now, pnaw_always),
 	      pkg_name(processing_now, pnaw_always),
 	      pkg_name(giveup, 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);
 	modstatdb_note(giveup);
 	print_error_perpackage(_("triggers looping, abandoned"),
 	print_error_perpackage(_("triggers looping, abandoned"),
 	                       pkg_name(giveup, pnaw_nonambig));
 	                       pkg_name(giveup, pnaw_nonambig));
@@ -326,8 +326,8 @@ trigproc(struct pkginfo *pkg)
 	pkg->clientdata->trigprocdeferred = NULL;
 	pkg->clientdata->trigprocdeferred = NULL;
 
 
 	if (pkg->trigpend_head) {
 	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);
 		gaveup = check_trigger_cycle(pkg);
 		if (gaveup == pkg)
 		if (gaveup == pkg)
@@ -347,7 +347,7 @@ trigproc(struct pkginfo *pkg)
 
 
 		/* Setting the status to half-configured
 		/* Setting the status to half-configured
 		 * causes modstatdb_note to clear pending triggers. */
 		 * causes modstatdb_note to clear pending triggers. */
-		pkg_set_status(pkg, stat_halfconfigured);
+		pkg_set_status(pkg, PKG_STAT_HALFCONFIGURED);
 		modstatdb_note(pkg);
 		modstatdb_note(pkg);
 
 
 		if (!f_noact) {
 		if (!f_noact) {
@@ -356,7 +356,7 @@ trigproc(struct pkginfo *pkg)
 			                     namesarg.buf + 1, NULL);
 			                     namesarg.buf + 1, NULL);
 		}
 		}
 
 
-		post_postinst_tasks(pkg, stat_installed);
+		post_postinst_tasks(pkg, PKG_STAT_INSTALLED);
 	} else {
 	} else {
 		/* In other branch is done by modstatdb_note(), from inside
 		/* In other branch is done by modstatdb_note(), from inside
 		 * post_postinst_tasks(). */
 		 * post_postinst_tasks(). */
@@ -376,7 +376,7 @@ transitional_interest_callback_ro(const char *trig, struct pkginfo *pkg,
 	debug(dbg_triggersdetail,
 	debug(dbg_triggersdetail,
 	      "trig_transitional_interest_callback trig=%s pend=%s",
 	      "trig_transitional_interest_callback trig=%s pend=%s",
 	      trig, pkgbin_name(pend, pendbin, pnaw_always));
 	      trig, pkgbin_name(pend, pendbin, pnaw_always));
-	if (pend->status >= stat_triggersawaited)
+	if (pend->status >= PKG_STAT_TRIGGERSAWAITED)
 		trig_note_pend(pend, nfstrsave(trig));
 		trig_note_pend(pend, nfstrsave(trig));
 }
 }
 
 
@@ -404,7 +404,7 @@ trig_transitional_activate(enum modstatdb_rw cstatus)
 
 
 	it = pkg_db_iter_new();
 	it = pkg_db_iter_new();
 	while ((pkg = pkg_db_iter_next_pkg(it))) {
 	while ((pkg = pkg_db_iter_next_pkg(it))) {
-		if (pkg->status <= stat_halfinstalled)
+		if (pkg->status <= PKG_STAT_HALFINSTALLED)
 			continue;
 			continue;
 		debug(dbg_triggersdetail, "trig_transitional_activate %s %s",
 		debug(dbg_triggersdetail, "trig_transitional_activate %s %s",
 		      pkg_name(pkg, pnaw_always),
 		      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
 		 * be written down. This should never happen in theory but
 		 * can happen if you restore an old status file that is
 		 * can happen if you restore an old status file that is
 		 * not in sync with the infodb files. */
 		 * not in sync with the infodb files. */
-		if (pkg->status < stat_triggersawaited)
+		if (pkg->status < PKG_STAT_TRIGGERSAWAITED)
 			continue;
 			continue;
 
 
 		if (pkg->trigaw.head)
 		if (pkg->trigaw.head)
-			pkg_set_status(pkg, stat_triggersawaited);
+			pkg_set_status(pkg, PKG_STAT_TRIGGERSAWAITED);
 		else if (pkg->trigpend_head)
 		else if (pkg->trigpend_head)
-			pkg_set_status(pkg, stat_triggerspending);
+			pkg_set_status(pkg, PKG_STAT_TRIGGERSPENDING);
 		else
 		else
-			pkg_set_status(pkg, stat_installed);
+			pkg_set_status(pkg, PKG_STAT_INSTALLED);
 	}
 	}
 	pkg_db_iter_free(it);
 	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);
   pkg_infodb_foreach(pkg, &pkg->installed, pkg_infodb_remove_file);
   dir_sync_path(pkg_infodb_get_dir());
   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_set_want(pkg, PKG_WANT_UNKNOWN);
   pkg_reset_eflags(pkg);
   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) {
   for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
     if (otherpkg == pkg)
     if (otherpkg == pkg)
       continue;
       continue;
-    if (otherpkg->status <= stat_configfiles)
+    if (otherpkg->status <= PKG_STAT_CONFIGFILES)
       continue;
       continue;
     if (dpkg_version_compare(&pkg->available.version,
     if (dpkg_version_compare(&pkg->available.version,
                              &otherpkg->installed.version)) {
                              &otherpkg->installed.version)) {
@@ -528,7 +528,7 @@ void process_archive(const char *filename) {
   for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
   for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
     if (otherpkg == pkg)
     if (otherpkg == pkg)
       continue;
       continue;
-    if (otherpkg->status <= stat_halfconfigured)
+    if (otherpkg->status <= PKG_STAT_HALFCONFIGURED)
       continue;
       continue;
 
 
     if (dpkg_version_compare(&pkg->available.version,
     if (dpkg_version_compare(&pkg->available.version,
@@ -597,7 +597,8 @@ void process_archive(const char *filename) {
 
 
   printf(_("Preparing to unpack %s ...\n"), pfilename);
   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);
     log_action("upgrade", pkg, &pkg->installed);
   } else {
   } else {
     log_action("install", pkg, &pkg->available);
     log_action("install", pkg, &pkg->available);
@@ -701,16 +702,16 @@ void process_archive(const char *filename) {
 
 
   oldversionstatus= pkg->status;
   oldversionstatus= pkg->status;
 
 
-  assert(oldversionstatus <= stat_installed);
+  assert(oldversionstatus <= PKG_STAT_INSTALLED);
   debug(dbg_general,"process_archive oldversionstatus=%s",
   debug(dbg_general,"process_archive oldversionstatus=%s",
         statusstrings[oldversionstatus]);
         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_eflags(pkg, PKG_EFLAG_REINSTREQ);
-    pkg_set_status(pkg, stat_halfconfigured);
+    pkg_set_status(pkg, PKG_STAT_HALFCONFIGURED);
     modstatdb_note(pkg);
     modstatdb_note(pkg);
     push_cleanup(cu_prermupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg);
     push_cleanup(cu_prermupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg);
     if (dpkg_version_compare(&pkg->available.version,
     if (dpkg_version_compare(&pkg->available.version,
@@ -724,8 +725,8 @@ void process_archive(const char *filename) {
                             versiondescribe(&pkg->available.version,
                             versiondescribe(&pkg->available.version,
                                             vdew_nonambig),
                                             vdew_nonambig),
                             NULL);
                             NULL);
-    pkg_set_status(pkg, stat_unpacked);
-    oldversionstatus= stat_unpacked;
+    pkg_set_status(pkg, PKG_STAT_UNPACKED);
+    oldversionstatus = PKG_STAT_UNPACKED;
     modstatdb_note(pkg);
     modstatdb_note(pkg);
   }
   }
 
 
@@ -744,7 +745,7 @@ void process_archive(const char *filename) {
              versiondescribe(&deconpil->pkg->installed.version, vdew_nonambig));
              versiondescribe(&deconpil->pkg->installed.version, vdew_nonambig));
 
 
     trig_activate_packageprocessing(deconpil->pkg);
     trig_activate_packageprocessing(deconpil->pkg);
-    pkg_set_status(deconpil->pkg, stat_halfconfigured);
+    pkg_set_status(deconpil->pkg, PKG_STAT_HALFCONFIGURED);
     modstatdb_note(deconpil->pkg);
     modstatdb_note(deconpil->pkg);
 
 
     /* This means that we *either* go and run postinst abort-deconfigure,
     /* 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) {
        conflictor_iter = conflictor_iter->next) {
     struct pkginfo *conflictor = conflictor_iter->pkg;
     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;
       continue;
 
 
     trig_activate_packageprocessing(conflictor);
     trig_activate_packageprocessing(conflictor);
-    pkg_set_status(conflictor, stat_halfconfigured);
+    pkg_set_status(conflictor, PKG_STAT_HALFCONFIGURED);
     modstatdb_note(conflictor);
     modstatdb_note(conflictor);
     push_cleanup(cu_prerminfavour, ~ehflag_normaltidy, NULL, 0,
     push_cleanup(cu_prerminfavour, ~ehflag_normaltidy, NULL, 0,
                  2, conflictor, pkg);
                  2, conflictor, pkg);
@@ -797,23 +798,23 @@ void process_archive(const char *filename) {
                           versiondescribe(&pkg->available.version,
                           versiondescribe(&pkg->available.version,
                                           vdew_nonambig),
                                           vdew_nonambig),
                           NULL);
                           NULL);
-    pkg_set_status(conflictor, stat_halfinstalled);
+    pkg_set_status(conflictor, PKG_STAT_HALFINSTALLED);
     modstatdb_note(conflictor);
     modstatdb_note(conflictor);
   }
   }
 
 
   pkg_set_eflags(pkg, PKG_EFLAG_REINSTREQ);
   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.version= pkg->available.version;
     pkg->installed.multiarch = pkg->available.multiarch;
     pkg->installed.multiarch = pkg->available.multiarch;
   }
   }
-  pkg_set_status(pkg, stat_halfinstalled);
+  pkg_set_status(pkg, PKG_STAT_HALFINSTALLED);
   modstatdb_note(pkg);
   modstatdb_note(pkg);
-  if (oldversionstatus == stat_notinstalled) {
+  if (oldversionstatus == PKG_STAT_NOTINSTALLED) {
     push_cleanup(cu_preinstverynew, ~ehflag_normaltidy, NULL, 0,
     push_cleanup(cu_preinstverynew, ~ehflag_normaltidy, NULL, 0,
                  3,(void*)pkg,(void*)cidir,(void*)cidirrest);
                  3,(void*)pkg,(void*)cidir,(void*)cidirrest);
     maintscript_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
     maintscript_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
                     "install", NULL);
                     "install", NULL);
-  } else if (oldversionstatus == stat_configfiles) {
+  } else if (oldversionstatus == PKG_STAT_CONFIGFILES) {
     push_cleanup(cu_preinstnew, ~ehflag_normaltidy, NULL, 0,
     push_cleanup(cu_preinstnew, ~ehflag_normaltidy, NULL, 0,
                  3,(void*)pkg,(void*)cidir,(void*)cidirrest);
                  3,(void*)pkg,(void*)cidir,(void*)cidirrest);
     maintscript_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
     maintscript_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
@@ -829,8 +830,8 @@ void process_archive(const char *filename) {
                     NULL);
                     NULL);
   }
   }
 
 
-  if (oldversionstatus == stat_notinstalled ||
-      oldversionstatus == stat_configfiles) {
+  if (oldversionstatus == PKG_STAT_NOTINSTALLED ||
+      oldversionstatus == PKG_STAT_CONFIGFILES) {
     printf(_("Unpacking %s (%s) ...\n"),
     printf(_("Unpacking %s (%s) ...\n"),
            pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
            pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
            versiondescribe(&pkg->available.version, vdew_nonambig));
            versiondescribe(&pkg->available.version, vdew_nonambig));
@@ -951,10 +952,11 @@ void process_archive(const char *filename) {
 
 
   tar_deferred_extract(newfileslist, pkg);
   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
     /* Packages that were in ‘installed’ and ‘postinstfailed’ have been
      * reduced to ‘unpacked’ by now, by the running of the prerm script. */
      * 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);
     modstatdb_note(pkg);
     push_cleanup(cu_postrmupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg);
     push_cleanup(cu_postrmupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg);
     maintscript_fallback(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
     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)
     if (otherpkg->installed.arch != pkg->installed.arch)
       continue;
       continue;
 
 
-    assert(otherpkg->status == stat_notinstalled);
+    assert(otherpkg->status == PKG_STAT_NOTINSTALLED);
 
 
     pkg_blank(otherpkg);
     pkg_blank(otherpkg);
   }
   }
@@ -1255,8 +1257,8 @@ void process_archive(const char *filename) {
   while ((otherpkg = pkg_db_iter_next_pkg(it)) != NULL) {
   while ((otherpkg = pkg_db_iter_next_pkg(it)) != NULL) {
     ensure_package_clientdata(otherpkg);
     ensure_package_clientdata(otherpkg);
     if (otherpkg == pkg ||
     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->istobe == PKG_ISTOBE_REMOVE ||
         !otherpkg->clientdata->files) continue;
         !otherpkg->clientdata->files) continue;
     /* Do not try to disappear other packages from the same set
     /* 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
    * 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
    * backup files, and we can leave the user to fix that if and when
    * it happens (we leave the reinstall required flag, of course). */
    * 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);
   modstatdb_note(pkg);
 
 
   /* Now we delete all the backup files that we made when
   /* 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++)) {
 		while ((thisarg = *argv++)) {
 			pkg = dpkg_options_parse_pkgname(cipaction, thisarg);
 			pkg = dpkg_options_parse_pkgname(cipaction, thisarg);
-			if (pkg->status == stat_notinstalled) {
+			if (pkg->status == PKG_STAT_NOTINSTALLED) {
 				notice(_("package '%s' is not installed"),
 				notice(_("package '%s' is not installed"),
 				       pkg_name(pkg, pnaw_nonambig));
 				       pkg_name(pkg, pnaw_nonambig));
 				rc = 1;
 				rc = 1;