- add cmake options to only build for some repository types
authorMichael Schroeder <mls@suse.de>
Wed, 18 Jan 2012 14:39:31 +0000 (15:39 +0100)
committerMichael Schroeder <mls@suse.de>
Wed, 18 Jan 2012 14:45:02 +0000 (15:45 +0100)
CMakeLists.txt
bindings/solv.i
examples/solv.c
ext/CMakeLists.txt
tools/CMakeLists.txt
tools/installcheck.c
tools/patchcheck.c

index 11a2819..a62988f 100644 (file)
@@ -11,6 +11,12 @@ OPTION (ENABLE_RUBY "Build the ruby bindings?" OFF)
 
 OPTION (USE_VENDORDIRS "Install the bindings in vendor directories?" OFF)
 
+OPTION (ENABLE_RPMDB "Build with rpm database support?" OFF)
+OPTION (ENABLE_RPMMD "Build with rpmmd repository support?" OFF)
+OPTION (ENABLE_SUSEREPO "Build with suse repository support?" OFF)
+OPTION (ENABLE_HELIXREPO "Build with helix repository support?" OFF)
+OPTION (ENABLE_DEBIAN "Build with debian database/repository support?" OFF)
+
 #IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERISION} GREATER 2.4)
 #ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERISION} GREATER 2.4)
 
@@ -47,54 +53,70 @@ FIND_PACKAGE (ZLIB REQUIRED)
 IF (FEDORA)
 MESSAGE(STATUS "Building for Fedora")
 ADD_DEFINITIONS (-DFEDORA)
+SET (ENABLE_RPMDB ON)
+SET (ENABLE_RPMMD ON)
 ENDIF (FEDORA)
 
 IF (DEBIAN)
 MESSAGE (STATUS "Building for Debian")
 ADD_DEFINITIONS (-DDEBIAN -DDEBIAN_SEMANTICS)
+SET (ENABLE_DEBIAN ON)
 ENDIF (DEBIAN)
 
-IF (MULTI_SEMANTICS)
-MESSAGE (STATUS "Enabling multi dist support")
-ADD_DEFINITIONS (-DMULTI_SEMANTICS)
-ENDIF (MULTI_SEMANTICS)
-
 IF (RPM5)
 MESSAGE (STATUS "Enabling RPM 5 support")
 ADD_DEFINITIONS (-DRPM5)
+SET (ENABLE_RPMDB ON)
+SET (ENABLE_RPMMD ON)
 FIND_PACKAGE (PkgConfig REQUIRED)
 PKG_CHECK_MODULES (RPM REQUIRED rpm)
 INCLUDE_DIRECTORIES (${RPM_INCLUDE_DIRS})
 ENDIF (RPM5)
 
+IF (MULTI_SEMANTICS)
+MESSAGE (STATUS "Enabling multi dist support")
+ADD_DEFINITIONS (-DMULTI_SEMANTICS)
+ENDIF (MULTI_SEMANTICS)
 
-IF (RPM5 OR NOT DEBIAN)
-FIND_LIBRARY (RPMDB_LIBRARY NAMES rpmdb)
-
-IF (NOT RPMDB_LIBRARY)
-FIND_LIBRARY (RPMDB_LIBRARY NAMES rpm)
-ENDIF (NOT RPMDB_LIBRARY)
-
-FIND_LIBRARY (RPMIO_LIBRARY NAMES rpmio)
-IF (RPMIO_LIBRARY)
-SET(RPMDB_LIBRARY ${RPMIO_LIBRARY} ${RPMDB_LIBRARY})
-ENDIF (RPMIO_LIBRARY)
-
-IF (RPM5)
-FIND_LIBRARY (RPMMISC_LIBRARY NAMES rpmmisc)
-IF (RPMMISC_LIBRARY)
-SET (RPMDB_LIBRARY ${RPMMISC_LIBRARY} ${RPMDB_LIBRARY})
-ENDIF (RPMMISC_LIBRARY)
-ENDIF (RPM5)
-
-IF (RPM5 OR FEDORA)
-FIND_LIBRARY (DB_LIBRARY NAMES db)
-IF (DB_LIBRARY)
-SET (RPMDB_LIBRARY ${DB_LIBRARY} ${RPMDB_LIBRARY})
-ENDIF (DB_LIBRARY)
-ENDIF (RPM5 OR FEDORA)
-
-ENDIF (RPM5 OR NOT DEBIAN)
+# compat: enable some database types
+IF (NOT ENABLE_RPMDB AND
+    NOT ENABLE_RPMMD AND
+    NOT ENABLE_SUSEREPO AND
+    NOT ENABLE_HELIXREPO AND
+    NOT ENABLE_DEBIAN)
+    SET (ENABLE_RPMDB ON)
+    SET (ENABLE_RPMMD ON)
+    SET (ENABLE_SUSEREPO ON)
+    SET (ENABLE_HELIXREPO ON)
+    SET (ENABLE_DEBIAN ON)
+ENDIF ()
+
+IF (ENABLE_RPMDB)
+  FIND_LIBRARY (RPMDB_LIBRARY NAMES rpmdb)
+
+  IF (NOT RPMDB_LIBRARY)
+    FIND_LIBRARY (RPMDB_LIBRARY NAMES rpm)
+  ENDIF (NOT RPMDB_LIBRARY)
+
+  FIND_LIBRARY (RPMIO_LIBRARY NAMES rpmio)
+  IF (RPMIO_LIBRARY)
+    SET(RPMDB_LIBRARY ${RPMIO_LIBRARY} ${RPMDB_LIBRARY})
+  ENDIF (RPMIO_LIBRARY)
+
+  IF (RPM5)
+    FIND_LIBRARY (RPMMISC_LIBRARY NAMES rpmmisc)
+    IF (RPMMISC_LIBRARY)
+      SET (RPMDB_LIBRARY ${RPMMISC_LIBRARY} ${RPMDB_LIBRARY})
+    ENDIF (RPMMISC_LIBRARY)
+  ENDIF (RPM5)
+
+  IF (RPM5 OR FEDORA)
+    FIND_LIBRARY (DB_LIBRARY NAMES db)
+    IF (DB_LIBRARY)
+      SET (RPMDB_LIBRARY ${DB_LIBRARY} ${RPMDB_LIBRARY})
+    ENDIF (DB_LIBRARY)
+  ENDIF (RPM5 OR FEDORA)
+ENDIF (ENABLE_RPMDB)
 
 INCLUDE (CheckFunctionExists)
 INCLUDE (TestBigEndian)
@@ -105,7 +127,8 @@ CHECK_FUNCTION_EXISTS (funopen HAVE_FUNOPEN)
 TEST_BIG_ENDIAN (WORDS_BIGENDIAN)
 
 # should create config.h with #cmakedefine instead...
-FOREACH (VAR HAVE_STRCHRNUL HAVE_FOPENCOOKIE HAVE_FUNOPEN WORDS_BIGENDIAN)
+FOREACH (VAR HAVE_STRCHRNUL HAVE_FOPENCOOKIE HAVE_FUNOPEN WORDS_BIGENDIAN
+  ENABLE_RPMDB ENABLE_RPMMD ENABLE_SUSEREPO ENABLE_HELIXREPO ENABLE_DEBIAN)
   IF(${VAR})
     ADD_DEFINITIONS (-D${VAR}=1)
   ENDIF (${VAR})
index 768c50b..ba926fa 100644 (file)
@@ -344,18 +344,24 @@ typedef VALUE AppObjectPtr;
 #include "repo_solv.h"
 #include "chksum.h"
 
-#ifndef DEBIAN
+#include "repo_write.h"
+#ifdef ENABLE_RPMDB
 #include "repo_rpmdb.h"
 #endif
+#ifdef ENABLE_DEBIAN
 #include "repo_deb.h"
+#endif
+#ifdef ENABLE_RPMMD
 #include "repo_rpmmd.h"
-#include "repo_write.h"
-#include "repo_products.h"
-#include "repo_susetags.h"
 #include "repo_updateinfoxml.h"
 #include "repo_deltainfoxml.h"
 #include "repo_repomdxml.h"
+#endif
+#ifdef ENABLE_SUSEREPO
+#include "repo_products.h"
+#include "repo_susetags.h"
 #include "repo_content.h"
+#endif
 #include "solv_xfopen.h"
 
 #define true 1
@@ -1065,7 +1071,9 @@ typedef struct {
   static const int REPO_USE_LOADING = REPO_USE_LOADING;
   static const int REPO_EXTEND_SOLVABLES = REPO_EXTEND_SOLVABLES;
   static const int SOLV_ADD_NO_STUBS = SOLV_ADD_NO_STUBS;       /* repo_solv */
+#ifdef ENABLE_SUSETAGS
   static const int SUSETAGS_RECORD_SHARES = SUSETAGS_RECORD_SHARES;     /* repo_susetags */
+#endif
 
   void free(bool reuseids = 0) {
     repo_free($self, reuseids);
@@ -1097,23 +1105,34 @@ typedef struct {
     return new_XSolvable($self->pool, solvid);
   }
 
-  bool add_products(const char *proddir, int flags = 0) {
-    repo_add_products($self, proddir, 0, flags);
+#ifdef ENABLE_RPMDB
+  bool add_rpmdb(Repo *ref, int flags = 0) {
+    repo_add_rpmdb($self, ref, 0, flags);
     return 1;
   }
+  Id add_rpm(const char *name, int flags = 0) {
+    return repo_add_rpm($self, name, flags);
+  }
+#endif
+#ifdef ENABLE_RPMMD
   bool add_rpmmd(FILE *fp, const char *language, int flags = 0) {
     repo_add_rpmmd($self, fp, language, flags);
     return 1;
   }
-#ifndef DEBIAN
-  bool add_rpmdb(Repo *ref, int flags = 0) {
-    repo_add_rpmdb($self, ref, 0, flags);
+  bool add_repomdxml(FILE *fp, int flags = 0) {
+    repo_add_repomdxml($self, fp, flags);
     return 1;
   }
-  Id add_rpm(const char *name, int flags = 0) {
-    return repo_add_rpm($self, name, flags);
+  bool add_updateinfoxml(FILE *fp, int flags = 0) {
+    repo_add_updateinfoxml($self, fp, flags);
+    return 1;
+  }
+  bool add_deltainfoxml(FILE *fp, int flags = 0) {
+    repo_add_deltainfoxml($self, fp, flags);
+    return 1;
   }
 #endif
+#ifdef ENABLE_DEBIAN
   bool add_debdb(int flags = 0) {
     repo_add_debdb($self, 0, flags);
     return 1;
@@ -1121,26 +1140,21 @@ typedef struct {
   Id add_deb(const char *name, int flags = 0) {
     return repo_add_deb($self, name, flags);
   }
+#endif
+#ifdef ENABLE_SUSEREPO
   bool add_susetags(FILE *fp, Id defvendor, const char *language, int flags = 0) {
     repo_add_susetags($self, fp, defvendor, language, flags);
     return 1;
   }
-  bool add_repomdxml(FILE *fp, int flags = 0) {
-    repo_add_repomdxml($self, fp, flags);
-    return 1;
-  }
   bool add_content(FILE *fp, int flags = 0) {
     repo_add_content($self, fp, flags);
     return 1;
   }
-  bool add_updateinfoxml(FILE *fp, int flags = 0) {
-    repo_add_updateinfoxml($self, fp, flags);
-    return 1;
-  }
-  bool add_deltainfoxml(FILE *fp, int flags = 0) {
-    repo_add_deltainfoxml($self, fp, flags);
+  bool add_products(const char *proddir, int flags = 0) {
+    repo_add_products($self, proddir, 0, flags);
     return 1;
   }
+#endif
   void internalize() {
     repo_internalize($self);
   }
index 753519d..7ba2749 100644 (file)
 #include "repo_solv.h"
 
 #include "repo_write.h"
-#ifndef DEBIAN
+#ifdef ENABLE_RPMDB
 #include "repo_rpmdb.h"
-#else
+#include "pool_fileconflicts.h"
+#endif
+#ifdef ENABLE_DEBIAN
 #include "repo_deb.h"
 #endif
-#include "repo_products.h"
+#ifdef ENABLE_RPMMD
 #include "repo_rpmmd.h"
-#include "repo_susetags.h"
 #include "repo_repomdxml.h"
 #include "repo_updateinfoxml.h"
 #include "repo_deltainfoxml.h"
+#endif
+#ifdef ENABLE_SUSEREPO
+#include "repo_products.h"
+#include "repo_susetags.h"
 #include "repo_content.h"
-#include "pool_fileconflicts.h"
+#endif
 #include "solv_xfopen.h"
 
 #ifdef FEDORA
@@ -1201,7 +1206,7 @@ static Pool *
 read_sigs()
 {
   Pool *sigpool = pool_create();
-#ifndef DEBIAN
+#ifdef ENABLE_RPMDB
   Repo *repo = repo_create(sigpool, "rpmdbkeys");
   repo_add_rpmdb_pubkeys(repo, 0, 0);
 #endif
@@ -1209,6 +1214,7 @@ read_sigs()
 }
 
 
+#ifdef ENABLE_RPMMD
 /* repomd helpers */
 
 static inline const char *
@@ -1311,7 +1317,10 @@ repomd_load_ext(Repo *repo, Repodata *data)
   return 1;
 }
 
+#endif
+
 
+#ifdef ENABLE_SUSEREPO
 /* susetags helpers */
 
 static inline const char *
@@ -1448,6 +1457,7 @@ susetags_load_ext(Repo *repo, Repodata *data)
   writecachedrepo(repo, data, ext, cinfo->extcookie);
   return 1;
 }
+#endif
 
 
 
@@ -1457,16 +1467,20 @@ int
 load_stub(Pool *pool, Repodata *data, void *dp)
 {
   struct repoinfo *cinfo = data->repo->appdata;
+#ifdef ENABLE_SUSEREPO
   if (cinfo->type == TYPE_SUSETAGS)
     return susetags_load_ext(data->repo, data);
+#endif
+#ifdef ENABLE_RPMMD
   if (cinfo->type == TYPE_RPMMD)
     return repomd_load_ext(data->repo, data);
+#endif
   return 0;
 }
 
 static unsigned char installedcookie[32];
 
-#ifdef DEBIAN
+#ifdef ENABLE_DEBIAN
 
 const char *
 debian_find_component(struct repoinfo *cinfo, FILE *fp, char *comp, const unsigned char **chksump, Id *chksumtypep)
@@ -1562,7 +1576,7 @@ debian_find_component(struct repoinfo *cinfo, FILE *fp, char *comp, const unsign
          curl = solv_chksum_len(curchksumtype);
          if (!curl || (chksumtype && solv_chksum_len(chksumtype) > curl))
            continue;
-          if (solv_hex2bin(&ch, curchksum, sizeof(curchksum)) != curl)
+          if (solv_hex2bin((const char **)&ch, curchksum, sizeof(curchksum)) != curl)
            continue;
          solv_free(filename);
          filename = strdup(fn);
@@ -1604,17 +1618,18 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos)
   Repodata *data;
   int badchecksum;
   int dorefresh;
-#ifdef DEBIAN
+#if defined(ENABLE_DEBIAN) && defined(DEBIAN)
   FILE *fpr;
   int j;
 #endif
 
   repo = repo_create(pool, "@System");
-#ifndef DEBIAN
+#if defined(ENABLE_RPMDB) && !defined(DEBIAN)
   printf("rpm database:");
   if (stat("/var/lib/rpm/Packages", &stb))
     memset(&stb, 0, sizeof(&stb));
-#else
+#endif
+#if defined(ENABLE_DEBIAN) && defined(DEBIAN)
   printf("dpgk database:");
   if (stat("/var/lib/dpkg/status", &stb))
     memset(&stb, 0, sizeof(&stb));
@@ -1624,16 +1639,16 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos)
     printf(" cached\n");
   else
     {
-#ifndef DEBIAN
+#if defined(ENABLE_RPMDB) && !defined(DEBIAN)
       FILE *ofp;
       int done = 0;
 #endif
       printf(" reading\n");
 
-#ifdef PRODUCTS_PATH
+#if defined(ENABLE_SUSEREPO) && defined(PRODUCTS_PATH)
       repo_add_products(repo, PRODUCTS_PATH, 0, REPO_NO_INTERNALIZE);
 #endif
-#ifndef DEBIAN
+#if defined(ENABLE_RPMDB) && !defined(DEBIAN)
       if ((ofp = fopen(calccachepath(repo, 0), "r")) != 0)
        {
          Repo *ref = repo_create(pool, "@System.old");
@@ -1648,7 +1663,9 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos)
       if (!done)
         repo_add_rpmdb(repo, 0, 0, REPO_REUSE_REPODATA);
 #else
+# if defined(ENABLE_DEBIAN) && defined(DEBIAN)
         repo_add_debdb(repo, 0, REPO_REUSE_REPODATA);
+# endif
 #endif
       writecachedrepo(repo, 0, 0, installedcookie);
     }
@@ -1680,6 +1697,7 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos)
       badchecksum = 0;
       switch (cinfo->type)
        {
+#ifdef ENABLE_RPMMD
         case TYPE_RPMMD:
          printf("rpmmd repo '%s':", cinfo->alias);
          fflush(stdout);
@@ -1745,7 +1763,9 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos)
            writecachedrepo(repo, 0, 0, cinfo->cookie);
          repodata_create_stubs(repo_last_repodata(repo));
          break;
+#endif
 
+#ifdef ENABLE_SUSEREPO
         case TYPE_SUSETAGS:
          printf("susetags repo '%s':", cinfo->alias);
          fflush(stdout);
@@ -1827,8 +1847,9 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos)
            writecachedrepo(repo, 0, 0, cinfo->cookie);
          repodata_create_stubs(repo_last_repodata(repo));
          break;
+#endif
 
-#ifdef DEBIAN
+#if defined(ENABLE_DEBIAN) && defined(DEBIAN)
         case TYPE_DEBIAN:
          printf("debian repo '%s':", cinfo->alias);
          fflush(stdout);
@@ -2263,7 +2284,7 @@ yesno(const char *str)
     }
 }
 
-#ifndef DEBIAN
+#if defined(ENABLE_RPMDB) && !defined(DEBIAN)
 
 struct fcstate {
   FILE **newpkgsfps;
@@ -2347,7 +2368,7 @@ runrpm(const char *arg, const char *name, int dupfd3)
 
 #endif
 
-#ifdef DEBIAN
+#if defined(ENABLE_DEBIAN) && defined(DEBIAN)
 
 void
 rundpkg(const char *arg, const char *name, int dupfd3)
@@ -2791,11 +2812,18 @@ main(int argc, char **argv)
            commandlinepkgs = solv_calloc(argc, sizeof(Id));
          if (!commandlinerepo)
            commandlinerepo = repo_create(pool, "@commandline");
-#ifndef DEBIAN
+         p = 0;
+#if defined(ENABLE_RPMDB) && !defined(DEBIAN)
          p = repo_add_rpm(commandlinerepo, (const char *)argv[i], REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE);
-#else
+#endif
+#if defined(ENABLE_DEBIAN) && defined(DEBIAN)
          p = repo_add_deb(commandlinerepo, (const char *)argv[i], REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE);
 #endif
+         if (!p)
+           {
+             fprintf(stderr, "could not add '%s'\n", argv[i]);
+             exit(1);
+           }
          commandlinepkgs[i] = p;
        }
       if (commandlinerepo)
@@ -2948,7 +2976,7 @@ main(int argc, char **argv)
   addsoftlocks(pool, &job);
 #endif
 
-#ifndef DEBIAN
+#if defined(ENABLE_RPMDB) && !defined(DEBIAN)
 rerunsolver:
 #endif
   for (;;)
@@ -3228,7 +3256,7 @@ rerunsolver:
       putchar('\n');
     }
 
-#ifndef DEBIAN
+#if defined(ENABLE_RPMDB) && !defined(DEBIAN)
   if (newpkgs)
     {
       Queue conflicts;
@@ -3267,7 +3295,7 @@ rerunsolver:
   transaction_order(trans, 0);
   for (i = 0; i < trans->steps.count; i++)
     {
-#ifndef DEBIAN
+#if defined(ENABLE_RPMDB) && !defined(DEBIAN)
       const char *evr, *evrp, *nvra;
 #endif
       Solvable *s;
@@ -3281,7 +3309,7 @@ rerunsolver:
        {
        case SOLVER_TRANSACTION_ERASE:
          printf("erase %s\n", pool_solvid2str(pool, p));
-#ifndef DEBIAN
+#if defined(ENABLE_RPMDB) && !defined(DEBIAN)
          if (!s->repo->rpmdbid || !s->repo->rpmdbid[p - s->repo->start])
            continue;
          /* strip epoch from evr */
@@ -3293,7 +3321,8 @@ rerunsolver:
          nvra = pool_tmpjoin(pool, pool_id2str(pool, s->name), "-", evr);
          nvra = pool_tmpappend(pool, nvra, ".", pool_id2str(pool, s->arch));
          runrpm("-e", nvra, -1);       /* too bad that --querybynumber doesn't work */
-#else
+#endif
+#if defined(ENABLE_DEBIAN) && defined(DEBIAN)
          rundpkg("--remove", pool_id2str(pool, s->name), 0);
 #endif
          break;
@@ -3308,9 +3337,10 @@ rerunsolver:
            continue;
          rewind(fp);
          lseek(fileno(fp), 0, SEEK_SET);
-#ifndef DEBIAN
+#if defined(ENABLE_RPMDB) && !defined(DEBIAN)
          runrpm(type == SOLVER_TRANSACTION_MULTIINSTALL ? "-i" : "-U", "/dev/fd/3", fileno(fp));
-#else
+#endif
+#if defined(ENABLE_DEBIAN) && defined(DEBIAN)
          rundpkg("--install", "/dev/fd/3", fileno(fp));
 #endif
          fclose(fp);
index a058188..b88b7b2 100644 (file)
@@ -1,18 +1,47 @@
 SET (libsolvext_SRCS
-    repo_content.c repo_deltainfoxml.c repo_helix.c repo_products.c
-    repo_releasefile_products.c repo_repomdxml.c repo_rpmmd.c
-    repo_susetags.c repo_updateinfoxml.c repo_write.c repo_zyppdb.c
-    repo_deb.c solv_xfopen.c)
-IF (NOT DEBIAN)
-SET (libsolvext_SRCS ${libsolvext_SRCS}
-    pool_fileconflicts.c repo_rpmdb.c)
-ENDIF (NOT DEBIAN)
+    repo_write.c solv_xfopen.c)
 
 SET (libsolvext_HEADERS
-    pool_fileconflicts.h repo_content.h repo_deltainfoxml.h repo_helix.h repo_products.h
-    repo_releasefile_products.h repo_repomdxml.h repo_rpmdb.h repo_rpmmd.h
-    repo_susetags.h repo_updateinfoxml.h repo_write.h repo_zyppdb.h
-    tools_util.h repo_deb.h solv_xfopen.h)
+    repo_write.h tools_util.h solv_xfopen.h)
+
+IF (ENABLE_RPMDB)
+    SET (libsolvext_SRCS ${libsolvext_SRCS}
+        pool_fileconflicts.c repo_rpmdb.c)
+    SET (libsolvext_HEADERS ${libsolvext_HEADERS}
+        pool_fileconflicts.h repo_rpmdb.h)
+ENDIF (ENABLE_RPMDB)
+
+IF (ENABLE_RPMMD)
+    SET (libsolvext_SRCS ${libsolvext_SRCS}
+       repo_repomdxml.c repo_rpmmd.c
+       repo_deltainfoxml.c repo_updateinfoxml.c)
+    SET (libsolvext_HEADERS ${libsolvext_HEADERS}
+       repo_repomdxml.h repo_rpmmd.h
+       repo_deltainfoxml.h repo_updateinfoxml.h)
+ENDIF (ENABLE_RPMMD)
+
+IF (ENABLE_SUSEREPO)
+    SET (libsolvext_SRCS ${libsolvext_SRCS}
+       repo_content.c repo_products.c repo_releasefile_products.c
+       repo_susetags.c repo_zyppdb.c)
+    SET (libsolvext_HEADERS ${libsolvext_HEADERS}
+       repo_content.h repo_products.h repo_releasefile_products.h
+       repo_susetags.h repo_zyppdb.h)
+ENDIF (ENABLE_SUSEREPO)
+
+IF (ENABLE_DEBIAN)
+    SET (libsolvext_SRCS ${libsolvext_SRCS}
+       repo_deb.c)
+    SET (libsolvext_HEADERS ${libsolvext_HEADERS}
+       repo_deb.h)
+ENDIF (ENABLE_DEBIAN)
+       
+IF (ENABLE_HELIXREPO)
+    SET (libsolvext_SRCS ${libsolvext_SRCS}
+       repo_helix.c)
+    SET (libsolvext_HEADERS ${libsolvext_HEADERS}
+       repo_helix.h)
+ENDIF (ENABLE_HELIXREPO)
 
 SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
 SET (CMAKE_SHARED_LINKER_FLAGS "${LINK_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/ext/libsolvext.ver")
index d225d0d..e2d9a94 100644 (file)
@@ -6,11 +6,13 @@ ADD_LIBRARY (toolstuff STATIC common_write.c)
 
 # as we link with --as-needed we do not get bogus dependencies
 SET (SYSTEM_LIBRARIES ${EXPAT_LIBRARY} ${ZLIB_LIBRARY})
-IF (NOT DEBIAN)
+IF (ENABLE_RPMDB)
 SET (SYSTEM_LIBRARIES ${RPMDB_LIBRARY} ${SYSTEM_LIBRARIES})
-ENDIF (NOT DEBIAN)
+ENDIF (ENABLE_RPMDB)
 
-IF (NOT DEBIAN)
+SET (tools_list mergesolv dumpsolv installcheck)
+
+IF (ENABLE_RPMDB)
 ADD_EXECUTABLE (rpmdb2solv rpmdb2solv.c)
 TARGET_LINK_LIBRARIES (rpmdb2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
 
@@ -19,16 +21,16 @@ TARGET_LINK_LIBRARIES (rpms2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES
 
 ADD_EXECUTABLE (findfileconflicts findfileconflicts.c)
 TARGET_LINK_LIBRARIES (findfileconflicts libsolvext libsolv ${SYSTEM_LIBRARIES})
-ENDIF (NOT DEBIAN)
 
-ADD_EXECUTABLE (rpmmd2solv rpmmd2solv.c)
-TARGET_LINK_LIBRARIES (rpmmd2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
+SET (tools_list ${tools_list} rpmdb2solv rpms2solv)
+ENDIF (ENABLE_RPMDB)
 
-ADD_EXECUTABLE (helix2solv helix2solv.c)
-TARGET_LINK_LIBRARIES (helix2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
+IF (ENABLE_RPMMD)
+ADD_EXECUTABLE (repomdxml2solv repomdxml2solv.c)
+TARGET_LINK_LIBRARIES (repomdxml2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
 
-ADD_EXECUTABLE (susetags2solv susetags2solv.c)
-TARGET_LINK_LIBRARIES (susetags2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
+ADD_EXECUTABLE (rpmmd2solv rpmmd2solv.c)
+TARGET_LINK_LIBRARIES (rpmmd2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
 
 ADD_EXECUTABLE (updateinfoxml2solv updateinfoxml2solv.c)
 TARGET_LINK_LIBRARIES (updateinfoxml2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
@@ -36,8 +38,22 @@ TARGET_LINK_LIBRARIES (updateinfoxml2solv toolstuff libsolvext libsolv ${SYSTEM_
 ADD_EXECUTABLE (deltainfoxml2solv deltainfoxml2solv.c)
 TARGET_LINK_LIBRARIES (deltainfoxml2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
 
-ADD_EXECUTABLE (repomdxml2solv repomdxml2solv.c)
-TARGET_LINK_LIBRARIES (repomdxml2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
+SET (tools_list ${tools_list} repomdxml2solv rpmmd2solv updateinfoxml2solv deltainfoxml2solv)
+ENDIF (ENABLE_RPMMD)
+
+IF (ENABLE_HELIXREPO)
+ADD_EXECUTABLE (helix2solv helix2solv.c)
+TARGET_LINK_LIBRARIES (helix2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
+
+SET (tools_list ${tools_list} helix2solv)
+ENDIF (ENABLE_HELIXREPO)
+
+IF (ENABLE_SUSEREPO)
+ADD_EXECUTABLE (susetags2solv susetags2solv.c)
+TARGET_LINK_LIBRARIES (susetags2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
+
+SET (tools_list ${tools_list} susetags2solv)
+ENDIF (ENABLE_SUSEREPO)
 
 ADD_EXECUTABLE (installcheck installcheck.c)
 TARGET_LINK_LIBRARIES (installcheck libsolvext libsolv ${SYSTEM_LIBRARIES})
@@ -51,25 +67,6 @@ TARGET_LINK_LIBRARIES (dumpsolv libsolv)
 ADD_EXECUTABLE (mergesolv mergesolv.c )
 TARGET_LINK_LIBRARIES (mergesolv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
 
-INSTALL (TARGETS
-    mergesolv
-    dumpsolv
-    susetags2solv
-    helix2solv
-    rpmmd2solv
-    updateinfoxml2solv
-    deltainfoxml2solv
-    repomdxml2solv
-    installcheck
-    DESTINATION ${BIN_INSTALL_DIR})
-
-IF (NOT DEBIAN)
-INSTALL (TARGETS
-    rpmdb2solv
-    rpms2solv
-    DESTINATION ${BIN_INSTALL_DIR})
-ENDIF (NOT DEBIAN)
-
-INSTALL (PROGRAMS
-   repo2solv.sh
-   DESTINATION ${BIN_INSTALL_DIR})
+INSTALL (TARGETS ${tools_list} DESTINATION ${BIN_INSTALL_DIR})
+
+INSTALL (PROGRAMS repo2solv.sh DESTINATION ${BIN_INSTALL_DIR})
index 8e1dc09..9658654 100644 (file)
 #include "pool.h"
 #include "poolarch.h"
 #include "repo_solv.h"
-#ifndef DEBIAN
+#ifdef ENABLE_SUSEREPO
 #include "repo_susetags.h"
+#endif
+#ifdef ENABLE_RPMMD
 #include "repo_rpmmd.h"
-#else
+#endif
+#ifdef ENABLE_DEBIAN
 #include "repo_deb.h"
 #endif
 #include "solver.h"
@@ -112,8 +115,11 @@ main(int argc, char **argv)
          exit(1);
        }
       repo = repo_create(pool, argv[i]);
-#ifndef DEBIAN
-      if (l >= 8 && !strcmp(argv[i] + l - 8, "packages"))
+      if (0)
+        {
+        }
+#ifdef ENABLE_SUSEREPO
+      else if (l >= 8 && !strcmp(argv[i] + l - 8, "packages"))
        {
          repo_add_susetags(repo, fp, 0, 0, 0);
        }
@@ -121,12 +127,15 @@ main(int argc, char **argv)
        {
          repo_add_susetags(repo, fp, 0, 0, 0);
        }
+#endif
+#ifdef ENABLE_RPMMD
       else if (l >= 14 && !strcmp(argv[i] + l - 14, "primary.xml.gz"))
        {
          repo_add_rpmmd(repo, fp, 0, 0);
        }
-#else
-      if (l >= 8 && !strcmp(argv[i] + l - 8, "Packages"))
+#endif
+#ifdef ENABLE_DEBIAN
+      else if (l >= 8 && !strcmp(argv[i] + l - 8, "Packages"))
        {
          repo_add_debpackages(repo, fp, 0);
        }
index 9ffdcb6..6e3d82f 100644 (file)
 #include "evr.h"
 #include "poolarch.h"
 #include "repo_solv.h"
+#ifdef ENABLE_SUSEREPO
 #include "repo_susetags.h"
+#endif
+#ifdef ENABLE_RPMMD
 #include "repo_updateinfoxml.h"
 #include "repo_rpmmd.h"
+#endif
 #include "solver.h"
 #include "solverdebug.h"
 
@@ -532,7 +536,11 @@ main(int argc, char **argv)
           perror(argv[i]);
           exit(1);
         }
-      if (l >= 8 && !strcmp(argv[i] + l - 8, "packages"))
+      if (0)
+       {
+       }
+#ifdef ENABLE_SUSEREPO
+      else if (l >= 8 && !strcmp(argv[i] + l - 8, "packages"))
         {
           repo_add_susetags(c.repo, fp, 0, 0, 0);
         }
@@ -540,6 +548,8 @@ main(int argc, char **argv)
         {
           repo_add_susetags(c.repo, fp, 0, 0, 0);
         }
+#endif
+#ifdef ENABLE_RPMMD
       else if (l >= 14 && !strcmp(argv[i] + l - 14, "primary.xml.gz"))
         {
           repo_add_rpmmd(c.repo, fp, 0, 0);
@@ -548,6 +558,7 @@ main(int argc, char **argv)
        {
           repo_add_updateinfoxml(c.repo, fp, 0);
        }
+#endif
       else if (repo_add_solv(c.repo, fp))
         {
           fprintf(stderr, "could not add repo %s\n", argv[i]);