Submitted By: Mario Fetka (mario dot fetka at gmail dot com)
Date: 2009-01-28
Initial Package Version: 3.5.2
Origin: me
Upstream Status: unknown
Description: add support for db 4.5
 
diff -Naur reprepro-3.8.1.orig/configure.ac reprepro-3.8.1/configure.ac
--- reprepro-3.8.1.orig/configure.ac	2009-01-28 11:05:36.195261912 +0000
+++ reprepro-3.8.1/configure.ac	2009-01-28 11:08:19.502260024 +0000
@@ -26,7 +26,7 @@
 DBCPPFLAGS=""
 AH_TEMPLATE([LIBDB_VERSION],[variant of libdb used])
 AC_ARG_WITH(libdb,
-[  --with-libdb=path|4.7|4.6|4.4|4.3|3 Give prefix of libdb or specify version to use],[dnl
+[  --with-libdb=path|4.7|4.6|4.5|4.4|4.3|3 Give prefix of libdb or specify version to use],[dnl
 	case "$withval" in
 	no)
 	AC_MSG_ERROR(["Cannot compile without libdb"]);
@@ -40,6 +40,9 @@
 	4.4)
 	DB_WANT_VERSION=4.4
 	;;
+	4.5)
+	DB_WANT_VERSION=4.5
+	;;
 	4.6)
 	DB_WANT_VERSION=4.6
 	;;
@@ -86,6 +89,12 @@
 	elif test "$DB_WANT_VERSION" != "4.4" ; then
 		AC_MSG_ERROR([Found libdb major version $DB_VERSION_MAJOR.$DB_VERSION_MINOR, need $DB_WANT_VERSION])
 	fi
+elif test "x$DB_VERSION_MAJOR" = "x4" -a "x$DB_VERSION_MINOR" = "x5" ; then
+	if test "$DB_WANT_VERSION" = "any" ; then
+		DB_WANT_VERSION=4.5
+	elif test "$DB_WANT_VERSION" != "4.5" ; then
+		AC_MSG_ERROR([Found libdb major version $DB_VERSION_MAJOR.$DB_VERSION_MINOR, need $DB_WANT_VERSION])
+	fi
 elif test "x$DB_VERSION_MAJOR" = "x4" -a "x$DB_VERSION_MINOR" = "x6" ; then
 	if test "$DB_WANT_VERSION" = "any" ; then
 		DB_WANT_VERSION=4.6
@@ -103,7 +112,7 @@
 	fi
 else
 	AC_MSG_ERROR([Unsupported libdb major $DB_VERSION_MAJOR minor $DB_VERSION_MINOR
-Only 4.6 (recommended) or 3.2 or 4.4 or 4.3 or 4.7 are supported])
+Only 4.6 (recommended) or 3.2 or 4.3 or 4.4 or 4.5 or 4.7 are supported])
 fi
 
 # now we have a header with the expected version, check for the library:
@@ -120,6 +129,12 @@
 			DBLIBS="-ldb-4.6 $DBLIBS"
 	],[AC_MSG_ERROR(["no libdb-4.6 found"])],[$DBLIBS])
 ;;
+4.5)
+	AC_CHECK_LIB(db-4.5,db_create,[dnl
+			AC_DEFINE_UNQUOTED(AS_TR_CPP(LIBDB_VERSION),45)
+			DBLIBS="-ldb-4.5 $DBLIBS"
+	],[AC_MSG_ERROR(["no libdb-4.5 found"])],[$DBLIBS])
+;;
 4.4)
 	AC_CHECK_LIB(db-4.4,db_create,[dnl
 			AC_DEFINE_UNQUOTED(AS_TR_CPP(LIBDB_VERSION),44)
diff -Naur reprepro-3.8.1.orig/database.c reprepro-3.8.1/database.c
--- reprepro-3.8.1.orig/database.c	2009-01-28 11:05:36.201260707 +0000
+++ reprepro-3.8.1/database.c	2009-01-28 11:09:32.589262903 +0000
@@ -246,6 +246,8 @@
 #elif LIBDB_VERSION == 47
 #warning libdb4.7 not yet tested. Use on your own risk
 #define DB_OPEN(database,filename,name,type,flags) database->open(database,NULL,filename,name,type,flags,0664)
+#elif LIBDB_VERSION == 45
+#define DB_OPEN(database,filename,name,type,flags) database->open(database,NULL,filename,name,type,flags,0664)
 #elif LIBDB_VERSION == 44
 #define DB_OPEN(database,filename,name,type,flags) database->open(database,NULL,filename,name,type,flags,0664)
 #elif LIBDB_VERSION == 43