Skip to content

Commit

Permalink
Add support for reading BDB without the library
Browse files Browse the repository at this point in the history
This commit implements a slow read-only backend that allows
accessing of BerkeleyDB databases without using the BerkeleyDB
library. The code supports btree version 9 and hash version 8
and 9.

There are two use cases for this:

1) Conversion of an existing BerkeleyDB to a different
   backend.

2) Allowing package scriptlets to do database queries while
   in a transaction that replaced rpm with a version that
   no longer links against BerkeleyDB.

Currently prefix searching is not supported (but it would be
easy to add).
  • Loading branch information
mlschroe committed Dec 19, 2019
1 parent 4a71a3e commit 97092ae
Show file tree
Hide file tree
Showing 5 changed files with 758 additions and 0 deletions.
14 changes: 14 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,20 @@ AS_IF([test "$enable_ndb" = yes],[
])
AM_CONDITIONAL([NDB], [test "$enable_ndb" = yes])

#=================
# Process --enable-bdb-ro
AC_ARG_ENABLE([bdb-ro], [AS_HELP_STRING([--enable-bdb-ro (EXPERIMENTAL)],[enable the read-only Berkeley DB code])],
[case "$enable_bdb_ro" in
yes|no) ;;
*) AC_MSG_ERROR([invalid argument to --enable-bdb-ro])
;;
esac],
[enable_bdb_ro=no])
AS_IF([test "$enable_bdb_ro" = yes],[
AC_DEFINE(WITH_BDB_RO, 1, [Build with read-only Berkeley DB])
])
AM_CONDITIONAL([BDB_RO], [test "$enable_bdb_ro" = yes])

#=================
# Check for LMDB support
AC_ARG_ENABLE([lmdb],
Expand Down
4 changes: 4 additions & 0 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ librpm_la_LIBADD += @WITH_DB_LIB@
endif
endif

if BDB_RO
librpm_la_SOURCES += backend/bdb_ro.c
endif

if NDB
librpm_la_SOURCES += \
backend/ndb/glue.c \
Expand Down

0 comments on commit 97092ae

Please sign in to comment.