]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: Remove LMDB
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 20 Jan 2021 21:28:52 +0000 (21:28 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 20 Jan 2021 21:28:52 +0000 (21:28 +0000)
This does not seem to be the right tool for our task

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
configure.ac
src/libpakfire/db.c
src/libpakfire/include/pakfire/db.h
src/libpakfire/pakfire.c

index a48d9a10d77f9d16653e6e5af30e6a50234954db..10df2c61c7aaa9917a718298c99fddb1e6a629b7 100644 (file)
@@ -341,7 +341,6 @@ libpakfire_la_LIBADD = \
        $(ARCHIVE_LIBS) \
        $(GPGME_LIBS) \
        $(LIBGCRYPT_LIBS) \
-       $(LMDB_LIBS) \
        $(LZMA_LIBS) \
        $(SOLV_LIBS)
 
index e58b78ad582e191a87748be0ef2e42e0f6877490..b0b5172e4da2e75b090fbaaeac2c89ea17bea446 100644 (file)
@@ -174,7 +174,6 @@ LIBS="$save_LIBS"
 
 PKG_CHECK_MODULES([ARCHIVE], [libarchive >= 3.3.3])
 PKG_CHECK_MODULES([PYTHON_DEVEL], [python-${PYTHON_VERSION}])
-PKG_CHECK_MODULES([LMDB], [lmdb])
 PKG_CHECK_MODULES([LZMA], [liblzma])
 
 AM_PATH_LIBGCRYPT([1.8.0], [], [AC_MSG_ERROR([*** libgcrypt not found])])
index 8ca57aefcbf51f5f7158e1889c5de7e0caf25850..c052df768e50197ed4e5bbbdd17de835b9f2b056 100644 (file)
@@ -21,8 +21,6 @@
 #include <errno.h>
 #include <stdlib.h>
 
-#include <lmdb.h>
-
 #include <pakfire/db.h>
 #include <pakfire/pakfire.h>
 #include <pakfire/logging.h>
@@ -36,60 +34,6 @@ struct pakfire_db {
        int nrefs;
 };
 
-/*
-       This function initialises the database environment, but stores it in the main pakfire
-       object so that we do not have to create a circle-reference between pakfire and the
-       database object.
-*/
-int pakfire_db_env_init(Pakfire pakfire, MDB_env** env) {
-       DEBUG(pakfire, "Initialising database environment\n");
-
-       // Allocate database environment
-       int r = mdb_env_create(env);
-       if (r) {
-               ERROR(pakfire, "Could not allocate database environment\n");
-               return r;
-       }
-
-       // The database path
-       char* path = pakfire_make_path(pakfire, DATABASE_PATH);
-
-       // Open the database environment
-       r = mdb_env_open(*env, path, MDB_NOSUBDIR, 0660);
-       if (r) {
-               switch (r) {
-                       case MDB_VERSION_MISMATCH:
-                               ERROR(pakfire, "The database is of an incompatible version\n");
-                               errno = EINVAL;
-                               break;
-
-                       case MDB_INVALID:
-                               errno = EINVAL;
-                               break;
-
-                       default:
-                               ERROR(pakfire, "Could not open database %s: %s\n", path, strerror(errno));
-                               errno = r;
-               }
-
-               // Reset r to non-zero
-               r = 1;
-               goto ERROR;
-       }
-
-ERROR:
-       free(path);
-
-       return r;
-}
-
-void pakfire_db_env_free(Pakfire pakfire, MDB_env* env) {
-       DEBUG(pakfire, "Freeing database environment\n");
-
-       if (env)
-               mdb_env_close(env);
-}
-
 int pakfire_db_open(struct pakfire_db** db, Pakfire pakfire) {
        struct pakfire_db* o = pakfire_calloc(1, sizeof(*o));
        if (!o)
index 95a972154c329683346593234ca5ed7955584d0b..94809d97431032652b7b36075e32e62994287ac7 100644 (file)
 
 #ifdef PAKFIRE_PRIVATE
 
-#include <lmdb.h>
-
 #include <pakfire/types.h>
 
 struct pakfire_db;
 
-int pakfire_db_env_init(Pakfire pakfire, MDB_env** env);
-void pakfire_db_env_free(Pakfire pakfire, MDB_env* env);
-
 int pakfire_db_open(struct pakfire_db** db, Pakfire pakfire);
 
 struct pakfire_db* pakfire_db_ref(struct pakfire_db* db);
index 6ce262f4eb195c424605d2841a9ee2b54b2643f5..2a18021210828bf26ee889d6879912768ab26dd4 100644 (file)
@@ -29,8 +29,6 @@
 #include <syslog.h>
 #include <unistd.h>
 
-#include <lmdb.h>
-
 #include <solv/evr.h>
 #include <solv/pool.h>
 #include <solv/poolarch.h>
@@ -53,9 +51,6 @@ struct _Pakfire {
        char* cache_path;
        char* arch;
 
-       // Database Environment
-       MDB_env* mdb_env;
-
        // Pool stuff
        Pool* pool;
        int pool_ready;
@@ -93,9 +88,6 @@ static void _pakfire_free(Pakfire pakfire) {
 
        pakfire_repo_free_all(pakfire);
 
-       if (pakfire->mdb_env)
-               pakfire_db_env_free(pakfire, pakfire->mdb_env);
-
        if (pakfire->pool)
                pool_free(pakfire->pool);
 
@@ -169,14 +161,6 @@ PAKFIRE_EXPORT int pakfire_create(Pakfire* pakfire, const char* path, const char
                return r;
        }
 
-       // Initialise the database environment
-       r = pakfire_db_env_init(p, &p->mdb_env);
-       if (r) {
-               _pakfire_free(p);
-
-               return r;
-       }
-
        // Initialize the pool
        p->pool = pool_create();
        pool_setdisttype(p->pool, DISTTYPE_RPM);