summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-09-03 16:57:50 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-09-03 17:13:10 +0300
commit9f68c7958f173a313d53abb4028164c37b6abf68 (patch)
tree7a0912363ba2ea2191753df5e293a54de6540c1e
parentada4dd18d590dc8eff7eac1a3f0f57c7243da539 (diff)
downloadlibrpm-tizen-9f68c7958f173a313d53abb4028164c37b6abf68.tar.gz
librpm-tizen-9f68c7958f173a313d53abb4028164c37b6abf68.tar.bz2
librpm-tizen-9f68c7958f173a313d53abb4028164c37b6abf68.zip
Rip IAM_RPMDB, ie --initdb, --rebuilddb etc modes out of rpmqv.c and librpm
- Add popt exec aliases to rpmdb for backwards compatibility - Change test-suite to use 'rpmdb --initdb' instead of 'rpm --initdb' as popt exec aliases with absolute paths dont play very well with the test-suite, duh...
-rw-r--r--Makefile.am2
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/poptDB.c26
-rw-r--r--lib/rpmcli.h21
-rw-r--r--po/POTFILES.in1
-rw-r--r--rpmpopt.in4
-rw-r--r--rpmqv.c67
-rw-r--r--tests/local.at2
8 files changed, 9 insertions, 116 deletions
diff --git a/Makefile.am b/Makefile.am
index 60efb362a..4102e6aec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -93,7 +93,7 @@ libcliutils_la_LIBADD = lib/librpm.la rpmio/librpmio.la
libcliutils_la_LIBADD += @WITH_POPT_LIB@
rpm_SOURCES = rpmqv.c debug.h system.h
-rpm_CPPFLAGS = $(AM_CPPFLAGS) -DIAM_RPMDB -DIAM_RPMEIU -DIAM_RPMQV
+rpm_CPPFLAGS = $(AM_CPPFLAGS) -DIAM_RPMEIU -DIAM_RPMQV
rpm_LDADD = libcliutils.la
rpm_LDADD += build/librpmbuild.la lib/librpm.la rpmio/librpmio.la
rpm_LDADD += @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 65536ca5b..c3fd3953c 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -21,7 +21,7 @@ usrlib_LTLIBRARIES = librpm.la
librpm_la_SOURCES = \
backend/dbconfig.c backend/db3.c backend/dbi.h \
headerutil.c header.c headerfmt.c header_internal.h \
- poptDB.c rpmdb.c rpmdb_internal.h \
+ rpmdb.c rpmdb_internal.h \
fprint.c fprint.h tagname.c rpmtd.c \
cpio.c cpio.h depends.c order.c formats.c tagexts.c fsm.c fsm.h \
manifest.c manifest.h misc.c package.c \
diff --git a/lib/poptDB.c b/lib/poptDB.c
deleted file mode 100644
index 3dfc9642e..000000000
--- a/lib/poptDB.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/** \ingroup rpmcli
- * \file lib/poptDB.c
- * Popt tables for database modes.
- */
-
-#include "system.h"
-
-#include <rpm/rpmcli.h>
-
-#include "debug.h"
-
-struct rpmDatabaseArguments_s rpmDBArgs;
-
-/**
- */
-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},
-
- POPT_TABLEEND
-};
diff --git a/lib/rpmcli.h b/lib/rpmcli.h
index 63968cb25..3af4fe266 100644
--- a/lib/rpmcli.h
+++ b/lib/rpmcli.h
@@ -399,27 +399,6 @@ extern struct rpmInstallArguments_s rpmIArgs;
extern struct poptOption rpmInstallPoptTable[];
/* ==================================================================== */
-/** \name RPMDB */
-/* --- database modes */
-
-/** \ingroup rpmcli
- * Describe database command line requests.
- */
-struct rpmDatabaseArguments_s {
- int init; /*!< from --initdb */
- int rebuild; /*!< from --rebuilddb */
- int verify; /*!< from --verifydb */
-};
-
-/** \ingroup rpmcli
- */
-extern struct rpmDatabaseArguments_s rpmDBArgs;
-
-/** \ingroup rpmcli
- */
-extern struct poptOption rpmDatabasePoptTable[];
-
-/* ==================================================================== */
/** \name RPMK */
/** \ingroup rpmcli
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0b54fc816..500334213 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -69,7 +69,6 @@ lib/fprint.c
lib/header.c
lib/headerfmt.c
lib/merge.c
-lib/poptDB.c
lib/rpmdb.c
lib/tagexts.c
lib/tagname.c
diff --git a/rpmpopt.in b/rpmpopt.in
index d3777216a..db553a8fa 100644
--- a/rpmpopt.in
+++ b/rpmpopt.in
@@ -158,12 +158,16 @@ rpm alias --httpport --define '_httpport !#:+'
# [--httpproxy <host>] "hostname or IP of http proxy"
rpm alias --httpproxy --define '_httpproxy !#:+'
+# Minimally preserve commonly used switches from cli split-up
rpm exec --addsign @BINDIR@/rpmsign --addsign
rpm exec --delsign @BINDIR@/rpmsign --delsign
rpm exec --resign @BINDIR@/rpmsign --resign
rpm exec --checksig @BINDIR@/rpmkeys --checksig
rpm exec -K @BINDIR@/rpmkeys --checksig
rpm exec --import @BINDIR@/rpmkeys --import
+rpm exec --initdb @BINDIR@/rpmdb --initdb
+rpm exec --rebuilddb @BINDIR@/rpmdb --rebuilddb
+rpm exec --verifydb @BINDIR@/rpmdb --verifydb
#==============================================================================
rpmbuild alias --dbpath --define '_dbpath !#:+' \
diff --git a/rpmqv.c b/rpmqv.c
index 436665d92..325449db1 100644
--- a/rpmqv.c
+++ b/rpmqv.c
@@ -23,19 +23,13 @@ enum modes {
MODE_ERASE = (1 << 2),
#define MODES_IE (MODE_INSTALL | MODE_ERASE)
- MODE_INITDB = (1 << 10),
- MODE_REBUILDDB = (1 << 12),
- MODE_VERIFYDB = (1 << 13),
-#define MODES_DB (MODE_INITDB | MODE_REBUILDDB | MODE_VERIFYDB)
-
-
MODE_UNKNOWN = 0
};
-#define MODES_FOR_DBPATH (MODES_IE | MODES_QV | MODES_DB)
+#define MODES_FOR_DBPATH (MODES_IE | MODES_QV)
#define MODES_FOR_NODEPS (MODES_IE | MODE_VERIFY)
#define MODES_FOR_TEST (MODES_IE)
-#define MODES_FOR_ROOT (MODES_IE | MODES_QV | MODES_DB)
+#define MODES_FOR_ROOT (MODES_IE | MODES_QV)
static int quiet;
@@ -54,12 +48,6 @@ static struct poptOption optionsTable[] = {
NULL },
#endif /* IAM_RPMQV */
-#ifdef IAM_RPMDB
- { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmDatabasePoptTable, 0,
- N_("Database options:"),
- NULL },
-#endif /* IAM_RPMDB */
-
#ifdef IAM_RPMEIU
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmInstallPoptTable, 0,
N_("Install/Upgrade/Erase options:"),
@@ -90,10 +78,6 @@ int main(int argc, char *argv[])
struct rpmInstallArguments_s * ia = &rpmIArgs;
#endif
-#if defined(IAM_RPMDB)
- struct rpmDatabaseArguments_s * da = &rpmDBArgs;
-#endif
-
poptContext optCon;
int ec = 0;
#ifdef IAM_RPMEIU
@@ -115,38 +99,12 @@ int main(int argc, char *argv[])
case MODE_VERIFY: qva->qva_mode = 'V'; break;
case MODE_INSTALL:
case MODE_ERASE:
- case MODE_INITDB:
- case MODE_REBUILDDB:
- case MODE_VERIFYDB:
case MODE_UNKNOWN:
default:
break;
}
#endif
-#ifdef IAM_RPMDB
- if (bigMode == MODE_UNKNOWN || (bigMode & MODES_DB)) {
- if (da->init) {
- if (bigMode != MODE_UNKNOWN)
- argerror(_("only one major mode may be specified"));
- else
- bigMode = MODE_INITDB;
- } else
- if (da->rebuild) {
- if (bigMode != MODE_UNKNOWN)
- argerror(_("only one major mode may be specified"));
- else
- bigMode = MODE_REBUILDDB;
- } else
- if (da->verify) {
- if (bigMode != MODE_UNKNOWN)
- argerror(_("only one major mode may be specified"));
- else
- bigMode = MODE_VERIFYDB;
- }
- }
-#endif /* IAM_RPMDB */
-
#ifdef IAM_RPMQV
if (bigMode == MODE_UNKNOWN || (bigMode & MODES_QV)) {
switch (qva->qva_mode) {
@@ -292,22 +250,6 @@ int main(int argc, char *argv[])
ts = rpmtsCreate();
(void) rpmtsSetRootDir(ts, rpmcliRootDir);
switch (bigMode) {
-#ifdef IAM_RPMDB
- case MODE_INITDB:
- ec = rpmtsInitDB(ts, 0644);
- break;
-
- case MODE_REBUILDDB:
- { rpmVSFlags vsflags = rpmExpandNumeric("%{_vsflags_rebuilddb}");
- rpmVSFlags ovsflags = rpmtsSetVSFlags(ts, vsflags);
- ec = rpmtsRebuildDB(ts);
- vsflags = rpmtsSetVSFlags(ts, ovsflags);
- } break;
- case MODE_VERIFYDB:
- ec = rpmtsVerifyDB(ts);
- break;
-#endif /* IAM_RPMDB */
-
#ifdef IAM_RPMEIU
case MODE_ERASE:
if (ia->noDeps) ia->installInterfaceFlags |= UNINSTALL_NODEPS;
@@ -382,11 +324,6 @@ int main(int argc, char *argv[])
case MODE_QUERY:
case MODE_VERIFY:
#endif
-#if !defined(IAM_RPMDB)
- case MODE_INITDB:
- case MODE_REBUILDDB:
- case MODE_VERIFYDB:
-#endif
#if !defined(IAM_RPMEIU)
case MODE_INSTALL:
case MODE_ERASE:
diff --git a/tests/local.at b/tests/local.at
index 5808596e4..0881e0cde 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -1,7 +1,7 @@
AT_TESTED([rpm rpmbuild rpmquery])
m4_define([RPMDB_INIT],[[
-run rpm \
+run rpmdb \
--root="${abs_builddir}"/testing \
--initdb
]])