Hi,

Attached is the beginning of a patch to get htdig to compile against
libdb4.3. It should be possible to port the version of the beta upstream
htdig (3.2.0b6) to the one in unstable (3.1.6). Since both libdb and
htlib changed their API, a bit of adaptation is necessary.

I did not yet try the resulting package, so please do not apply the
patch blindly.

Adriaan
diff -ur htdig/debian/htdig-3.1.6/debian/control htdig-3.1.6/debian/control
--- htdig/debian/htdig-3.1.6/debian/control	2006-07-20 22:16:49.000000000 +0200
+++ htdig-3.1.6/debian/control	2006-07-19 11:41:57.000000000 +0200
@@ -2,7 +2,7 @@
 Section: web
 Priority: optional
 Maintainer: Robert Ribnitz <[EMAIL PROTECTED]> 
-Build-Depends: debhelper (>= 4.1.16), libdb2-dev, zlib1g-dev (>= 1:1.2.1)
+Build-Depends: debhelper (>= 4.1.16), libdb4.3-dev, zlib1g-dev (>= 1:1.2.1)
 Standards-Version: 3.6.1
 
 Package: htdig
diff -ur htdig/debian/htdig-3.1.6/htlib/DB2_db.cc htdig-3.1.6/htlib/DB2_db.cc
--- htdig/debian/htdig-3.1.6/htlib/DB2_db.cc	2002-02-01 00:47:17.000000000 +0100
+++ htdig-3.1.6/htlib/DB2_db.cc	2006-07-19 14:39:04.000000000 +0200
@@ -107,18 +107,21 @@
     //
     // Initialize the database environment.
     //
-    dbenv = db_init((char *)NULL);
-    memset(&dbinfo, 0, sizeof(dbinfo));
-//    dbinfo.db_cachesize = CACHE_SIZE_IN_KB * 1024;	// Cachesize: 64K.
-    dbinfo.db_pagesize = 1024;      			// Page size: 1K.
-
+    db_env_create(&dbenv, 0);
+//    dbenv = db_init((char *)NULL);
+//    if((dbenv = db_init((char *)NULL)) == 0) return NOTOK;
+    
+//    if(CDB_db_create((&dbp, dbenv, 0) != 0) return NOTOK;
+    
     //
     // Create the database.
     //
     if (access(filename, F_OK) == 0)
-      errno = db_open(filename, DB_BTREE, 0, 0, dbenv, &dbinfo, &dbp);
+      //errno = db_open(filename, DB_BTREE, 0, 0, dbenv, &dbinfo, &dbp);
+      errno = dbp->open(dbp, NULL, filename, NULL, DB_BTREE, 0, mode);
     else
-      errno = db_open(filename, DB_BTREE, DB_CREATE, mode, dbenv, &dbinfo, &dbp);
+      //errno = db_open(filename, DB_BTREE, DB_CREATE, mode, dbenv, &dbinfo, &dbp);
+      errno = dbp->open(dbp, NULL, filename, NULL, DB_BTREE, DB_CREATE, mode);
     if (errno == 0)
     {
         //
@@ -150,16 +153,18 @@
     //
     // Initialize the database environment.
     //
-    dbenv = db_init((char *)NULL);
-    memset(&dbinfo, 0, sizeof(dbinfo));
+    db_env_create(&dbenv, 0);
+//    dbenv = db_init((char *)NULL);
+//    memset(&dbinfo, 0, sizeof(dbinfo));
 //    dbinfo.db_cachesize = CACHE_SIZE_IN_KB * 1024;	// Cachesize: 64K.
-    dbinfo.db_pagesize = 1024;				// Page size: 1K.
+//    dbinfo.db_pagesize = 1024;				// Page size: 1K.
 
     //
     // Open the database.
     //
-    if ((errno = db_open(filename, DB_BTREE, DB_RDONLY, 0, dbenv,
-			 &dbinfo, &dbp)) == 0)
+//    if ((errno = db_open(filename, DB_BTREE, DB_RDONLY, 0, dbenv,
+//			 &dbinfo, &dbp)) == 0)
+    if ((errno = dbp->open(dbp, NULL, filename, NULL, DB_BTREE, DB_RDONLY, 0)) == 0)
     {
         //
 	// Acquire a cursor for the database.
@@ -194,7 +199,7 @@
 	//
         (void)(dbcp->c_close)(dbcp);
 	(void)(dbp->close)(dbp, 0);
-	(void) db_appexit(dbenv);
+	//(void) db_appexit(dbenv);
     }
     isOpen = 0;
     return OK;
@@ -438,13 +443,13 @@
     }
     // dbenv->db_errfile = stderr;
     dbenv->db_errpfx = progname;
-    dbenv->db_errcall = &Error;
+    //dbenv->db_errcall = &Error;
 
-    if ((errno = db_appinit(home, NULL, dbenv, DB_CREATE)) != 0)
-    {
-	fprintf(stderr, "%s: db_appinit: %s\n", progname, strerror(errno));
-	exit (1);
-    }
+//    if ((errno = db_appinit(home, NULL, dbenv, DB_CREATE)) != 0)
+//    {
+//	fprintf(stderr, "%s: db_appinit: %s\n", progname, strerror(errno));
+//	exit (1);
+//    }
     return (dbenv);
 }
 
diff -ur htdig/debian/htdig-3.1.6/htlib/DB2_db.h htdig-3.1.6/htlib/DB2_db.h
--- htdig/debian/htdig-3.1.6/htlib/DB2_db.h	2006-07-20 22:16:49.000000000 +0200
+++ htdig-3.1.6/htlib/DB2_db.h	2006-07-19 14:21:57.000000000 +0200
@@ -53,7 +53,7 @@
     DBC			*dbcp;		// cursor
     DBT			skey;
     DB_ENV		*dbenv;		// database enviroment
-    DB_INFO		dbinfo;
+//    DB_INFO		dbinfo;
 
     String		lkey;
     int			seqrc;
diff -ur htdig/debian/htdig-3.1.6/Makefile.config.in htdig-3.1.6/Makefile.config.in
--- htdig/debian/htdig-3.1.6/Makefile.config.in	2006-07-20 22:16:49.000000000 +0200
+++ htdig-3.1.6/Makefile.config.in	2006-07-19 14:44:44.000000000 +0200
@@ -27,7 +27,7 @@
 LIBDIRS=	-L../htlib -L../htcommon -L/usr/lib
 INCS=		-I$(top_srcdir)/htlib -I$(top_srcdir)/htcommon \
 		-I../include
-DB2LIB=		$(shell if [ -f /lib/libdb.so.3 ]; then echo -ldb; else echo -ldb2; fi)
+DB2LIB=		-ldb-4
 HTLIBS=		../htcommon/libcommon.a \
 		../htlib/libht.a \
 		$(DB2LIB)

Reply via email to