Преглед изворни кода

Includes new patches to use current version of Berkley db. The patch should be removed when inn 2.4 is released, because it supposedly :-( fixes the incompatibilities.

Michael Schloh von Bennewitz пре 23 година
родитељ
комит
bf3304437f
2 измењених фајлова са 217 додато и 7 уклоњено
  1. 212 0
      inn/inn-db4.patch
  2. 5 7
      inn/inn.spec

+ 212 - 0
inn/inn-db4.patch

@@ -0,0 +1,212 @@
+diff -Naur inn-2.3.3.orig/storage/ovdb/ovdb.c inn-2.3.3/storage/ovdb/ovdb.c
+--- inn-2.3.3.orig/storage/ovdb/ovdb.c	Thu Oct 10 14:29:29 2002
++++ inn-2.3.3/storage/ovdb/ovdb.c	Thu Oct 10 16:15:55 2002
+@@ -99,7 +99,7 @@
+ #error Need BerkeleyDB 2.6.x, 2.7.x, or 3.x
+ #endif
+ #else
+-#if DB_VERSION_MAJOR != 3
++#if DB_VERSION_MAJOR != 3 && DB_VERSION_MAJOR != 4
+ #error Need BerkeleyDB 2.6.x, 2.7.x, or 3.x
+ #endif
+ #endif
+@@ -382,6 +382,9 @@
+ static int open_db_file(int which)
+ {
+     int ret;
++#if DB_VERSION_MAJOR == 4
++    DB_TXN *txnp = NULL;
++#endif
+ 
+     if(dbs[which] != NULL)
+ 	return 0;
+@@ -401,13 +404,28 @@
+     if(ovdb_conf.pagesize > 0)
+ 	(dbs[which])->set_pagesize(dbs[which], ovdb_conf.pagesize);
+ 
++#if DB_VERSION_MAJOR == 4
++/* starting sometime early db 4.X, db->open gets a new parameter txnp */
++    if (ret = OVDBenv->txn_begin(OVDBenv, NULL, &txnp, 0)) {
++        (dbs[which])->close(dbs[which], 0);
++        dbs[which] = NULL;
++        return ret;
++    }
++    if(ret = (dbs[which])->open(dbs[which], txnp, _dbnames[which], NULL,
++        DB_BTREE, _db_flags, 0666)) {
++	(dbs[which])->close(dbs[which], 0);
++	dbs[which] = NULL;
++	return ret;
++    }
++#else
+     if(ret = (dbs[which])->open(dbs[which], _dbnames[which], NULL, DB_BTREE,
+-		_db_flags, 0666)) {
++        _db_flags, 0666)) {
+ 	(dbs[which])->close(dbs[which], 0);
+ 	dbs[which] = NULL;
+ 	return ret;
+     }
+-#endif
++#endif /* #if DB_VERSION_MAJOR == 4 */
++#endif /* #if DB_VERSION_MAJOR == 2 */
+     return 0;
+ }
+ 
+@@ -590,7 +608,7 @@
+     return TRUE;
+ }
+ 
+-#if DB_VERSION_MAJOR == 3
++#if DB_VERSION_MAJOR >= 3
+ static int upgrade_database(char *name)
+ {
+     int ret;
+@@ -636,6 +654,8 @@
+     DB *vdb;
+ #if DB_VERSION_MAJOR == 2
+     DB_INFO dbinfo;
++#elif DB_VERSION_MAJOR == 4
++    DB_TXN *txnp = NULL;
+ #endif
+     DBT key, val;
+ 
+@@ -659,7 +679,7 @@
+     if(flags & OVDB_RECOVER)
+ 	ai_flags |= DB_RECOVER;
+ 
+-#if DB_VERSION_MAJOR == 2 || DB_VERSION_MINOR < 2
++#if DB_VERSION_MAJOR == 2 || (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR < 2)
+     if(ovdb_conf.txn_nosync)
+ 	ai_flags |= DB_TXN_NOSYNC;
+ #endif
+@@ -697,12 +717,12 @@
+     OVDBenv->set_errcall(OVDBenv, OVDBerror);
+     OVDBenv->set_cachesize(OVDBenv, 0, ovdb_conf.cachesize, 1);
+ 
+-#if DB_VERSION_MINOR >= 2
++#if (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR >= 2) || DB_VERSION_MAJOR == 4
+     if(ovdb_conf.txn_nosync)
+ 	OVDBenv->set_flags(OVDBenv, DB_TXN_NOSYNC, 1);
+ #endif
+ 
+-#if DB_VERSION_MINOR == 0
++#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR == 0
+     if(ret = OVDBenv->open(OVDBenv, ovdb_conf.home, NULL, ai_flags, 0666)) {
+ #else
+     if(ret = OVDBenv->open(OVDBenv, ovdb_conf.home, ai_flags, 0666)) {
+@@ -726,12 +746,27 @@
+ 	syslog(L_FATAL, "OVDB: open: db_create: %s", db_strerror(ret));
+ 	return ret;
+     }
+-    if(ret = vdb->open(vdb, "version", NULL, DB_BTREE,
++
++#if DB_VERSION_MAJOR == 4
++/* starting sometime early db 4.X, db->open gets a new parameter txnp */
++    if (ret = OVDBenv->txn_begin(OVDBenv, NULL, &txnp, 0)) {
++        vdb->close(vdb, 0);
++        vdb = NULL;
++        return ret;
++    }
++    if(ret = vdb->open(vdb, txnp, "version", NULL, DB_BTREE,
+ 		_db_flags, 0666)) {
+ 	vdb->close(vdb, 0);
+ 	syslog(L_FATAL, "OVDB: open: version->open: %s", db_strerror(ret));
+ 	return ret;
+     }
++#else
++    if(ret = vdb->open(vdb, "version", NULL, DB_BTREE, _db_flags, 0666)) {
++        vdb->close(vdb, 0);
++        syslog(L_FATAL, "OVDB: open: version->open: %s", db_strerror(ret));
++        return ret;
++    }
++#endif /* DB_VERSION_MAJOR == 4 */
+ #endif /* DB_VERSION_MAJOR == 2 */
+ 
+     memset(&key, 0, sizeof key);
+@@ -779,6 +814,8 @@
+ 
+ #if DB_VERSION_MAJOR == 2
+     DB_INFO dbinfo;
++#elif DB_VERSION_MAJOR == 4
++    DB_TXN *txnp = NULL;
+ #endif
+ 
+     if(OVDBenv != NULL) {
+@@ -841,33 +878,77 @@
+ 	syslog(L_FATAL, "OVDB: open: db_create: %s", db_strerror(ret));
+ 	return FALSE;
+     }
++
++#if DB_VERSION_MAJOR == 4
++/* starting sometime early db 4.X, db->open gets a new parameter txnp */
++    if (ret = OVDBenv->txn_begin(OVDBenv, NULL, &txnp, 0)) {
++        groupstats->close(groupstats, 0);
++        groupstats = NULL;
++        return ret;
++    }
++    if(ret = groupstats->open(groupstats, txnp, "groupstats", NULL,
++        DB_BTREE, _db_flags, 0666)) {
++	groupstats->close(groupstats, 0);
++	syslog(L_FATAL, "OVDB: open: groupstats->open: %s", db_strerror(ret));
++	return FALSE;
++    }
++#else
+     if(ret = groupstats->open(groupstats, "groupstats", NULL, DB_BTREE,
+ 		_db_flags, 0666)) {
+ 	groupstats->close(groupstats, 0);
+ 	syslog(L_FATAL, "OVDB: open: groupstats->open: %s", db_strerror(ret));
+ 	return FALSE;
+     }
++#endif /* #if DB_VERSION_MAJOR == 4 */
+     if(ret = db_create(&groupsbyname, OVDBenv, 0)) {
+ 	syslog(L_FATAL, "OVDB: open: db_create: %s", db_strerror(ret));
+ 	return FALSE;
+     }
++#if DB_VERSION_MAJOR == 4
++    if (ret = OVDBenv->txn_begin(OVDBenv, NULL, &txnp, 0)) {
++        groupsbyname->close(groupsbyname, 0);
++        groupsbyname = NULL;
++        return ret;
++    }
++    if(ret = groupsbyname->open(groupsbyname, txnp, "groupsbyname", NULL, DB_HASH,
++		_db_flags, 0666)) {
++	groupsbyname->close(groupsbyname, 0);
++	syslog(L_FATAL, "OVDB: open: groupsbyname->open: %s", db_strerror(ret));
++	return FALSE;
++    }
++#else
+     if(ret = groupsbyname->open(groupsbyname, "groupsbyname", NULL, DB_HASH,
+ 		_db_flags, 0666)) {
+ 	groupsbyname->close(groupsbyname, 0);
+ 	syslog(L_FATAL, "OVDB: open: groupsbyname->open: %s", db_strerror(ret));
+ 	return FALSE;
+     }
++#endif /* #if DB_VERSION_MAJOR == 4 */
+     if(ret = db_create(&groupaliases, OVDBenv, 0)) {
+ 	syslog(L_FATAL, "OVDB: open: db_create: %s", db_strerror(ret));
+ 	return FALSE;
+     }
++#if DB_VERSION_MAJOR == 4
++    if (ret = OVDBenv->txn_begin(OVDBenv, NULL, &txnp, 0)) {
++        groupaliases->close(groupaliases, 0);
++        groupaliases = NULL;
++        return ret;
++    }
++    if(ret = groupaliases->open(groupaliases, txnp, "groupaliases", NULL, DB_HASH,
++		_db_flags, 0666)) {
++	groupaliases->close(groupaliases, 0);
++	syslog(L_FATAL, "OVDB: open: groupaliases->open: %s", db_strerror(ret));
++	return FALSE;
++    }
++#else
+     if(ret = groupaliases->open(groupaliases, "groupaliases", NULL, DB_HASH,
+ 		_db_flags, 0666)) {
+ 	groupaliases->close(groupaliases, 0);
+ 	syslog(L_FATAL, "OVDB: open: groupaliases->open: %s", db_strerror(ret));
+ 	return FALSE;
+     }
+-#endif
++#endif /* #if DB_VERSION_MAJOR == 4 */
++#endif /* #if DB_VERSION_MAJOR == 2 */
+ 
+     Cutofflow = FALSE;
+     return TRUE;

+ 5 - 7
inn/inn.spec

@@ -37,18 +37,19 @@ Distribution: OpenPKG [BASE]
 Group:        News
 License:      ISC
 Version:      %{V_inn}
-Release:      20020911
+Release:      20021010
 
 #   list of sources
 Source0:      ftp://ftp.isc.org/isc/inn/inn-%{V_inn}.tar.gz
 Source1:      http://www.bofh.it/~md/cleanfeed/cleanfeed-%{V_cleanfeed}.tgz
 Source2:      rc.inn
 Source3:      fsl.inn
+Patch0:       inn-db4.patch
 
 #   build information
 Prefix:       %{l_prefix}
 BuildRoot:    %{l_buildroot}
-BuildPreReq:  OpenPKG, openpkg >= 20020206, fsl, make, perl, db3, openssl, bison, flex
+BuildPreReq:  OpenPKG, openpkg >= 20020206, fsl, make, perl, db, openssl, bison, flex
 PreReq:       OpenPKG, openpkg >= 20020206, fsl, perl, perl-crypto, MTA
 AutoReq:      no
 AutoReqProv:  no
@@ -61,6 +62,7 @@ AutoReqProv:  no
 %prep
     %setup0 -q -c
     %setup1 -q -T -D -a 1
+    %patch0 -p0
 
 %build
     #   build inn
@@ -73,17 +75,13 @@ AutoReqProv:  no
     %{l_shtool} subst \
         -e "s;^\\(pathbin:.*\\)@prefix@.*;\\1@prefix@/libexec/inn;" \
         samples/inn.conf.in
-    %{l_shtool} subst \
-        -e "s;BERKELEY_DB_DIR/include;BERKELEY_DB_DIR/include/db3;" \
-        -e "s;-ldb;-ldb3;" \
-        configure
     %{l_shtool} subst \
         -e 's;\(ExtUtils::Embed.*ldopts.*tail -1\);\1 | sed -e "s/ -lc/ /";' \
         configure
 
     #   configure the source tree
     CC="%{l_cc}" \
-    CFLAGS="%{l_cflags -O} -I%{l_prefix}/include/db3 -I%{l_prefix}/include" \
+    CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
     LDFLAGS="`%{l_prefix}/bin/fsl-config --ldflags --all`" \
     LIBS="`%{l_prefix}/bin/fsl-config --libs --all`" \
     ./configure \