Imported Upstream version 0.7.27
[platform/upstream/libsolv.git] / examples / solv / repoinfo.c
index e08d160..f7c3346 100644 (file)
 #if defined(ENABLE_DEBIAN) && defined(DEBIAN)
 #include "repo_deb.h"
 #endif
+#ifdef SUSE
+#include "repo_autopattern.h"
+#endif
+
 
 #include "repoinfo.h"
 #include "repoinfo_cache.h"
 
-#if defined(SUSE) || defined(FEDORA)
+#if defined(SUSE) || defined(FEDORA) || defined(MAGEIA)
 #include "repoinfo_config_yum.h"
 #endif
 #if defined(DEBIAN)
 #include "repoinfo_config_debian.h"
 #endif
-#if defined(MANDRIVA) || defined(MAGEIA)
+#if defined(MANDRIVA)
 #include "repoinfo_config_urpmi.h"
 #endif
 
@@ -43,6 +47,7 @@
 #ifdef ENABLE_MDKREPO
 #include "repoinfo_type_mdk.h"
 #endif
+#include "repoinfo_type_plaindir.h"
 
 static int
 repoinfos_sort_cmp(const void *ap, const void *bp)
@@ -76,7 +81,7 @@ free_repoinfos(struct repoinfo *repoinfos, int nrepoinfos)
       solv_free(cinfo->components);
     }
   solv_free(repoinfos);
-#if defined(SUSE) || defined(FEDORA)
+#if defined(SUSE) || defined(FEDORA) || defined(MAGEIA)
   yum_substitute((Pool *)0, 0);                /* free data */
 #endif
 }
@@ -85,10 +90,10 @@ struct repoinfo *
 read_repoinfos(Pool *pool, int *nrepoinfosp)
 {
   struct repoinfo *repoinfos = 0;
-#if defined(SUSE) || defined(FEDORA)
+#if defined(SUSE) || defined(FEDORA) || defined(MAGEIA)
   repoinfos = read_repoinfos_yum(pool, nrepoinfosp);
 #endif
-#if defined(MANDRIVA) || defined(MAGEIA)
+#if defined(MANDRIVA)
   repoinfos = read_repoinfos_urpmi(pool, nrepoinfosp);
 #endif
 #if defined(DEBIAN)
@@ -110,6 +115,9 @@ read_installed_repo(struct repoinfo *cinfo, Pool *pool)
 #if defined(ENABLE_DEBIAN) && defined(DEBIAN)
   r = read_installed_debian(cinfo);
 #endif
+#ifdef SUSE
+  repo_add_autopattern(cinfo->repo, 0);
+#endif
   pool_set_installed(pool, cinfo->repo);
   return r;
 }
@@ -235,6 +243,9 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos)
 
       if ((!cinfo->autorefresh || cinfo->metadata_expire) && usecachedrepo(cinfo, 0, 0))
        {
+#ifdef SUSE
+         repo_add_autopattern(cinfo->repo, 0);
+#endif
          printf("repo '%s':", cinfo->alias);
          printf(" cached\n");
          continue;
@@ -242,6 +253,11 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos)
 
       switch (cinfo->type)
        {
+#if defined(ENABLE_RPMDB) || defined(ENABLE_RPMPKG)
+        case TYPE_PLAINDIR:
+         plaindir_load(cinfo, &sigpool);
+         break;
+#endif
 #ifdef ENABLE_RPMMD
         case TYPE_RPMMD:
          repomd_load(cinfo, &sigpool);
@@ -268,6 +284,10 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos)
          cinfo->repo = 0;
          break;
        }
+#ifdef SUSE
+      if (cinfo->repo)
+        repo_add_autopattern(cinfo->repo, 0);
+#endif
     }
   if (sigpool)
     pool_free(sigpool);