summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdb3/configure11
-rw-r--r--python/_rpmdb.c25
-rw-r--r--rpmdb/db3.c19
3 files changed, 45 insertions, 10 deletions
diff --git a/db3/configure b/db3/configure
index a252b2aac..3cd0d9a65 100755
--- a/db3/configure
+++ b/db3/configure
@@ -4,10 +4,6 @@ db_dist="../db/dist"
rm -f config.cache
-# XXX hacks to get db-3.3.4 to configure properly
-#ln -sf ../dist $db_dist/../db/dist
-#ln -sf ../dist $db_dist
-
# XXX edit CFLAGS= ... out of invocation args ???
ARGS="`echo $* | sed -e 's% [^ ]*CFLAGS=[^ ]*%%' -e 's% -[^-][^ ]*%%g' -e 's%--cache-file=.*$%%'`"
@@ -15,18 +11,15 @@ CC="$CC" CFLAGS="$CFLAGS" $db_dist/configure $ARGS \
--enable-shared --enable-static --enable-rpc \
--with-uniquename=_rpmdb --srcdir=$db_dist
-# XXX hack to get db-3.3.4 to configure properly
-#rm -f $db_dist/../db/dist $db_dist/dist
-
mv Makefile Makefile.orig
-cat Makefile.orig | sed -e 's/ -g$/ -g -O2/' -e '/^install:/c\
+cat Makefile.orig | sed -e '/^install[:-]/c\
.PHONY: listobjs\
listobjs:\
@echo $(OBJS) $(C_OBJS) \
\
distdir install check:\
\
-db3_install: all install_setip' > Makefile
+db4_install: all install_setip' > Makefile
mv db.h db.h.orig
cat db.h.orig | sed \
diff --git a/python/_rpmdb.c b/python/_rpmdb.c
index cd3d19402..9f2d63833 100644
--- a/python/_rpmdb.c
+++ b/python/_rpmdb.c
@@ -92,7 +92,7 @@
#define PY_BSDDB_VERSION "3.3.1"
-static char *rcs_id = "$Id: _rpmdb.c,v 1.4 2002/06/07 13:12:34 jbj Exp $";
+static char *rcs_id = "$Id: _rpmdb.c,v 1.5 2002/08/14 21:35:35 jbj Exp $";
#ifdef WITH_THREAD
@@ -410,6 +410,7 @@ static int makeDBError(int err)
switch (err) {
case 0: /* successful, no error */ break;
+#if (DBVER < 41)
case DB_INCOMPLETE:
#if INCOMPLETE_IS_WARNING
strcpy(errTxt, db_strerror(err));
@@ -429,6 +430,7 @@ static int makeDBError(int err)
errObj = DBIncompleteError;
#endif
break;
+#endif
case DB_KEYEMPTY: errObj = DBKeyEmptyError; break;
case DB_KEYEXIST: errObj = DBKeyExistError; break;
@@ -1025,10 +1027,17 @@ DB_associate(DBObject* self, PyObject* args, PyObject* kwargs)
MYDB_BEGIN_ALLOW_THREADS;
+#if (DBVER >= 41)
+ err = self->db->associate(self->db, NULL,
+ secondaryDB->db,
+ _db_associateCallback,
+ flags);
+#else
err = self->db->associate(self->db,
secondaryDB->db,
_db_associateCallback,
flags);
+#endif
MYDB_END_ALLOW_THREADS;
if (err) {
@@ -1498,7 +1507,11 @@ DB_open(DBObject* self, PyObject* args, PyObject* kwargs)
}
MYDB_BEGIN_ALLOW_THREADS;
+#if (DBVER >= 41)
+ err = self->db->open(self->db, NULL, filename, dbname, type, flags, mode);
+#else
err = self->db->open(self->db, filename, dbname, type, flags, mode);
+#endif
MYDB_END_ALLOW_THREADS;
if (makeDBError(err)) {
self->db = NULL;
@@ -1851,7 +1864,9 @@ DB_stat(DBObject* self, PyObject* args)
MAKE_HASH_ENTRY(nkeys);
MAKE_HASH_ENTRY(ndata);
MAKE_HASH_ENTRY(pagesize);
+#if (DBVER < 41)
MAKE_HASH_ENTRY(nelem);
+#endif
MAKE_HASH_ENTRY(ffactor);
MAKE_HASH_ENTRY(buckets);
MAKE_HASH_ENTRY(free);
@@ -3337,7 +3352,9 @@ DBEnv_lock_stat(DBEnvObject* self, PyObject* args)
#define MAKE_ENTRY(name) _addIntToDict(d, #name, sp->st_##name)
+#if (DBVER < 41)
MAKE_ENTRY(lastid);
+#endif
MAKE_ENTRY(nmodes);
#if (DBVER >= 32)
MAKE_ENTRY(maxlocks);
@@ -4116,7 +4133,9 @@ DL_EXPORT(void) init_rpmdb(void)
ADD_INT(d, DB_APPEND);
ADD_INT(d, DB_BEFORE);
ADD_INT(d, DB_CACHED_COUNTS);
+#if (DBVER < 41)
ADD_INT(d, DB_CHECKPOINT);
+#endif
#if (DBVER >= 33)
ADD_INT(d, DB_COMMIT);
#endif
@@ -4124,7 +4143,9 @@ DL_EXPORT(void) init_rpmdb(void)
#if (DBVER >= 32)
ADD_INT(d, DB_CONSUME_WAIT);
#endif
+#if (DBVER < 41)
ADD_INT(d, DB_CURLSN);
+#endif
ADD_INT(d, DB_CURRENT);
#if (DBVER >= 33)
ADD_INT(d, DB_FAST_STAT);
@@ -4164,7 +4185,9 @@ DL_EXPORT(void) init_rpmdb(void)
ADD_INT(d, DB_DONOTINDEX);
#endif
+#if (DBVER < 41)
ADD_INT(d, DB_INCOMPLETE);
+#endif
ADD_INT(d, DB_KEYEMPTY);
ADD_INT(d, DB_KEYEXIST);
ADD_INT(d, DB_LOCK_DEADLOCK);
diff --git a/rpmdb/db3.c b/rpmdb/db3.c
index 6414a9482..c2167d0fb 100644
--- a/rpmdb/db3.c
+++ b/rpmdb/db3.c
@@ -366,7 +366,11 @@ static int db3sync(dbiIndex dbi, unsigned int flags)
if (db != NULL)
rc = db->sync(db, flags);
/* XXX DB_INCOMPLETE is returned occaisionally with multiple access. */
+#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 1)
+ _printit = _debug;
+#else
_printit = (rc == DB_INCOMPLETE ? 0 : _debug);
+#endif
rc = cvtdberr(dbi, "db->sync", rc, _printit);
return rc;
}
@@ -599,10 +603,17 @@ static int db3associate(dbiIndex dbi, dbiIndex dbisecondary,
{
DB * db = dbi->dbi_db;
DB * secondary = dbisecondary->dbi_db;
+#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 1)
+ DB_TXN * txnid = NULL;
+#endif
int rc;
/*@-moduncon@*/ /* FIX: annotate db3 methods */
+#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 1)
+ rc = db->associate(db, txnid, secondary, callback, flags);
+#else
rc = db->associate(db, secondary, callback, flags);
+#endif
/*@=moduncon@*/
rc = cvtdberr(dbi, "db->associate", rc, _debug);
return rc;
@@ -789,6 +800,9 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
DB * db = NULL;
DB_ENV * dbenv = NULL;
+#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 1)
+ DB_TXN * txnid = NULL;
+#endif
u_int32_t oflags;
int _printit;
@@ -1124,8 +1138,13 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
? dbfullpath : dbfile;
#endif
+#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 1)
+ rc = db->open(db, txnid, dbpath, dbsubfile,
+ dbi->dbi_type, oflags, dbi->dbi_perms);
+#else
rc = db->open(db, dbpath, dbsubfile,
dbi->dbi_type, oflags, dbi->dbi_perms);
+#endif
if (rc == 0 && dbi->dbi_type == DB_UNKNOWN) {
#if (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR == 3 && DB_VERSION_PATCH == 11) \