Sfoglia il codice sorgente

dpkg: Add missing list and md5sums database file checks to --audit

This will report about any package missing the list or md5sums files
from the database, so that they can be reinstalled.
Guillem Jover 14 anni fa
parent
commit
f45abe4758
2 ha cambiato i file con 22 aggiunte e 0 eliminazioni
  1. 1 0
      debian/changelog
  2. 21 0
      src/enquiry.c

+ 1 - 0
debian/changelog

@@ -42,6 +42,7 @@ dpkg (1.16.3) UNRELEASED; urgency=low
     package instances.
   * Generate md5sums files automatically at unpack time if missing from the
     binary package. Closes: #155676, #155799
+  * Add missing list and md5sums database file checks to «dpkg --audit».
 
   [ Helge Kreutzmann ]
   * Fix a typo in man/dpkg-buildflags.1.

+ 21 - 0
src/enquiry.c

@@ -47,6 +47,7 @@
 #include <dpkg/options.h>
 
 #include "filesdb.h"
+#include "infodb.h"
 #include "main.h"
 
 struct badstatinfo {
@@ -72,6 +73,14 @@ bsyn_status(struct pkginfo *pkg, const struct badstatinfo *bsi)
   return (int)pkg->status == bsi->value.number;
 }
 
+static bool
+bsyn_infofile(struct pkginfo *pkg, const struct badstatinfo *bsi)
+{
+  if (pkg->status < stat_halfinstalled)
+    return false;
+  return !pkg_infodb_has_file(pkg, &pkg->installed, bsi->value.string);
+}
+
 static bool
 bsyn_arch(struct pkginfo *pkg, const struct badstatinfo *bsi)
 {
@@ -123,6 +132,18 @@ static const struct badstatinfo badstatinfos[]= {
     "The following packages have been triggered, but the trigger processing\n"
     "has not yet been done.  Trigger processing can be requested using\n"
     "dselect or dpkg --configure --pending (or dpkg --triggers-only):\n")
+  }, {
+    .yesno = bsyn_infofile,
+    .value.string = LISTFILE,
+    .explanation = N_(
+    "The following packages are missing the list control file in the\n"
+    "database, they need to be reinstalled:\n")
+  }, {
+    .yesno = bsyn_infofile,
+    .value.string = HASHFILE,
+    .explanation = N_(
+    "The following packages are missing the md5sums control file in the\n"
+    "database, they need to be reinstalled:\n")
   }, {
     .yesno = bsyn_arch,
     .value.number = arch_none,