summaryrefslogtreecommitdiff
path: root/rpmdb
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-06-08 20:45:59 +0000
committerjbj <devnull@localhost>2001-06-08 20:45:59 +0000
commit03f527390168680d98f13ada0dbf6be4cd17dc9c (patch)
tree775e83d8fc7532376766381fb94496b3dec6f31d /rpmdb
parent7bf9296288c38f3bf82ec38481738101bf063981 (diff)
downloadrpm-03f527390168680d98f13ada0dbf6be4cd17dc9c.tar.gz
- fix: QUERY_FOR_LIST file count clobbered.
- create top level rpmcli API, factor top level modes into popt tables. - popt: add POPT_BIT_SET/POPT_BIT_CLR to API. - autogen.sh checks for latest libtool-1.4 and automake-1.4-p2. - rpm --verify reports failure(s) if corresponding tag is not in header. - rpm --verify honors %config(missingok), add -v for legacy behavior. CVS patchset: 4852 CVS date: 2001/06/08 20:45:59
Diffstat (limited to 'rpmdb')
-rw-r--r--rpmdb/Makefile.am3
-rw-r--r--rpmdb/db3.c8
-rw-r--r--rpmdb/dbconfig.c87
-rw-r--r--rpmdb/poptDB.c36
-rw-r--r--rpmdb/rpmdb.h5
5 files changed, 91 insertions, 48 deletions
diff --git a/rpmdb/Makefile.am b/rpmdb/Makefile.am
index 288cc6de5..33d904278 100644
--- a/rpmdb/Makefile.am
+++ b/rpmdb/Makefile.am
@@ -27,7 +27,8 @@ LIBS =
DB3LOBJS = $(shell cat $(top_builddir)/$(WITH_DB_SUBDIR)/db3lobjs)
lib_LTLIBRARIES = librpmdb.la
-librpmdb_la_SOURCES = $(DBLIBSRCS) dbconfig.c fprint.c rpmhash.c rpmdb.c
+librpmdb_la_SOURCES = $(DBLIBSRCS) \
+ dbconfig.c fprint.c poptDB.c rpmhash.c rpmdb.c
librpmdb_la_LDFLAGS = @libdb3@
librpmdb_la_LIBADD = $(DBLIBOBJS) $(DB3LOBJS)
librpmdb_la_DEPENDENCIES = $(DBLIBOBJS) .created
diff --git a/rpmdb/db3.c b/rpmdb/db3.c
index 051d4dee1..0090a17e2 100644
--- a/rpmdb/db3.c
+++ b/rpmdb/db3.c
@@ -163,7 +163,7 @@ static int db_init(dbiIndex dbi, const char * dbhome,
if (eflags & DB_JOINENV) eflags &= DB_JOINENV;
if (dbfile)
- rpmMessage(RPMMESS_DEBUG, _("opening db environment %s/%s %s\n"),
+ rpmMessage(RPMMESS_DEBUG, _("opening db environment %s/%s %s\n"),
dbhome, dbfile, prDbiOpenFlags(eflags, 1));
/* XXX Can't do RPC w/o host. */
@@ -834,6 +834,12 @@ static int db3open(/*@keep@*/ rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
dbf = _free(dbf);
}
+ /*
+ * Turn off verify-on-close if opening read-only.
+ */
+ if (oflags & DB_RDONLY)
+ dbi->dbi_verify_on_close = 0;
+
dbi->dbi_dbinfo = NULL;
if (dbi->dbi_use_dbenv)
diff --git a/rpmdb/dbconfig.c b/rpmdb/dbconfig.c
index 49b24d7f7..cd1cdadda 100644
--- a/rpmdb/dbconfig.c
+++ b/rpmdb/dbconfig.c
@@ -36,70 +36,67 @@ struct dbOption {
/*@observer@*/ /*@null@*/ const char * argDescrip; /*!< argument description for autohelp */
};
-#define _POPT_SET_BIT (POPT_ARG_VAL|POPT_ARGFLAG_OR)
-#define _POPT_UNSET_BIT (POPT_ARG_VAL|POPT_ARGFLAG_NAND)
-
/*@-immediatetrans -exportlocal -exportheadervar@*/
/** \ingroup db3
*/
struct dbOption rdbOptions[] = {
/* XXX DB_CXX_NO_EXCEPTIONS */
- { "client", 0,_POPT_SET_BIT, &db3dbi.dbi_ecflags, DB_CLIENT,
+ { "client", 0,POPT_BIT_SET, &db3dbi.dbi_ecflags, DB_CLIENT,
NULL, NULL },
- { "xa_create", 0,_POPT_SET_BIT, &db3dbi.dbi_cflags, DB_XA_CREATE,
+ { "xa_create", 0,POPT_BIT_SET, &db3dbi.dbi_cflags, DB_XA_CREATE,
NULL, NULL },
- { "create", 0,_POPT_SET_BIT, &db3dbi.dbi_oeflags, DB_CREATE,
+ { "create", 0,POPT_BIT_SET, &db3dbi.dbi_oeflags, DB_CREATE,
NULL, NULL },
- { "thread", 0,_POPT_SET_BIT, &db3dbi.dbi_oeflags, DB_THREAD,
+ { "thread", 0,POPT_BIT_SET, &db3dbi.dbi_oeflags, DB_THREAD,
NULL, NULL },
- { "force", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_FORCE,
+ { "force", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_FORCE,
NULL, NULL },
- { "cdb", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_INIT_CDB,
+ { "cdb", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_INIT_CDB,
NULL, NULL },
- { "lock", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_INIT_LOCK,
+ { "lock", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_INIT_LOCK,
NULL, NULL },
- { "log", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_INIT_LOG,
+ { "log", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_INIT_LOG,
NULL, NULL },
- { "mpool", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_INIT_MPOOL,
+ { "mpool", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_INIT_MPOOL,
NULL, NULL },
- { "txn", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_INIT_TXN,
+ { "txn", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_INIT_TXN,
NULL, NULL },
- { "joinenv", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_JOINENV,
+ { "joinenv", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_JOINENV,
NULL, NULL },
- { "recover", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_RECOVER,
+ { "recover", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_RECOVER,
NULL, NULL },
- { "recover_fatal", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_RECOVER_FATAL,
+ { "recover_fatal", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_RECOVER_FATAL,
NULL, NULL },
- { "shared", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_SYSTEM_MEM,
+ { "shared", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_SYSTEM_MEM,
NULL, NULL },
- { "txn_nosync", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_TXN_NOSYNC,
+ { "txn_nosync", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_TXN_NOSYNC,
NULL, NULL },
- { "use_environ_root", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_USE_ENVIRON_ROOT,
+ { "use_environ_root", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_USE_ENVIRON_ROOT,
NULL, NULL },
- { "use_environ", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_USE_ENVIRON,
+ { "use_environ", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_USE_ENVIRON,
NULL, NULL },
- { "lockdown", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_LOCKDOWN,
+ { "lockdown", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_LOCKDOWN,
NULL, NULL },
- { "private", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_PRIVATE,
+ { "private", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_PRIVATE,
NULL, NULL },
- { "txn_sync", 0,_POPT_SET_BIT, &db3dbi.dbi_tflags, DB_TXN_SYNC,
+ { "txn_sync", 0,POPT_BIT_SET, &db3dbi.dbi_tflags, DB_TXN_SYNC,
NULL, NULL },
- { "txn_nowait",0,_POPT_SET_BIT, &db3dbi.dbi_tflags, DB_TXN_NOWAIT,
+ { "txn_nowait",0,POPT_BIT_SET, &db3dbi.dbi_tflags, DB_TXN_NOWAIT,
NULL, NULL },
- { "excl", 0,_POPT_SET_BIT, &db3dbi.dbi_oflags, DB_EXCL,
+ { "excl", 0,POPT_BIT_SET, &db3dbi.dbi_oflags, DB_EXCL,
NULL, NULL },
- { "nommap", 0,_POPT_SET_BIT, &db3dbi.dbi_oflags, DB_NOMMAP,
+ { "nommap", 0,POPT_BIT_SET, &db3dbi.dbi_oflags, DB_NOMMAP,
NULL, NULL },
- { "rdonly", 0,_POPT_SET_BIT, &db3dbi.dbi_oflags, DB_RDONLY,
+ { "rdonly", 0,POPT_BIT_SET, &db3dbi.dbi_oflags, DB_RDONLY,
NULL, NULL },
- { "truncate", 0,_POPT_SET_BIT, &db3dbi.dbi_oflags, DB_TRUNCATE,
+ { "truncate", 0,POPT_BIT_SET, &db3dbi.dbi_oflags, DB_TRUNCATE,
NULL, NULL },
- { "fcntl_locking",0,_POPT_SET_BIT, &db3dbi.dbi_oflags, DB_FCNTL_LOCKING,
+ { "fcntl_locking",0,POPT_BIT_SET, &db3dbi.dbi_oflags, DB_FCNTL_LOCKING,
NULL, NULL },
{ "btree", 0,POPT_ARG_VAL, &db3dbi.dbi_type, DB_BTREE,
@@ -167,13 +164,13 @@ struct dbOption rdbOptions[] = {
{ "tas_spins", 0,POPT_ARG_INT, &db3dbi.dbi_tas_spins, 0,
NULL, NULL },
- { "chkpoint", 0,_POPT_SET_BIT, &db3dbi.dbi_verbose, DB_VERB_CHKPOINT,
+ { "chkpoint", 0,POPT_BIT_SET, &db3dbi.dbi_verbose, DB_VERB_CHKPOINT,
NULL, NULL },
- { "deadlock", 0,_POPT_SET_BIT, &db3dbi.dbi_verbose, DB_VERB_DEADLOCK,
+ { "deadlock", 0,POPT_BIT_SET, &db3dbi.dbi_verbose, DB_VERB_DEADLOCK,
NULL, NULL },
- { "recovery", 0,_POPT_SET_BIT, &db3dbi.dbi_verbose, DB_VERB_RECOVERY,
+ { "recovery", 0,POPT_BIT_SET, &db3dbi.dbi_verbose, DB_VERB_RECOVERY,
NULL, NULL },
- { "waitsfor", 0,_POPT_SET_BIT, &db3dbi.dbi_verbose, DB_VERB_WAITSFOR,
+ { "waitsfor", 0,POPT_BIT_SET, &db3dbi.dbi_verbose, DB_VERB_WAITSFOR,
NULL, NULL },
{ "verbose", 0,POPT_ARG_VAL, &db3dbi.dbi_verbose, -1,
NULL, NULL },
@@ -211,27 +208,27 @@ struct dbOption rdbOptions[] = {
/* XXX bt_compare */
/* XXX bt_dup_compare */
/* XXX bt_prefix */
- { "bt_dup", 0,_POPT_SET_BIT, &db3dbi.dbi_bt_flags, DB_DUP,
+ { "bt_dup", 0,POPT_BIT_SET, &db3dbi.dbi_bt_flags, DB_DUP,
NULL, NULL },
- { "bt_dupsort",0,_POPT_SET_BIT, &db3dbi.dbi_bt_flags, DB_DUPSORT,
+ { "bt_dupsort",0,POPT_BIT_SET, &db3dbi.dbi_bt_flags, DB_DUPSORT,
NULL, NULL },
- { "bt_recnum", 0,_POPT_SET_BIT, &db3dbi.dbi_bt_flags, DB_RECNUM,
+ { "bt_recnum", 0,POPT_BIT_SET, &db3dbi.dbi_bt_flags, DB_RECNUM,
NULL, NULL },
- { "bt_revsplitoff", 0,_POPT_SET_BIT, &db3dbi.dbi_bt_flags, DB_REVSPLITOFF,
+ { "bt_revsplitoff", 0,POPT_BIT_SET, &db3dbi.dbi_bt_flags, DB_REVSPLITOFF,
NULL, NULL },
- { "h_dup", 0,_POPT_SET_BIT, &db3dbi.dbi_h_flags, DB_DUP,
+ { "h_dup", 0,POPT_BIT_SET, &db3dbi.dbi_h_flags, DB_DUP,
NULL, NULL },
- { "h_dupsort", 0,_POPT_SET_BIT, &db3dbi.dbi_h_flags, DB_DUPSORT,
+ { "h_dupsort", 0,POPT_BIT_SET, &db3dbi.dbi_h_flags, DB_DUPSORT,
NULL, NULL },
{ "h_ffactor", 0,POPT_ARG_INT, &db3dbi.dbi_h_ffactor, 0,
NULL, NULL },
{ "h_nelem", 0,POPT_ARG_INT, &db3dbi.dbi_h_nelem, 0,
NULL, NULL },
- { "re_renumber", 0,_POPT_SET_BIT, &db3dbi.dbi_re_flags, DB_RENUMBER,
+ { "re_renumber", 0,POPT_BIT_SET, &db3dbi.dbi_re_flags, DB_RENUMBER,
NULL, NULL },
- { "re_snapshot",0,_POPT_SET_BIT, &db3dbi.dbi_re_flags, DB_SNAPSHOT,
+ { "re_snapshot",0,POPT_BIT_SET, &db3dbi.dbi_re_flags, DB_SNAPSHOT,
NULL, NULL },
{ "re_delim", 0,POPT_ARG_INT, &db3dbi.dbi_re_delim, 0,
NULL, NULL },
@@ -395,8 +392,8 @@ dbiIndex db3New(rpmdb rpmdb, int rpmtag)
/* Toggle the flags for negated tokens, if necessary. */
argInfo = opt->argInfo;
- if (argInfo == _POPT_SET_BIT && *o == '!' && ((tok - o) % 2))
- argInfo = _POPT_UNSET_BIT;
+ if (argInfo == POPT_BIT_SET && *o == '!' && ((tok - o) % 2))
+ argInfo = POPT_BIT_CLR;
/* Save value in template as appropriate. */
switch (argInfo & POPT_ARG_MASK) {
@@ -495,10 +492,8 @@ dbiIndex db3New(rpmdb rpmdb, int rpmtag)
dbi->dbi_tear_down = 1;
}
-#ifdef NOTYET
if ((dbi->dbi_bt_flags | dbi->dbi_h_flags) & DB_DUP)
dbi->dbi_permit_dups = 1;
-#endif
return dbi;
}
@@ -512,7 +507,7 @@ const char *const prDbiOpenFlags(int dbflags, int print_dbenv_flags)
oe = buf;
*oe = '\0';
for (opt = rdbOptions; opt->longName != NULL; opt++) {
- if (opt->argInfo != _POPT_SET_BIT)
+ if (opt->argInfo != POPT_BIT_SET)
continue;
if (print_dbenv_flags) {
if (!(opt->arg == &db3dbi.dbi_oeflags ||
diff --git a/rpmdb/poptDB.c b/rpmdb/poptDB.c
new file mode 100644
index 000000000..0d9ee1fe9
--- /dev/null
+++ b/rpmdb/poptDB.c
@@ -0,0 +1,36 @@
+/** \ingroup rpmcli
+ * \file rpmdb/poptDB.c
+ * Popt tables for database modes.
+ */
+
+#include "system.h"
+
+#include <rpmcli.h>
+#include <rpmurl.h>
+
+#include "debug.h"
+
+struct rpmDatabaseArguments_s rpmDBArgs;
+
+/*@-redecl@*/
+extern int _noDirTokens;
+/*@=redecl@*/
+
+/**
+ */
+struct poptOption rpmDatabasePoptTable[] = {
+ { "initdb", '\0', POPT_ARG_VAL, &rpmDBArgs.init, 1,
+ N_("initialize database"), NULL},
+ { "rebuilddb", '\0', POPT_ARG_VAL, &rpmDBArgs.rebuild, 1,
+ N_("rebuild database inverted lists from installed package headers"),
+ NULL},
+ { "verifydb", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &rpmDBArgs.verify, 1,
+ N_("verify database files"), NULL},
+ { "nodirtokens", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_noDirTokens, 1,
+ N_("generate headers compatible with (legacy) rpm[23] packaging"),
+ NULL},
+ { "dirtokens", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_noDirTokens, 0,
+ N_("generate headers compatible with rpm4 packaging"), NULL},
+
+ POPT_TABLEEND
+};
diff --git a/rpmdb/rpmdb.h b/rpmdb/rpmdb.h
index 998b24baf..c5d2728ed 100644
--- a/rpmdb/rpmdb.h
+++ b/rpmdb/rpmdb.h
@@ -10,7 +10,12 @@
#include "fprint.h"
+/**
+ */
typedef /*@abstract@*/ struct _dbiIndexItem * dbiIndexItem;
+
+/**
+ */
typedef /*@abstract@*/ struct _dbiIndex * dbiIndex;
/* this will break if sizeof(int) != 4 */