From: Michael Tremer Date: Wed, 20 Jan 2021 21:28:52 +0000 (+0000) Subject: libpakfire: Remove LMDB X-Git-Tag: 0.9.28~1285^2~835 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ce13705bf37a5ea255b63cd378c30e9f38a3b8f;p=pakfire.git libpakfire: Remove LMDB This does not seem to be the right tool for our task Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index a48d9a10d..10df2c61c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -341,7 +341,6 @@ libpakfire_la_LIBADD = \ $(ARCHIVE_LIBS) \ $(GPGME_LIBS) \ $(LIBGCRYPT_LIBS) \ - $(LMDB_LIBS) \ $(LZMA_LIBS) \ $(SOLV_LIBS) diff --git a/configure.ac b/configure.ac index e58b78ad5..b0b5172e4 100644 --- a/configure.ac +++ b/configure.ac @@ -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])]) diff --git a/src/libpakfire/db.c b/src/libpakfire/db.c index 8ca57aefc..c052df768 100644 --- a/src/libpakfire/db.c +++ b/src/libpakfire/db.c @@ -21,8 +21,6 @@ #include #include -#include - #include #include #include @@ -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) diff --git a/src/libpakfire/include/pakfire/db.h b/src/libpakfire/include/pakfire/db.h index 95a972154..94809d974 100644 --- a/src/libpakfire/include/pakfire/db.h +++ b/src/libpakfire/include/pakfire/db.h @@ -23,15 +23,10 @@ #ifdef PAKFIRE_PRIVATE -#include - #include 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); diff --git a/src/libpakfire/pakfire.c b/src/libpakfire/pakfire.c index 6ce262f4e..2a1802121 100644 --- a/src/libpakfire/pakfire.c +++ b/src/libpakfire/pakfire.c @@ -29,8 +29,6 @@ #include #include -#include - #include #include #include @@ -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);