RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES configure.ac macros.in rpm/rpmdb/ db_emu.h dbc...

From: Ralf S. Engelschall <rse@rpm5.org>
Date: Thu 28 Jun 2007 - 17:52:05 CEST
Message-Id: <20070628155205.C7E8E3484E7@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Ralf S. Engelschall
  Root:   /v/rpm/cvs                       Email:  rse@rpm5.org
  Module: rpm                              Date:   28-Jun-2007 17:52:05
  Branch: HEAD                             Handle: 2007062816520500

  Modified files:
    rpm                     CHANGES configure.ac macros.in
    rpm/rpmdb               db_emu.h dbconfig.c rpmdb.h

  Log:
    .open "Peril Sensitive Sunglasses"
    .load "Armor" "Maximum"
    .strike "Argumentation-Flag" "half-mast"
    
    Based on all the recent cleanup and streamline efforts on the RPM 5
    build environment, it is now possible to surgically teach RPM 5 one
    remaining (officially unsupported but) technically very interesting
    feature:
    
       Out-of-the-box building RPM without Berkeley-DB at all.
    
    This is explicitly declared "unsupported" in Autoconf by default
    and a simple "--without-db" is intentionally _NOT_ sufficient. One
    really has to use "--with-bugreport=<email-address> --without-db
    --with-sqlite=...", i.e., one has to explicitly set a support channel
    different from "rpm-devel@rpm5.org" and one at the same time has to
    provide at least the alternative SQLite-based RPM DB backend. So,
    the packager really has to take _EXPLICIT_ action and this is NOT
    recommended by us although it is now at least technically possible.
    
    In case of an SQLite-only RPM the "macros" file is automatically
    adjusted to "_dbapi 4", so this really works out-of-the-box also
    under runtime. In case one builds RPM with both Berkeley-DB and
    SQLite the default is still Berkeley-DB, of course. Nevertheless one
    can now explicitly select the configured default RPM DB API with
    --with-dbapi={db,sqlite} now, too.

  Summary:
    Revision    Changes     Path
    1.1413      +3  -0      rpm/CHANGES
    2.153       +26 -1      rpm/configure.ac
    1.166       +3  -3      rpm/macros.in
    1.2         +5  -1      rpm/rpmdb/db_emu.h
    1.39        +138 -27    rpm/rpmdb/dbconfig.c
    1.59        +6  -0      rpm/rpmdb/rpmdb.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1412 -r1.1413 CHANGES
  --- rpm/CHANGES	28 Jun 2007 15:10:15 -0000	1.1412
  +++ rpm/CHANGES	28 Jun 2007 15:52:05 -0000	1.1413
  @@ -1,4 +1,7 @@
   4.5 -> 5.0:
  +    - rse: allow one to explicitly select the RPM DB API with --with-dbapi={db,sqlite}
  +    - rse: provide automatically Autoconf chosen RPM DB API selection and configuration
  +    - rse: allow one to build an SQLite-only RPM with "--without-db --with-sqlite=external"
       - rse: allow Berkeley-DB/SQLite-specific RPM DB per-tag parameters according to dynamically selected DB API
       - rse: introduce --with-bugreport=<email-address> and require this before unsupported Autoconf operations
       - rse: simplify internal Berkeley-DB handling in rpmdb/ and allow (unsupported) --with-db=external
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/configure.ac
  ============================================================================
  $ cvs diff -u -r2.152 -r2.153 configure.ac
  --- rpm/configure.ac	28 Jun 2007 06:12:33 -0000	2.152
  +++ rpm/configure.ac	28 Jun 2007 15:52:05 -0000	2.153
  @@ -744,6 +744,7 @@
       [db-4.5 db], [db_create], [db.h],
       [yes,internal:external], [db3],
       [ DBLIBSRCS="$DBLIBSRCS db3.c"
  +      AM_CONDITIONAL(WITH_DB, [ true ])
         AM_CONDITIONAL(WITH_DB_INTERNAL, [ test ".$RPM_CHECK_LIB_LOCATION" = .internal ])
         if test ".$RPM_CHECK_LIB_LOCATION" = .internal; then
             AC_DEFINE(HAVE_DB_H, 1, [Have <db.h> header])
  @@ -753,7 +754,14 @@
             AC_MSG_ERROR([using external Berkeley-DB not supported (without packager taking responsibility first)])
         fi
       ],
  -    [ AC_MSG_ERROR([mandatory Berkeley-DB library not found]) ])
  +    [ AM_CONDITIONAL(WITH_DB, [ false ])
  +      AM_CONDITIONAL(WITH_DB_INTERNAL, [ false ])
  +      if test ".$PACKAGE_BUGREPORT" != ".]m4_defn([PACKAGE_BUGREPORT_DEFAULT])["; then
  +          AC_MSG_WARN([not using Berkeley-DB at all not recommended -- proceeding on packagers responsibility])
  +      else
  +          AC_MSG_ERROR([not using Berkeley-DB at all not supported (without packager taking responsibility first)])
  +      fi
  +    ])
   RPM_CHECK_LIB(
       [SQLite], [sqlite],
       [sqlite3], [sqlite3_open], [sqlite3.h],
  @@ -768,6 +776,23 @@
   AC_ARG_WITH(db-rpc,       AS_HELP_STRING([--with-db-rpc],       [build Berkeley-DB with RPC support]))
   AM_CONDITIONAL(WITH_DB_RPC, test ".$with_db_rpc" = .yes)
   
  +dnl # determine default RPM DB API and configuration
  +DBAPI=0
  +case ".$DBLIBSRCS" in
  +    *db3.c*    ) DBAPI=3 ;;
  +    *sqlite.c* ) DBAPI=4 ;;
  +    *          ) AC_MSG_ERROR([either Berkeley-DB (--with-db) or SQLite (--with-sqlite) have to be used]) ;;
  +esac
  +AC_ARG_WITH([dbapi],
  +    AS_HELP_STRING([--with-dbapi=ID], [use particular default RPM DB API ("db", "sqlite" or numeric)]), [
  +    case ".$withval" in
  +        db|3     ) DBAPI=3 ;;
  +        sqlite|4 ) DBAPI=4 ;;
  +        [0-9]    ) DBAPI=$withval ;;
  +    esac
  +])
  +AC_SUBST(DBAPI)
  +
   dnl # Lua
   WITH_LUA_SUBDIR_DEF=""
   WITH_LUA_SUBDIR_LIB=""
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/macros.in
  ============================================================================
  $ cvs diff -u -r1.165 -r1.166 macros.in
  --- rpm/macros.in	28 Jun 2007 15:10:15 -0000	1.165
  +++ rpm/macros.in	28 Jun 2007 15:52:05 -0000	1.166
  @@ -1,7 +1,7 @@
   #/*! \page config_macros Default configuration: @USRLIBRPM@/macros
   # \verbatim
   #
  -# $Id: macros.in,v 1.165 2007/06/28 15:10:15 rse Exp $
  +# $Id: macros.in,v 1.166 2007/06/28 15:52:05 rse Exp $
   #
   # This is a global RPM configuration file. All changes made here will
   # be lost when the rpm package is upgraded. Any per-system configuration
  @@ -724,8 +724,8 @@
   # There are different macros so that --rebuilddb can convert the
   # database between formats (usually for upgrading purposes)
   #
  -%_dbapi			3
  -%_dbapi_rebuild		3
  +%_dbapi			@DBAPI@
  +%_dbapi_rebuild		@DBAPI@
   %_dbapi_used		%{?_rpmdb_rebuild:%{_dbapi_rebuild}}%{!?_rpmdb_rebuild:%{_dbapi}}
   
   #
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/db_emu.h
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 db_emu.h
  --- rpm/rpmdb/db_emu.h	28 Jan 2005 21:56:56 -0000	1.1
  +++ rpm/rpmdb/db_emu.h	28 Jun 2007 15:52:05 -0000	1.2
  @@ -22,7 +22,7 @@
     u_int32_t	size;
     void		*data;
   
  -  #define DB_DBT_MALLOC 0x01   /* We malloc the memory and hand off a copy. */
  +#define DB_DBT_MALLOC 0x01   /* We malloc the memory and hand off a copy. */
     u_int32_t	flags;
   };
   
  @@ -49,4 +49,8 @@
   #define DB_WRITECURSOR 39
   #define DB_NOTFOUND (-30990)
   
  +#define DB_VERSION_MAJOR 3
  +#define DB_VERSION_MINOR 0
  +#define DB_VERSION_PATCH 0
  +
   #endif
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/dbconfig.c
  ============================================================================
  $ cvs diff -u -r1.38 -r1.39 dbconfig.c
  --- rpm/rpmdb/dbconfig.c	25 May 2007 17:36:33 -0000	1.38
  +++ rpm/rpmdb/dbconfig.c	28 Jun 2007 15:52:05 -0000	1.39
  @@ -15,8 +15,7 @@
   /*@access dbiIndex@*/
   /*@access dbiIndexSet@*/
   
  -#if (DB_VERSION_MAJOR == 3) || (DB_VERSION_MAJOR == 4)
  -#define	__USE_DB3	1
  +#if defined(WITH_DB) || defined(WITH_SQLITE)
   
   /*@-exportlocal -exportheadervar@*/
   /*@unchecked@*/
  @@ -35,87 +34,127 @@
   /*@unchecked@*/
   struct poptOption rdbOptions[] = {
    /* XXX DB_CXX_NO_EXCEPTIONS */
  -#if defined(DB_CLIENT)
  +#if defined(WITH_DB) && defined(DB_CLIENT)
    { "client",	0,POPT_BIT_SET,	&db3dbi.dbi_ecflags, DB_CLIENT,
   	NULL, NULL },
   #endif
  -#if defined(DB_RPCCLIENT)
  +#if defined(WITH_DB) && defined(DB_RPCCLIENT)
    { "client",	0,POPT_BIT_SET,	&db3dbi.dbi_ecflags, DB_RPCCLIENT,
   	NULL, NULL },
    { "rpcclient",	0,POPT_BIT_SET,	&db3dbi.dbi_ecflags, DB_RPCCLIENT,
   	NULL, NULL },
   #endif
   
  +#if defined(WITH_DB) && defined(DB_XA_CREATE)
    { "xa_create",	0,POPT_BIT_SET,	&db3dbi.dbi_cflags, DB_XA_CREATE,
   	NULL, NULL },
  +#endif
   
   /* DB_ENV->open and DB->open */
  -#if defined(DB_AUTO_COMMIT)
  +#if defined(WITH_DB) && defined(DB_AUTO_COMMIT)
    { "auto_commit", 0,POPT_BIT_SET, &db3dbi.dbi_oeflags, DB_AUTO_COMMIT,
   	NULL, NULL },
   #endif
  +#if defined(WITH_DB) && defined(DB_CREATE)
    { "create",	0,POPT_BIT_SET,	&db3dbi.dbi_oeflags, DB_CREATE,
   	NULL, NULL },
  -#if defined(DB_MULTIVERSION)
  +#endif
  +#if defined(WITH_DB) && defined(DB_MULTIVERSION)
    { "multiversion", 0,POPT_BIT_SET, &db3dbi.dbi_oeflags, DB_MULTIVERSION,
   	NULL, NULL },
   #endif
  +#if defined(WITH_DB) && defined(DB_NOMMAP)
    { "nommap",	0,POPT_BIT_SET,	&db3dbi.dbi_oeflags, DB_NOMMAP,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_THREAD)
    { "thread",	0,POPT_BIT_SET,	&db3dbi.dbi_oeflags, DB_THREAD,
   	NULL, NULL },
  +#endif
   
  +#if defined(WITH_DB) && defined(DB_FORCE)
    { "force",	0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_FORCE,
   	NULL, NULL },
  +#endif
   
   /* DB_ENV->set_flags */
   /* DB_ENV->get_flags */
  +#if defined(WITH_DB) && defined(DB_INIT_CDB)
    { "cdb",	0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_INIT_CDB,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_INIT_LOCK)
    { "lock",	0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_INIT_LOCK,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_INIT_LOG)
    { "log",	0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_INIT_LOG,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_INIT_MPOOL)
    { "mpool",	0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_INIT_MPOOL,
   	NULL, NULL },
  -#if defined(DB_INIT_REP)
  +#endif
  +#if defined(WITH_DB) && defined(DB_INIT_REP)
    { "rep", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_INIT_REP,
   	NULL, NULL },
   #endif
  +#if defined(WITH_DB) && defined(DB_INIT_TXN)
    { "txn",	0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_INIT_TXN,
   	NULL, NULL },
  +#endif
   
   #ifdef	DYING	/* XXX compatibly defined to 0 in db-4.5.20 */
    { "joinenv",	0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_JOINENV,
   	NULL, NULL },
   #endif
  +#if defined(WITH_DB) && defined(DB_LOCKDOWN)
    { "lockdown",	0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_LOCKDOWN,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_PRIVATE)
    { "private",	0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_PRIVATE,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_RECOVER)
    { "recover",	0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_RECOVER,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_RECOVER_FATAL)
    { "recover_fatal", 0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_RECOVER_FATAL,
   	NULL, NULL },
  -#if defined(DB_REGISTER)
  +#endif
  +#if defined(WITH_DB) && defined(DB_REGISTER)
    { "register", 0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_REGISTER,
   	NULL, NULL },
   #endif
  +#if defined(WITH_DB) && defined(DB_SYSTEM_MEM)
    { "shared",	0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_SYSTEM_MEM,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_TXN_NOSYNC)
    { "txn_nosync", 0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_TXN_NOSYNC,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_USE_ENVIRON_ROOT)
    { "use_environ_root", 0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_USE_ENVIRON_ROOT,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_USE_ENVIRON)
    { "use_environ", 0,POPT_BIT_SET,	&db3dbi.dbi_eflags, DB_USE_ENVIRON,
   	NULL, NULL },
  +#endif
   
  +#if defined(WITH_DB) && defined(DB_TXN_SYNC)
    { "txn_sync",	0,POPT_BIT_SET,	&db3dbi.dbi_tflags, DB_TXN_SYNC,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_TXN_NOWAIT)
    { "txn_nowait",0,POPT_BIT_SET,	&db3dbi.dbi_tflags, DB_TXN_NOWAIT,
   	NULL, NULL },
  +#endif
   
  -#if defined(NOTYET)
  +#if defined(WITH_DB) && defined(NOTYET)
   DB_AUTO_COMMIT
   DB_CDB_ALLDB
   DB_DIRECT_DB
  @@ -141,7 +180,7 @@
   
   /* DB->set_flags */
   /* DB->get_flags */
  -#if defined(NOTYET)
  +#if defined(WITH_DB) && defined(NOTYET)
   DB_CHKSUM
   DB_ENCRYPT
   DB_TXN_NOT_DURABLE
  @@ -157,30 +196,39 @@
   #endif
   
   /* DB->open */
  +#if defined(WITH_DB) && defined(DB_EXCL)
    { "excl",	0,POPT_BIT_SET,	&db3dbi.dbi_oflags, DB_EXCL,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_FCNTL_LOCKING)
    { "fcntl_locking",0,POPT_BIT_SET,	&db3dbi.dbi_oflags, DB_FCNTL_LOCKING,
   	NULL, NULL },
  -#if defined(DB_NO_AUTO_COMMIT) && defined(NOTYET)
  +#endif
  +#if defined(WITH_DB) && defined(DB_NO_AUTO_COMMIT) && defined(NOTYET)
    { "noautocommit", 0,POPT_BIT_SET,	&db3dbi.dbi_oflags, DB_NO_AUTO_COMMIT,
   	NULL, NULL },
   #endif
  +#if defined(WITH_DB) && defined(DB_RDONLY)
    { "rdonly",	0,POPT_BIT_SET,	&db3dbi.dbi_oflags, DB_RDONLY,
   	NULL, NULL },
  -#if defined(DB_RDWRMASTER) && defined(NOTYET)
  +#endif
  +#if defined(WITH_DB) && defined(DB_RDWRMASTER) && defined(NOTYET)
    { "rdwrmaster", 0,POPT_BIT_SET,	&db3dbi.dbi_oflags, DB_RDWRMASTER,
   	NULL, NULL },
   #endif
  -#if defined(NOTYET)
  +#if defined(WITH_DB) && defined(NOTYET)
   DB_READ_UNCOMITTED
   #endif
  +#if defined(WITH_DB) && defined(DB_TRUNCATE)
    { "truncate",	0,POPT_BIT_SET,	&db3dbi.dbi_oflags, DB_TRUNCATE,
   	NULL, NULL },
  -#if defined(DB_WRITEOPEN)
  +#endif
  +#if defined(WITH_DB) && defined(DB_WRITEOPEN)
    { "writeopen", 0,POPT_BIT_SET,	&db3dbi.dbi_oflags, DB_WRITEOPEN,
   	NULL, NULL },
   #endif
   
  +#if defined(WITH_DB)
    { "btree",	0,POPT_ARG_VAL,		&db3dbi.dbi_type, DB_BTREE,
   	NULL, NULL },
    { "hash", 	0,POPT_ARG_VAL,		&db3dbi.dbi_type, DB_HASH,
  @@ -191,6 +239,7 @@
   	NULL, NULL },
    { "unknown",	0,POPT_ARG_VAL,		&db3dbi.dbi_type, DB_UNKNOWN,
   	NULL, NULL },
  +#endif
   
    { "root",	0,POPT_ARG_STRING,	&db3dbi.dbi_root, 0,
   	NULL, NULL },
  @@ -200,6 +249,7 @@
   	NULL, NULL },
    { "subfile",	0,POPT_ARG_STRING,	&db3dbi.dbi_subfile, 0,
   	NULL, NULL },
  +#if defined(WITH_DB)
    { "mode",	0,POPT_ARG_INT,		&db3dbi.dbi_mode, 0,
   	NULL, NULL },
    { "perms",	0,POPT_ARG_INT,		&db3dbi.dbi_perms, 0,
  @@ -208,7 +258,9 @@
   	NULL, NULL },
    { "tmpdir",	0,POPT_ARG_STRING,	&db3dbi.dbi_tmpdir, 0,
   	NULL, NULL },
  +#endif
   
  +#if defined(WITH_DB)
    { "host",	0,POPT_ARG_STRING,	&db3dbi.dbi_host, 0,
   	NULL, NULL },
    { "server",	0,POPT_ARG_STRING,	&db3dbi.dbi_host, 0,
  @@ -217,7 +269,9 @@
   	NULL, NULL },
    { "sv_timeout", 0,POPT_ARG_LONG,	&db3dbi.dbi_sv_timeout, 0,
   	NULL, NULL },
  +#endif
   
  +#if defined(WITH_DB)
    { "verify",	0,POPT_ARG_NONE,	&db3dbi.dbi_verify_on_close, 0,
   	NULL, NULL },
    { "teardown",	0,POPT_ARG_NONE,	&dbi_tear_down, 0,
  @@ -226,8 +280,10 @@
   	NULL, NULL },
    { "usedbenv",	0,POPT_ARG_NONE,	&db3dbi.dbi_use_dbenv, 0,
   	NULL, NULL },
  +#endif
    { "nofsync",	0,POPT_ARG_NONE,	&db3dbi.dbi_no_fsync, 0,
   	NULL, NULL },
  +#if defined(WITH_DB)
    { "nodbsync",	0,POPT_ARG_NONE,	&db3dbi.dbi_no_dbsync, 0,
   	NULL, NULL },
    { "lockdbfd",	0,POPT_ARG_NONE,	&db3dbi.dbi_lockdbfd, 0,
  @@ -236,8 +292,10 @@
   	NULL, NULL },
    { "debug",	0,POPT_ARG_NONE,	&db3dbi.dbi_debug, 0,
   	NULL, NULL },
  +#endif
   
   /* XXX set_alloc */
  +#if defined(WITH_DB)
    { "cachesize",	0,POPT_ARG_INT,		&db3dbi.dbi_cachesize, 0,
   	NULL, NULL },
   /* XXX set_dup_compare */
  @@ -255,63 +313,82 @@
   
    { "thread_count", 0,POPT_ARG_INT,	&db3dbi.dbi_thread_count, 0,
   	NULL, NULL },
  +#endif
   
  -#if defined(DB_VERB_CHKPOINT)
  +#if defined(WITH_DB) && defined(DB_VERB_CHKPOINT)
    { "chkpoint",	0,POPT_BIT_SET,	&db3dbi.dbi_verbose, DB_VERB_CHKPOINT,
   	NULL, NULL },
   #endif
  +#if defined(WITH_DB) && defined(DB_VERB_DEADLOCK)
    { "deadlock",	0,POPT_BIT_SET,	&db3dbi.dbi_verbose, DB_VERB_DEADLOCK,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_VERB_RECOVERY)
    { "recovery",	0,POPT_BIT_SET,	&db3dbi.dbi_verbose, DB_VERB_RECOVERY,
   	NULL, NULL },
  -#if defined(DB_VERB_REGISTER)
  +#endif
  +#if defined(WITH_DB) && defined(DB_VERB_REGISTER)
    { "register",	0,POPT_BIT_SET,	&db3dbi.dbi_verbose, DB_VERB_REGISTER,
   	NULL, NULL },
   #endif
  -#if defined(DB_VERB_REPLICATION)
  +#if defined(WITH_DB) && defined(DB_VERB_REPLICATION)
    { "replication", 0,POPT_BIT_SET, &db3dbi.dbi_verbose, DB_VERB_REPLICATION,
   	NULL, NULL },
   #endif
  +#if defined(WITH_DB) && defined(DB_VERB_WAITSFOR)
    { "waitsfor",	0,POPT_BIT_SET,	&db3dbi.dbi_verbose, DB_VERB_WAITSFOR,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB)
    { "verbose",	0,POPT_ARG_VAL,		&db3dbi.dbi_verbose, -1,
   	NULL, NULL },
  +#endif
   
   /* ==== Locking: */
   /* DB_ENV->lock_detect */
   /* DB_ENV->set_lk_detect */
   /* DB_ENV->get_lk_detect */
  +#if defined(WITH_DB) && defined(DB_LOCK_DEFAULT)
    { "lk_default",0,POPT_ARG_VAL,		&db3dbi.dbi_lk_detect, DB_LOCK_DEFAULT,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_LOCK_EXPIRE)
    { "lk_expire",	0,POPT_ARG_VAL,		&db3dbi.dbi_lk_detect, DB_LOCK_EXPIRE,
   	NULL, NULL },
  -#if defined(DB_LOCK_MAXLOCKS)
  +#endif
  +#if defined(WITH_DB) && defined(DB_LOCK_MAXLOCKS)
    { "lk_maxlocks", 0,POPT_ARG_VAL,	&db3dbi.dbi_lk_detect, DB_LOCK_MAXLOCKS,
   	NULL, NULL },
   #endif
  -#if defined(DB_LOCK_MAXWRITE)
  +#if defined(WITH_DB) && defined(DB_LOCK_MAXWRITE)
    { "lk_maxwrite", 0,POPT_ARG_VAL,	&db3dbi.dbi_lk_detect, DB_LOCK_MAXWRITE,
   	NULL, NULL },
   #endif
  -#if defined(DB_LOCK_MINLOCKS)
  +#if defined(WITH_DB) && defined(DB_LOCK_MINLOCKS)
    { "lk_minlocks", 0,POPT_ARG_VAL,	&db3dbi.dbi_lk_detect, DB_LOCK_MINLOCKS,
   	NULL, NULL },
   #endif
  -#if defined(DB_LOCK_MINWRITE)
  +#if defined(WITH_DB) && defined(DB_LOCK_MINWRITE)
    { "lk_minwrite", 0,POPT_ARG_VAL,	&db3dbi.dbi_lk_detect, DB_LOCK_MINWRITE,
   	NULL, NULL },
   #endif
  +#if defined(WITH_DB) && defined(DB_LOCK_OLDEST)
    { "lk_oldest",	0,POPT_ARG_VAL,		&db3dbi.dbi_lk_detect, DB_LOCK_OLDEST,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_LOCK_RANDOM)
    { "lk_random",	0,POPT_ARG_VAL,		&db3dbi.dbi_lk_detect, DB_LOCK_RANDOM,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_LOCK_YOUNGEST)
    { "lk_youngest",0, POPT_ARG_VAL,	&db3dbi.dbi_lk_detect, DB_LOCK_YOUNGEST,
   	NULL, NULL },
  +#endif
   
   /* DB_ENV->lock_get */
   /* XXX DB_ENV->set_lk_conflicts */
   /* XXX DB_ENV->get_lk_conflicts */
  -#if defined(NOTYET)
  +#if defined(WITH_DB) && defined(NOTYET)
   DB_LOCK_NOWAIT	/* flags */
   
   DB_LOCK_READ	/* mode(s) */
  @@ -321,6 +398,7 @@
   DB_LOCK_IWR
   #endif
   
  +#if defined(WITH_DB)
   /* XXX DB_ENV->set_lk_max_lockers */
   /* XXX DB_ENV->get_lk_max_lockers */
    { "lk_max_lockers", 0,POPT_ARG_INT,	&db3dbi.dbi_lk_max_lockers, 0,
  @@ -333,11 +411,13 @@
   /* XXX DB_ENV->get_lk_max_objects */
    { "lk_max_objects", 0,POPT_ARG_INT,	&db3dbi.dbi_lk_max_objects, 0,
   	NULL, NULL },
  +#endif
   
   /* XXX DB_ENV->set_timeout */
   /* XXX DB_ENV->get_timeout */
   
   /* ==== Logging: */
  +#if defined(WITH_DB)
   /* XXX DB_ENV->set_lg_bsize */
   /* XXX DB_ENV->get_lg_bsize */
    { "lg_bsize",	0,POPT_ARG_INT,		&db3dbi.dbi_lg_bsize, 0,
  @@ -358,8 +438,10 @@
   /* XXX DB_ENV->get_lg_regionmax */
    { "lg_regionmax", 0,POPT_ARG_INT,	&db3dbi.dbi_lg_regionmax, 0,
   	NULL, NULL },
  +#endif
   
   /* ==== Memory pool: */
  +#if defined(WITH_DB)
    { "mp_size",	0,POPT_ARG_INT,		&db3dbi.dbi_cachesize, 0,
   	NULL, NULL },
   /* XXX DB_ENV->set_mp_max_openfd */
  @@ -375,13 +457,15 @@
   /* XXX DB_MPOOLFILE->set_maxsize */
   /* XXX DB_MPOOLFILE->set_pgcookie */
   /* XXX DB_MPOOLFILE->set_priority */
  +#endif
   
   /* ==== Mutexes: */
  -#if defined(NOTYET)
  +#if defined(WITH_DB) && defined(NOTYET)
   DB_MUTEX_PROCESS_ONLY	mutex_alloc
   DB_MUTEX_SELF_BLOCK	mutex_alloc
   DB_STAT_CLEAR		mutex_stat*
   #endif
  +#if defined(WITH_DB)
   /* XXX DB_ENV->mutex_set_align */
   /* XXX DB_ENV->mutex_get_align */
    { "mutex_align", 0,POPT_ARG_INT,	&db3dbi.dbi_mutex_align, 0,
  @@ -398,6 +482,7 @@
   /* XXX DB_ENV->mutex_get_tas_spins */
    { "mutex_tas_spins",	0,POPT_ARG_INT,	&db3dbi.dbi_mutex_tas_spins, 0,
   	NULL, NULL },
  +#endif
   
   /* ==== Replication: */
   /* XXX DB_ENV->rep_set_config */
  @@ -408,27 +493,29 @@
   /* XXX DB_ENV->rep_set_transport */
   
   /* ==== Sequences: */
  +#if defined(WITH_DB)
   /* XXX DB_SEQUENCE->set_cachesize */
   /* XXX DB_SEQUENCE->get_cachesize */
    { "seq_cachesize",	0,POPT_ARG_INT,	&db3dbi.dbi_seq_cachesize, 0,
   	NULL, NULL },
  +#endif
   /* XXX DB_SEQUENCE->set_flags */
   /* XXX DB_SEQUENCE->get_flags */
  -#if defined(DB_SEQ_DEC)
  +#if defined(WITH_DB) && defined(DB_SEQ_DEC)
    { "seq_dec",	0,POPT_BIT_SET,		&db3dbi.dbi_seq_flags, DB_SEQ_DEC,
   	NULL, NULL },
   #endif
  -#if defined(DB_SEQ_INC)
  +#if defined(WITH_DB) && defined(DB_SEQ_INC)
    { "seq_inc",	0,POPT_BIT_SET,		&db3dbi.dbi_seq_flags, DB_SEQ_INC,
   	NULL, NULL },
   #endif
  -#if defined(DB_SEQ_WRAP)
  +#if defined(WITH_DB) && defined(DB_SEQ_WRAP)
    { "seq_wrap",	0,POPT_BIT_SET,		&db3dbi.dbi_seq_flags, DB_SEQ_WRAP,
   	NULL, NULL },
   #endif
   /* XXX DB_SEQUENCE->set_range */
   /* XXX DB_SEQUENCE->get_range */
  -#if defined(NOTYET)		/* needs signed 64bit type */
  +#if defined(WITH_DB) && defined(NOTYET)		/* needs signed 64bit type */
    { "seq_min",	0,POPT_ARG_INT,	&db3dbi.dbi_seq_min, 0,
   	NULL, NULL },
    { "seq_max",	0,POPT_ARG_INT,	&db3dbi.dbi_seq_max, 0,
  @@ -441,8 +528,10 @@
   /* XXX DB_ENV->txn_stat */
   /* XXX DB_ENV->set_timeout */
   /* XXX DB_ENV->get_timeout */
  +#if defined(WITH_DB)
    { "tx_max",	0,POPT_ARG_INT,		&db3dbi.dbi_tx_max, 0,
   	NULL, NULL },
  +#endif
   /* XXX DB_ENV->set_tx_timestamp */
   
   /* XXX set_append_recno */
  @@ -450,28 +539,47 @@
   /* XXX set_bt_dup_compare */
   /* XXX set_bt_minkey */
   /* XXX set_bt_prefix */
  +#if defined(WITH_DB) && defined(DB_DUP)
    { "bt_dup",	0,POPT_BIT_SET,	&db3dbi.dbi_bt_flags, DB_DUP,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_DUPSORT)
    { "bt_dupsort",0,POPT_BIT_SET,	&db3dbi.dbi_bt_flags, DB_DUPSORT,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_RECNUM)
    { "bt_recnum",	0,POPT_BIT_SET,	&db3dbi.dbi_bt_flags, DB_RECNUM,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_REVSPLITOFF)
    { "bt_revsplitoff", 0,POPT_BIT_SET,	&db3dbi.dbi_bt_flags, DB_REVSPLITOFF,
   	NULL, NULL },
  +#endif
   
  +#if defined(WITH_DB) && defined(DB_DUP)
    { "h_dup",	0,POPT_BIT_SET,	&db3dbi.dbi_h_flags, DB_DUP,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_SUPSORT)
    { "h_dupsort",	0,POPT_BIT_SET,	&db3dbi.dbi_h_flags, DB_DUPSORT,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB)
    { "h_ffactor",	0,POPT_ARG_INT,		&db3dbi.dbi_h_ffactor, 0,
   	NULL, NULL },
    { "h_nelem",	0,POPT_ARG_INT,		&db3dbi.dbi_h_nelem, 0,
   	NULL, NULL },
  +#endif
   
  +#if defined(WITH_DB) && defined(DB_RENUMBER)
    { "re_renumber", 0,POPT_BIT_SET,	&db3dbi.dbi_re_flags, DB_RENUMBER,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB) && defined(DB_SNAPSHOT)
    { "re_snapshot",0,POPT_BIT_SET,	&db3dbi.dbi_re_flags, DB_SNAPSHOT,
   	NULL, NULL },
  +#endif
  +#if defined(WITH_DB)
    { "re_delim",	0,POPT_ARG_INT,		&db3dbi.dbi_re_delim, 0,
   	NULL, NULL },
    { "re_len",	0,POPT_ARG_INT,		&db3dbi.dbi_re_len, 0,
  @@ -483,6 +591,7 @@
   
    { "q_extentsize", 0,POPT_ARG_INT,	&db3dbi.dbi_q_extentsize, 0,
   	NULL, NULL },
  +#endif
   
       POPT_TABLEEND
   };
  @@ -677,6 +786,7 @@
   
       dbi->dbi_byteswapped = -1;	/* -1 unknown, 0 native order, 1 alien order */
   
  +#if defined(WITH_DB)
       if (!dbi->dbi_use_dbenv) {		/* db3 dbenv is always used now. */
   	dbi->dbi_use_dbenv = 1;
   	dbi->dbi_eflags |= (DB_INIT_MPOOL|DB_JOINENV);
  @@ -686,6 +796,7 @@
   
       if ((dbi->dbi_bt_flags | dbi->dbi_h_flags) & DB_DUP)
   	dbi->dbi_permit_dups = 1;
  +#endif
   
       /*@-globstate@*/ /* FIX: *(rdbOptions->arg) reachable */
       return dbi;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmdb.h
  ============================================================================
  $ cvs diff -u -r1.58 -r1.59 rpmdb.h
  --- rpm/rpmdb/rpmdb.h	21 Jun 2007 12:25:44 -0000	1.58
  +++ rpm/rpmdb/rpmdb.h	28 Jun 2007 15:52:05 -0000	1.59
  @@ -10,7 +10,11 @@
   #include <assert.h>
   #include <rpmlib.h>
   #include <mire.h>
  +#if defined(WITH_DB)
   #include "db.h"
  +#else
  +#include "db_emu.h"
  +#endif
   
   /*@-exportlocal@*/
   /*@unchecked@*/
  @@ -491,6 +495,7 @@
   
   #if defined(_RPMDB_INTERNAL)
   /*@-exportlocal@*/
  +#if defined(WITH_DB) || defined(WITH_SQLITE)
   /** \ingroup db3
    * Return new configured index database handle instance.
    * @param rpmdb		rpm database
  @@ -522,6 +527,7 @@
   extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
   	/*@*/;
   /*@=redecl@*/
  +#endif
   
   /** \ingroup dbi
    * Return handle for an index database.
  @@ .
Received on Thu Jun 28 17:52:05 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.