From 173b737f40e7da85f79544e3f4ea4ad7b8f7d5c2 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 6 Nov 2023 15:58:54 +0200
Subject: [PATCH] Expose and document rpmdb --verifydb operation
After years of BDB, sometimes folks just want some assurance that their db
is still fine. Properly exposing an operation to do so hopefully makes
less likely to poke at the db directly (with eg sqlite3 command).
---
docs/man/rpmdb.8.md | 4 ++++
tools/rpmdb.c | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/rpmdb.c b/rpmdb.c
index 22b0b3e5d..36efff8af 100644
--- a/rpmdb.c
+++ b/rpmdb.c
@@ -23,8 +23,8 @@ static struct poptOption dbOptsTable[] = {
{ "rebuilddb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_REBUILDDB,
N_("rebuild database inverted lists from installed package headers"),
NULL},
- { "verifydb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR|POPT_ARGFLAG_DOC_HIDDEN),
- &mode, MODE_VERIFYDB, N_("verify database files"), NULL},
+ { "verifydb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR),
+ &mode, MODE_VERIFYDB, N_("verify database"), NULL},
{ "salvagedb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR|POPT_ARGFLAG_DOC_HIDDEN),
&mode, MODE_SALVAGEDB, N_("salvage database"), NULL},
{ "exportdb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_EXPORTDB,
--
2.41.0
--- a/doc/rpmdb.8 2020-05-28 12:04:25.024136615 +0200
+++ b/doc/rpmdb.8 2023-12-13 11:57:30.646202901 +0100
@@ -1,48 +1,70 @@
-.TH "RPMDB" "8" "29 June 2010" "Red Hat, Inc"
+.\" Automatically generated by Pandoc 3.1.3
+.\"
+.\" Define V font for inline verbatim, using C font in formats
+.\" that render this, and otherwise B font.
+.ie "\f[CB]x\f[]"x" \{\
+. ftr V B
+. ftr VI BI
+. ftr VB B
+. ftr VBI BI
+.\}
+.el \{\
+. ftr V CR
+. ftr VI CI
+. ftr VB CB
+. ftr VBI CBI
+.\}
+.TH "RPMDB" "8" "29 June 2010" "" ""
+.hy
.SH NAME
-rpmdb \- RPM Database Tool
+.PP
+rpmdb - RPM Database Tool
.SH SYNOPSIS
-
-\fBrpm\fR {\fB--initdb|--rebuilddb\fR}
-
-.SH "DESCRIPTION"
-The general form of an rpm rebuild database command is
-.PP
-
-\fBrpm\fR {\fB--initdb|--rebuilddb\fR} [\fB-v\fR] [\fB--dbpath \fIDIRECTORY\fB\fR] [\fB--root \fIDIRECTORY\fB\fR]
-
-.PP
-Use \fB--initdb\fR to create a new database if one doesn't already exist
-(existing database is not overwritten), use
-\fB--rebuilddb\fR to rebuild the database indices from
-the installed package headers.
-.PP
-
-.SH "SEE ALSO"
-
-.nf
-\fBpopt\fR(3),
-\fBrpm\fR(8),
-\fBrpmkeys\fR(8),
-\fBrpmsign\fR(8),
-\fBrpm2cpio\fR(8),
-\fBrpmbuild\fR(8),
-\fBrpmspec\fR(8),
-.fi
-
-\fBrpm --help\fR - as rpm supports customizing the options via popt aliases
-it's impossible to guarantee that what's described in the manual matches
-what's available.
-
-
-\fBhttp://www.rpm.org/ <URL:http://www.rpm.org/>
-\fR
-.SH "AUTHORS"
-
+.PP
+\f[B]rpmdb\f[R] {\f[B]--initdb|--rebuilddb\f[R]}
+.PP
+\f[B]rpmdb\f[R] {\f[B]--verifydb\f[R]}
+.PP
+\f[B]rpmdb\f[R] {\f[B]--exportdb|--importdb\f[R]}
+.SH DESCRIPTION
+.PP
+The general form of an rpmdb command is
+.PP
+\f[B]rpm\f[R] {\f[B]--initdb|--rebuilddb\f[R]} [\f[B]-v\f[R]]
+[\f[B]--dbpath \f[R]\f[I]DIRECTORY\f[R]] [\f[B]--root
+\f[R]\f[I]DIRECTORY\f[R]]
+.PP
+Use \f[B]--initdb\f[R] to create a new database if one doesn\[aq]t
+already exist (existing database is not overwritten), use
+\f[B]--rebuilddb\f[R] to rebuild the database indices from the installed
+package headers.
+.PP
+\f[B]--verifydb\f[R] performs a low-level integrity check on the
+database.
+.PP
+\f[B]--exportdb\f[R] exports the database in header-list format,
+suitable for transfporting to another host or database type.
+.PP
+\f[B]--importdb\f[R] imports a database from a header-list format as
+created by \f[B]--exportdb\f[R].
+.SH SEE ALSO
+.PP
+\f[B]popt\f[R](3), \f[B]rpm\f[R](8), \f[B]rpmkeys\f[R](8),
+\f[B]rpmsign\f[R](8), \f[B]rpm2cpio\f[R](8), \f[B]rpmbuild\f[R](8),
+\f[B]rpmspec\f[R](8)
+.PP
+\f[B]rpm --help\f[R] - as rpm supports customizing the options via popt
+aliases it\[aq]s impossible to guarantee that what\[aq]s described in
+the manual matches what\[aq]s available.
+.PP
+\f[B]http://www.rpm.org/ <URL:http://www.rpm.org/>\f[R]
+.SH AUTHORS
+.IP
.nf
-Marc Ewing <marc@redhat.com>
-Jeff Johnson <jbj@redhat.com>
-Erik Troan <ewt@redhat.com>
-Panu Matilainen <pmatilai@redhat.com>
+\f[C]
+Marc Ewing <marc\[at]redhat.com>
+Jeff Johnson <jbj\[at]redhat.com>
+Erik Troan <ewt\[at]redhat.com>
+Panu Matilainen <pmatilai\[at]redhat.com>
+\f[R]
.fi
-