Pārlūkot izejas kodu

libdpkg: Uppercase and namespace pkgeflag enum values

Guillem Jover 12 gadi atpakaļ
vecāks
revīzija
224d0246bb

+ 2 - 2
dselect/pkgdepcon.cc

@@ -186,9 +186,9 @@ packagelist::deselect_one_of(pkginfo *per, pkginfo *ped, dependency *dep)
   perpackagestate *best;
 
   // Try not keep packages needing reinstallation.
-  if (per->eflag & eflag_reinstreq)
+  if (per->eflag & PKG_EFLAG_REINSTREQ)
     best = ed;
-  else if (ped->eflag & eflag_reinstreq)
+  else if (ped->eflag & PKG_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.

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

@@ -161,8 +161,8 @@ enum pkgwant {
 };
 
 enum pkgeflag {
-	eflag_ok		= 0,
-	eflag_reinstreq		= 1,
+	PKG_EFLAG_OK		= 0,
+	PKG_EFLAG_REINSTREQ	= 1,
 };
 
 enum pkgstatus {

+ 1 - 1
lib/dpkg/dump.c

@@ -247,7 +247,7 @@ w_status(struct varbuf *vb,
   if (pkgbin != &pkg->installed)
     return;
   assert(pkg->want <= PKG_WANT_PURGE);
-  assert(pkg->eflag <= eflag_reinstreq);
+  assert(pkg->eflag <= PKG_EFLAG_REINSTREQ);
 
 #define PEND pkg->trigpend_head
 #define AW pkg->trigaw.head

+ 2 - 2
lib/dpkg/parse.c

@@ -278,7 +278,7 @@ pkg_parse_verify(struct parsedb_state *ps,
    * major distributions. */
   if (!(ps->flags & pdb_recordavailable) &&
       pkg->status == stat_notinstalled &&
-      pkg->eflag == eflag_ok &&
+      pkg->eflag == PKG_EFLAG_OK &&
       (pkg->want == PKG_WANT_PURGE ||
        pkg->want == PKG_WANT_DEINSTALL ||
        pkg->want == PKG_WANT_HOLD)) {
@@ -291,7 +291,7 @@ pkg_parse_verify(struct parsedb_state *ps,
    * interfaces when there's other more specific selections. */
   if (ps->type == pdb_file_status &&
       pkg->status == stat_notinstalled &&
-      pkg->eflag == eflag_ok &&
+      pkg->eflag == PKG_EFLAG_OK &&
       pkg->want == PKG_WANT_INSTALL &&
       pkgbin->arch->type == DPKG_ARCH_EMPTY)
     pkg->want = PKG_WANT_UNKNOWN;

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

@@ -60,8 +60,8 @@ const struct namevalue wantinfos[] = {
 };
 
 const struct namevalue eflaginfos[] = {
-	NAMEVALUE_DEF("ok",			eflag_ok),
-	NAMEVALUE_DEF("reinstreq",		eflag_reinstreq),
+	NAMEVALUE_DEF("ok",			PKG_EFLAG_OK),
+	NAMEVALUE_DEF("reinstreq",		PKG_EFLAG_REINSTREQ),
 	{ .name = NULL }
 };
 

+ 3 - 3
lib/dpkg/pkg.c

@@ -71,7 +71,7 @@ pkg_clear_eflags(struct pkginfo *pkg, enum pkgeflag eflag)
 void
 pkg_reset_eflags(struct pkginfo *pkg)
 {
-	pkg->eflag = eflag_ok;
+	pkg->eflag = PKG_EFLAG_OK;
 }
 
 /**
@@ -113,7 +113,7 @@ void
 pkg_blank(struct pkginfo *pkg)
 {
 	pkg->status = stat_notinstalled;
-	pkg->eflag = eflag_ok;
+	pkg->eflag = PKG_EFLAG_OK;
 	pkg->want = PKG_WANT_UNKNOWN;
 	pkg->priority = pri_unknown;
 	pkg->otherpriority = NULL;
@@ -188,7 +188,7 @@ pkg_is_informative(struct pkginfo *pkg, struct pkgbin *pkgbin)
 	/* We ignore Section and Priority, as these tend to hang around. */
 	if (pkgbin == &pkg->installed &&
 	    (pkg->want != PKG_WANT_UNKNOWN ||
-	     pkg->eflag != eflag_ok ||
+	     pkg->eflag != PKG_EFLAG_OK ||
 	     pkg->status != stat_notinstalled ||
 	     dpkg_version_is_informative(&pkg->configversion)))
 		return true;

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

@@ -49,18 +49,18 @@ test_pkginfo_eflags(void)
 	struct pkginfo pkg;
 
 	pkg_blank(&pkg);
-	test_pass(pkg.eflag == eflag_ok);
+	test_pass(pkg.eflag == PKG_EFLAG_OK);
 
-	pkg_set_eflags(&pkg, eflag_reinstreq);
-	test_pass(pkg.eflag == eflag_reinstreq);
+	pkg_set_eflags(&pkg, PKG_EFLAG_REINSTREQ);
+	test_pass(pkg.eflag == PKG_EFLAG_REINSTREQ);
 
-	pkg_clear_eflags(&pkg, eflag_reinstreq);
-	test_pass(pkg.eflag == eflag_ok);
+	pkg_clear_eflags(&pkg, PKG_EFLAG_REINSTREQ);
+	test_pass(pkg.eflag == PKG_EFLAG_OK);
 
 	pkg_set_eflags(&pkg, 0x11);
 	test_pass(pkg.eflag == 0x11);
 	pkg_reset_eflags(&pkg);
-	test_pass(pkg.eflag == eflag_ok);
+	test_pass(pkg.eflag == PKG_EFLAG_OK);
 }
 
 static void

+ 2 - 2
src/archives.c

@@ -1490,7 +1490,7 @@ void check_conflict(struct dependency *dep, struct pkginfo *pkg,
       if (!pdep && skip_due_to_hold(fixbyrm)) {
         pdep= &flagdeppossi;
       }
-      if (!pdep && (fixbyrm->eflag & eflag_reinstreq)) {
+      if (!pdep && (fixbyrm->eflag & PKG_EFLAG_REINSTREQ)) {
         if (fc_removereinstreq) {
           notice(_("package %s requires reinstallation, but will "
                    "remove anyway as you requested"),
@@ -1712,7 +1712,7 @@ wanttoinstall(struct pkginfo *pkg)
     }
   }
 
-  if (pkg->eflag & eflag_reinstreq)
+  if (pkg->eflag & PKG_EFLAG_REINSTREQ)
     return true;
   if (pkg->status < stat_unpacked)
     return true;

+ 7 - 7
src/cleanup.c

@@ -3,7 +3,7 @@
  * cleanup.c - cleanup functions, used when we need to unwind
  *
  * Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
- * Copyright © 2007-2012 Guillem Jover <guillem@debian.org>
+ * Copyright © 2007-2014 Guillem Jover <guillem@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -118,7 +118,7 @@ void cu_prermupgrade(int argc, void **argv) {
   maintscript_postinst(pkg, "abort-upgrade",
                        versiondescribe(&pkg->available.version, vdew_nonambig),
                        NULL);
-  pkg_clear_eflags(pkg, eflag_reinstreq);
+  pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
   post_postinst_tasks(pkg, stat_installed);
   cleanup_pkg_failed--;
 }
@@ -179,7 +179,7 @@ void cu_prerminfavour(int argc, void **argv) {
                        versiondescribe(&infavour->available.version,
                                        vdew_nonambig),
                        NULL);
-  pkg_clear_eflags(conflictor, eflag_reinstreq);
+  pkg_clear_eflags(conflictor, PKG_EFLAG_REINSTREQ);
   post_postinst_tasks(conflictor, stat_installed);
   cleanup_conflictor_failed--;
 }
@@ -193,7 +193,7 @@ void cu_preinstverynew(int argc, void **argv) {
   maintscript_new(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
                   "abort-install", NULL);
   pkg_set_status(pkg, stat_notinstalled);
-  pkg_clear_eflags(pkg, eflag_reinstreq);
+  pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
   pkgbin_blank(&pkg->installed);
   modstatdb_note(pkg);
   cleanup_pkg_failed--;
@@ -210,7 +210,7 @@ void cu_preinstnew(int argc, void **argv) {
                   versiondescribe(&pkg->installed.version, vdew_nonambig),
                   NULL);
   pkg_set_status(pkg, stat_configfiles);
-  pkg_clear_eflags(pkg, eflag_reinstreq);
+  pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
   modstatdb_note(pkg);
   cleanup_pkg_failed--;
 }
@@ -227,7 +227,7 @@ void cu_preinstupgrade(int argc, void **argv) {
                   versiondescribe(&pkg->installed.version, vdew_nonambig),
                   NULL);
   pkg_set_status(pkg, *oldstatusp);
-  pkg_clear_eflags(pkg, eflag_reinstreq);
+  pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
   modstatdb_note(pkg);
   cleanup_pkg_failed--;
 }
@@ -249,7 +249,7 @@ void cu_prermremove(int argc, void **argv) {
 
   if (cleanup_pkg_failed++) return;
   maintscript_postinst(pkg, "abort-remove", NULL);
-  pkg_clear_eflags(pkg, eflag_reinstreq);
+  pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
   post_postinst_tasks(pkg, *oldpkgstatus);
   cleanup_pkg_failed--;
 }

+ 1 - 1
src/configure.c

@@ -635,7 +635,7 @@ deferred_configure(struct pkginfo *pkg)
 	varbuf_destroy(&aemsgs);
 	sincenothing = 0;
 
-	if (pkg->eflag & eflag_reinstreq)
+	if (pkg->eflag & PKG_EFLAG_REINSTREQ)
 		forcibleerr(fc_removereinstreq,
 		            _("package is in a very bad inconsistent state; you should\n"
 		              " reinstall it before attempting configuration"));

+ 2 - 2
src/enquiry.c

@@ -59,13 +59,13 @@ struct audit_problem {
 static bool
 audit_reinstreq(struct pkginfo *pkg, const struct audit_problem *problem)
 {
-  return pkg->eflag & eflag_reinstreq;
+  return pkg->eflag & PKG_EFLAG_REINSTREQ;
 }
 
 static bool
 audit_status(struct pkginfo *pkg, const struct audit_problem *problem)
 {
-  if (pkg->eflag & eflag_reinstreq)
+  if (pkg->eflag & PKG_EFLAG_REINSTREQ)
     return false;
   return (int)pkg->status == problem->value.number;
 }

+ 1 - 1
src/remove.c

@@ -153,7 +153,7 @@ void deferred_remove(struct pkginfo *pkg) {
   varbuf_destroy(&raemsgs);
   sincenothing= 0;
 
-  if (pkg->eflag & eflag_reinstreq)
+  if (pkg->eflag & PKG_EFLAG_REINSTREQ)
     forcibleerr(fc_removereinstreq,
                 _("package is in a very bad inconsistent state; you should\n"
                   " reinstall it before attempting a removal"));

+ 2 - 2
src/unpack.c

@@ -709,7 +709,7 @@ void process_archive(const char *filename) {
       oldversionstatus == stat_triggersawaited ||
       oldversionstatus == stat_triggerspending ||
       oldversionstatus == stat_installed) {
-    pkg_set_eflags(pkg, eflag_reinstreq);
+    pkg_set_eflags(pkg, PKG_EFLAG_REINSTREQ);
     pkg_set_status(pkg, stat_halfconfigured);
     modstatdb_note(pkg);
     push_cleanup(cu_prermupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg);
@@ -801,7 +801,7 @@ void process_archive(const char *filename) {
     modstatdb_note(conflictor);
   }
 
-  pkg_set_eflags(pkg, eflag_reinstreq);
+  pkg_set_eflags(pkg, PKG_EFLAG_REINSTREQ);
   if (pkg->status == stat_notinstalled) {
     pkg->installed.version= pkg->available.version;
     pkg->installed.multiarch = pkg->available.multiarch;