Skip to content
Permalink
Browse files

Add experimental ndb database support

Use --enable-ndb for testing. Handle with care.
  • Loading branch information...
mlschroe committed Jul 16, 2015
1 parent 1defb7e commit b50d2adb3b3a27f1c67a711a80f998c0fbde9cce
@@ -396,6 +396,20 @@ esac

AC_SUBST([WITH_DB_LIB])

#=================
# Process --enable-ndb
AC_ARG_ENABLE([ndb], [AS_HELP_STRING([--enable-ndb],[enable the new rpm database format])],
[case "$enable_ndb" in
yes|no) ;;
*) AC_MSG_ERROR([invalid argument to --enable-ndb])
;;
esac],
[enable_ndb=no])
AS_IF([test "$enable_ndb" = yes],[
AC_DEFINE(ENABLE_NDB, 1, [Enable new rpm database format?])
])
AM_CONDITIONAL([NDB], [test "$enable_ndb" = yes])

AM_GNU_GETTEXT_VERSION([0.16.1])
AM_GNU_GETTEXT([external])
AM_ICONV
@@ -61,6 +61,14 @@ else
librpm_la_LIBADD += @WITH_DB_LIB@
endif

if NDB
librpm_la_SOURCES += \
backend/ndb/glue.c \
backend/ndb/rpmpkg.c \
backend/ndb/rpmidx.c \
backend/ndb/rpmxdb.c
endif

tagtbl.C: Makefile.am $(srcdir)/rpmtag.h gentagtbl.sh
@AWK=${AWK} ${SHELL} $(srcdir)/gentagtbl.sh \
$(srcdir)/rpmtag.h > $@.new && \
@@ -6,6 +6,7 @@

#include <stdlib.h>
#include <rpm/rpmtypes.h>
#include <rpm/rpmstring.h>
#include "lib/rpmdb_internal.h"
#include "debug.h"

@@ -32,7 +33,16 @@ dbiIndex dbiNew(rpmdb rdb, rpmDbiTagVal rpmtag)
static void
dbDetectBackend(rpmdb rdb)
{
#ifdef ENABLE_NDB
const char *dbhome = rpmdbHome(rdb);
char *path = rstrscat(NULL, dbhome, "/Packages", NULL);
rdb->db_ops = &ndb_dbops;
if (access(path, F_OK) == 0)
rdb->db_ops = &db3_dbops;
free(path);
#else
rdb->db_ops = &db3_dbops;
#endif
}

const char * dbiName(dbiIndex dbi)
@@ -240,6 +240,11 @@ struct rpmdbOps_s {
RPM_GNUC_INTERNAL
extern struct rpmdbOps_s db3_dbops;

#ifdef ENABLE_NDB
RPM_GNUC_INTERNAL
extern struct rpmdbOps_s ndb_dbops;
#endif

#ifdef __cplusplus
}
#endif

0 comments on commit b50d2ad

Please sign in to comment.
You can’t perform that action at this time.