summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorChantry Xavier <shiningxc@gmail.com>2007-09-17 01:56:23 +0200
committerDan McGee <dan@archlinux.org>2007-09-17 03:10:18 +0200
commit046c8a6819a0533fb10434f30100f80bb960fe46 (patch)
treee73f29a2f4816c3767933fba644362d9f6a9c75f /src/util
parent7daf5a038d3750eacf92b819206cae6b77a73042 (diff)
downloadpacman-046c8a6819a0533fb10434f30100f80bb960fe46.tar.gz
pacman-046c8a6819a0533fb10434f30100f80bb960fe46.tar.xz
Remove the DB consistency check from pacman and libalpm.
This reverts commit dfc85cb5f516ffbcff557522e9703c5c7d88b047 and b6f3fe6957d0206485eac98fb2120578b75d0058. This DB check is already in testdb (among others). Also testdb now uses the db path set at make time by default, so specifying the db path is optional. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/Makefile.am11
-rw-r--r--src/util/testdb.c20
2 files changed, 23 insertions, 8 deletions
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index edc5a95d..97a0ffa1 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -1,5 +1,16 @@
+# paths set at make time
+conffile = ${sysconfdir}/pacman.conf
+dbpath = ${localstatedir}/lib/pacman/
+cachedir = ${localstatedir}/cache/pacman/pkg/
+
bin_PROGRAMS = vercmp testpkg testdb
+DEFS = -DLOCALEDIR=\"@localedir@\" \
+ -DCONFFILE=\"$(conffile)\" \
+ -DROOTDIR=\"$(ROOTDIR)\" \
+ -DDBPATH=\"$(dbpath)\" \
+ -DCACHEDIR=\"$(cachedir)\" \
+ @DEFS@
INCLUDES = -I$(top_srcdir)/lib/libalpm
AM_CFLAGS = -pedantic -D_GNU_SOURCE
diff --git a/src/util/testdb.c b/src/util/testdb.c
index a81a5e8b..d59d0108 100644
--- a/src/util/testdb.c
+++ b/src/util/testdb.c
@@ -135,19 +135,23 @@ int main(int argc, char **argv)
{
int retval = 0; /* default = false */
pmdb_t *db = NULL;
- char dbpath[PATH_MAX];
+ char *dbpath;
+ char localdbpath[PATH_MAX];
alpm_list_t *i;
- if(argc != 2) {
- fprintf(stderr, "usage: %s <pacman db>\n", basename(argv[0]));
+ if(argc == 1) {
+ dbpath = DBPATH;
+ } else if(argc == 3 && strcmp(argv[1], "-b") == 0) {
+ dbpath = argv[2];
+ } else {
+ fprintf(stderr, "usage: %s -b <pacman db>\n", basename(argv[0]));
return(1);
}
- snprintf(dbpath, PATH_MAX, "%s/local", argv[1]);
-
- retval = db_test(dbpath);
+ snprintf(localdbpath, PATH_MAX, "%s/local", dbpath);
+ retval = db_test(localdbpath);
if(retval) {
- exit(retval);
+ return(retval);
}
if(alpm_initialize() == -1) {
@@ -158,7 +162,7 @@ int main(int argc, char **argv)
/* let us get log messages from libalpm */
alpm_option_set_logcb(output_cb);
- alpm_option_set_dbpath(argv[1]);
+ alpm_option_set_dbpath(dbpath);
db = alpm_db_register_local();
if(db == NULL) {