From 778f4cfbb27c6e265243c933f560dc06e4203430 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Wed, 17 Dec 2008 18:06:30 +0000 Subject: [PATCH] - fix fedora builds (bnc#444211) (cmake needs to be called with -DFEDORA:=1) --- CMakeLists.txt | 6 ++++++ tools/repo_rpmdb.c | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59b9cc9..ba50426 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,13 @@ FIND_PACKAGE(EXPAT REQUIRED) FIND_PACKAGE(Check REQUIRED) FIND_PACKAGE(ZLIB REQUIRED) +IF ( FEDORA ) +MESSAGE(STATUS "Building for Fedora") +ADD_DEFINITIONS( -DFEDORA ) +FIND_LIBRARY(RPMDB_LIBRARY NAMES rpm) +ELSE ( FEDORA ) FIND_LIBRARY(RPMDB_LIBRARY NAMES rpmdb) +ENDIF ( FEDORA) SET( PACKAGE "satsolver" ) SET( VERSION "${LIBSATSOLVER_MAJOR}.${LIBSATSOLVER_MINOR}.${LIBSATSOLVER_PATCH}" ) diff --git a/tools/repo_rpmdb.c b/tools/repo_rpmdb.c index e7b4596..2b077fc 100644 --- a/tools/repo_rpmdb.c +++ b/tools/repo_rpmdb.c @@ -22,7 +22,11 @@ #include #include +#ifdef FEDORA +#include +#else #include +#endif #include "pool.h" #include "repo.h" @@ -1274,7 +1278,12 @@ repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags) exit(1); } snprintf(dbpath, PATH_MAX, "%s/var/lib/rpm", rootdir); + /* should look in /usr/lib/rpm/macros instead, but we want speed... */ +#ifdef FEDORA + if (dbenv->open(dbenv, dbpath, DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL, 0)) +#else if (dbenv->open(dbenv, dbpath, DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0)) +#endif { perror("dbenv open"); exit(1); -- 2.7.4