Przeglądaj źródła

Cleanup eflag value names

Remove f and v from value names. Remove duplicated value for reinstreq.
Guillem Jover 17 lat temu
rodzic
commit
08463d3caf
12 zmienionych plików z 32 dodań i 29 usunięć
  1. 5 2
      dselect/pkgdepcon.cc
  2. 2 2
      lib/database.c
  3. 2 3
      lib/dpkg-db.h
  4. 1 1
      lib/dump.c
  5. 1 1
      lib/parse.c
  6. 3 3
      lib/parsehelp.c
  7. 1 1
      src/archives.c
  8. 6 6
      src/cleanup.c
  9. 2 2
      src/configure.c
  10. 3 2
      src/enquiry.c
  11. 4 4
      src/processarc.c
  12. 2 2
      src/remove.c

+ 5 - 2
dselect/pkgdepcon.cc

@@ -175,8 +175,11 @@ int packagelist::deselect_one_of(pkginfo *per, pkginfo *ped, dependency *display
   
   perpackagestate *best;
 
-  if (per->eflag & pkginfo::eflagf_reinstreq) best= ed;      // Try not keep packages
-  else if (ped->eflag & pkginfo::eflagf_reinstreq) best= er; //  needing reinstallation
+  // Try not keep packages needing reinstallation.
+  if (per->eflag & pkginfo::eflag_reinstreq)
+    best = ed;
+  else if (ped->eflag & pkginfo::eflag_reinstreq)
+    best = er;
   else if (er->spriority < ed->spriority) best= er; // We'd rather change the
   else if (er->spriority > ed->spriority) best= ed; // one with the lowest priority.
   else if (er->pkg->priority >

+ 2 - 2
lib/database.c

@@ -65,7 +65,7 @@ void blankversion(struct versionrevision *version) {
 void blankpackage(struct pkginfo *pigp) {
   pigp->name= NULL;
   pigp->status= stat_notinstalled;
-  pigp->eflag= eflagv_ok;
+  pigp->eflag = eflag_ok;
   pigp->want= want_unknown;
   pigp->priority= pri_unknown;
   pigp->otherpriority = NULL;
@@ -104,7 +104,7 @@ int informative(struct pkginfo *pkg, struct pkginfoperfile *info) {
    */
   if (info == &pkg->installed &&
       (pkg->want != want_unknown ||
-       pkg->eflag != eflagv_ok ||
+       pkg->eflag != eflag_ok ||
        pkg->status != stat_notinstalled ||
        informativeversion(&pkg->configversion)))
     /* We ignore Section and Priority, as these tend to hang around. */

+ 2 - 3
lib/dpkg-db.h

@@ -146,9 +146,8 @@ struct pkginfo { /* pig */
                      in some places */
   } want;
   enum pkgeflag {
-    eflagf_reinstreq    = 01,
-    eflagv_ok           = 0,
-    eflagv_reinstreq    =    eflagf_reinstreq,
+    eflag_ok		= 0,
+    eflag_reinstreq	= 1,
   } eflag; /* Bitmask. */
   enum pkgstatus {
     stat_notinstalled,

+ 1 - 1
lib/dump.c

@@ -168,7 +168,7 @@ void w_status(struct varbuf *vb,
               enum fwriteflags flags, const struct fieldinfo *fip) {
   if (pifp != &pigp->installed) return;
   assert(pigp->want <= want_purge);
-  assert(pigp->eflag <= eflagv_reinstreq);
+  assert(pigp->eflag <= eflag_reinstreq);
 
 #define PEND pigp->trigpend_head
 #define AW pigp->trigaw.head

+ 1 - 1
lib/parse.c

@@ -319,7 +319,7 @@ int parsedb(const char *filename, enum parsedbflags flags,
      * major distributions. */
     if (!(flags & pdb_recordavailable) &&
         newpig.status == stat_notinstalled &&
-        newpig.eflag == eflagv_ok &&
+        newpig.eflag == eflag_ok &&
         (newpig.want == want_purge ||
          newpig.want == want_deinstall ||
          newpig.want == want_hold)) {

+ 3 - 3
lib/parsehelp.c

@@ -117,9 +117,9 @@ const struct namevalue statusinfos[]= {  /* Note !  These must be in order ! */
 };
 
 const struct namevalue eflaginfos[]= {  /* Note !  These must be in order ! */
-  { "ok",                      eflagv_ok,                2 },
-  { "reinstreq",               eflagv_reinstreq,         9 },
-  {  NULL                                                   }
+  { "ok",        eflag_ok,        2 },
+  { "reinstreq", eflag_reinstreq, 9 },
+  {  NULL                           }
 };
 
 const struct namevalue wantinfos[]= {  /* Note !  These must be in order ! */

+ 1 - 1
src/archives.c

@@ -1041,7 +1041,7 @@ void check_conflict(struct dependency *dep, struct pkginfo *pkg,
       if (!pdep && skip_due_to_hold(fixbyrm)) {
         pdep= &flagdeppossi;
       }
-      if (!pdep && (fixbyrm->eflag & eflagf_reinstreq)) {
+      if (!pdep && (fixbyrm->eflag & eflag_reinstreq)) {
         if (fc_removereinstreq) {
           fprintf(stderr, _("dpkg: package %s requires reinstallation, but will"
                   " remove anyway as you requested.\n"), fixbyrm->name);

+ 6 - 6
src/cleanup.c

@@ -113,7 +113,7 @@ void cu_prermupgrade(int argc, void **argv) {
                              versiondescribe(&pkg->available.version,
                                              vdew_nonambig),
                              NULL);
-  pkg->eflag &= ~eflagf_reinstreq;
+  pkg->eflag &= ~eflag_reinstreq;
   post_postinst_tasks(pkg, stat_installed);
   cleanup_pkg_failed--;
 }
@@ -162,7 +162,7 @@ void cu_prerminfavour(int argc, void **argv) {
                              versiondescribe(&infavour->available.version,
                                              vdew_nonambig),
                              NULL);
-  conflictor->eflag &= ~eflagf_reinstreq;
+  conflictor->eflag &= ~eflag_reinstreq;
   post_postinst_tasks(conflictor, stat_installed);
   cleanup_conflictor_failed--;
 }
@@ -176,7 +176,7 @@ void cu_preinstverynew(int argc, void **argv) {
   maintainer_script_new(pkg->name, POSTRMFILE,"post-removal",cidir,cidirrest,
                         "abort-install", NULL);
   pkg->status= stat_notinstalled;
-  pkg->eflag &= ~eflagf_reinstreq;
+  pkg->eflag &= ~eflag_reinstreq;
   blankpackageperfile(&pkg->installed);
   modstatdb_note(pkg);
   cleanup_pkg_failed--;
@@ -193,7 +193,7 @@ void cu_preinstnew(int argc, void **argv) {
                                                          vdew_nonambig),
                         NULL);
   pkg->status= stat_configfiles;
-  pkg->eflag &= ~eflagf_reinstreq;
+  pkg->eflag &= ~eflag_reinstreq;
   modstatdb_note(pkg);
   cleanup_pkg_failed--;
 }
@@ -211,7 +211,7 @@ void cu_preinstupgrade(int argc, void **argv) {
                                         vdew_nonambig),
                         NULL);
   pkg->status= *oldstatusp;
-  pkg->eflag &= ~eflagf_reinstreq;
+  pkg->eflag &= ~eflag_reinstreq;
   modstatdb_note(pkg);
   cleanup_pkg_failed--;
 }
@@ -233,7 +233,7 @@ void cu_prermremove(int argc, void **argv) {
 
   if (cleanup_pkg_failed++) return;
   maintainer_script_postinst(pkg, "abort-remove", NULL);
-  pkg->eflag &= ~eflagf_reinstreq;
+  pkg->eflag &= ~eflag_reinstreq;
   post_postinst_tasks(pkg, *oldpkgstatus);
   cleanup_pkg_failed--;
 }

+ 2 - 2
src/configure.c

@@ -142,7 +142,7 @@ void deferred_configure(struct pkginfo *pkg) {
 	varbuffree(&aemsgs);
 	sincenothing= 0;
 
-	if (pkg->eflag & eflagf_reinstreq)
+	if (pkg->eflag & eflag_reinstreq)
 		forcibleerr(fc_removereinstreq,
 				_("Package is in a very bad inconsistent state - you should\n"
 					" reinstall it before attempting configuration."));
@@ -324,7 +324,7 @@ void deferred_configure(struct pkginfo *pkg) {
 	                                           vdew_nonambig) : "",
 	                           NULL);
 
-	pkg->eflag= eflagv_ok;
+	pkg->eflag = eflag_ok;
 	post_postinst_tasks(pkg, stat_installed);
 }
 

+ 3 - 2
src/enquiry.c

@@ -52,11 +52,12 @@ struct badstatinfo {
 };
 
 static int bsyn_reinstreq(struct pkginfo *pkg, const struct badstatinfo *bsi) {
-  return pkg->eflag &= eflagf_reinstreq;
+  return pkg->eflag &= eflag_reinstreq;
 }
 
 static int bsyn_status(struct pkginfo *pkg, const struct badstatinfo *bsi) {
-  if (pkg->eflag &= eflagf_reinstreq) return 0;
+  if (pkg->eflag &= eflag_reinstreq)
+    return 0;
   return (int)pkg->status == bsi->val;
 }
 

+ 4 - 4
src/processarc.c

@@ -404,7 +404,7 @@ void process_archive(const char *filename) {
       oldversionstatus == stat_triggersawaited ||
       oldversionstatus == stat_triggerspending ||
       oldversionstatus == stat_installed) {
-    pkg->eflag |= eflagf_reinstreq;
+    pkg->eflag |= eflag_reinstreq;
     pkg->status= stat_halfconfigured;
     modstatdb_note(pkg);
     push_cleanup(cu_prermupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg);
@@ -473,7 +473,7 @@ void process_archive(const char *filename) {
     modstatdb_note(conflictor[i]);
   }
 
-  pkg->eflag |= eflagf_reinstreq;
+  pkg->eflag |= eflag_reinstreq;
   if (pkg->status == stat_notinstalled)
     pkg->installed.version= pkg->available.version;
   pkg->status= stat_halfinstalled;
@@ -1066,7 +1066,7 @@ void process_archive(const char *filename) {
     
     otherpkg->status= stat_notinstalled;
     otherpkg->want = want_unknown;
-    otherpkg->eflag= eflagv_ok;
+    otherpkg->eflag = eflag_ok;
 
     blankversion(&otherpkg->configversion);
     blankpackageperfile(&otherpkg->installed);
@@ -1161,7 +1161,7 @@ void process_archive(const char *filename) {
   /* OK, we're now fully done with the main package.
    * This is quite a nice state, so we don't unwind past here.
    */
-  pkg->eflag= eflagv_ok;
+  pkg->eflag = eflag_ok;
   modstatdb_note(pkg);
   push_checkpoint(~ehflag_bombout, ehflag_normaltidy);
 

+ 2 - 2
src/remove.c

@@ -133,7 +133,7 @@ void deferred_remove(struct pkginfo *pkg) {
   varbuffree(&raemsgs);
   sincenothing= 0;
 
-  if (pkg->eflag & eflagf_reinstreq)
+  if (pkg->eflag & eflag_reinstreq)
     forcibleerr(fc_removereinstreq,
                 _("Package is in a very bad inconsistent state - you should\n"
                 " reinstall it before attempting a removal."));
@@ -589,7 +589,7 @@ void removal_bulk(struct pkginfo *pkg) {
     blankpackageperfile(&pkg->installed);
   }
       
-  pkg->eflag= eflagv_ok;
+  pkg->eflag = eflag_ok;
   modstatdb_note(pkg);
 
   debug(dbg_general, "removal done");