Imported Upstream version 0.6.7
[platform/upstream/libsolv.git] / examples / solv.c
index 09258cb..8b0d6cc 100644 (file)
@@ -84,6 +84,9 @@
 #include "repo_susetags.h"
 #include "repo_content.h"
 #endif
+#ifdef SUSE
+#include "repo_autopattern.h"
+#endif
 #include "solv_xfopen.h"
 
 #ifdef FEDORA
@@ -213,7 +216,6 @@ yum_substitute(Pool *pool, char *line)
 #define TYPE_PLAINDIR  3
 #define TYPE_DEBIAN     4
 
-#ifndef NOSYSTEM
 static int
 read_repoinfos_sort(const void *ap, const void *bp)
 {
@@ -221,7 +223,6 @@ read_repoinfos_sort(const void *ap, const void *bp)
   const struct repoinfo *b = bp;
   return strcmp(a->alias, b->alias);
 }
-#endif
 
 #if defined(SUSE) || defined(FEDORA)
 
@@ -475,15 +476,6 @@ read_repoinfos(Pool *pool, int *nrepoinfosp)
 
 #endif
 
-#ifdef NOSYSTEM
-struct repoinfo *
-read_repoinfos(Pool *pool, int *nrepoinfosp)
-{
-  *nrepoinfosp = 0;
-  return 0;
-}
-#endif
-
 
 void
 free_repoinfos(struct repoinfo *repoinfos, int nrepoinfos)
@@ -1730,6 +1722,7 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos)
 #endif
 
   repo = repo_create(pool, "@System");
+  memset(&stb, 0, sizeof(stb));
 #if defined(ENABLE_RPMDB) && (defined(SUSE) || defined(FEDORA))
   printf("rpm database:");
   if (stat(pool_prepend_rootdir_tmp(pool, "/var/lib/rpm/Packages"), &stb))
@@ -1740,10 +1733,6 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos)
   if (stat(pool_prepend_rootdir_tmp(pool, "/var/lib/dpkg/status"), &stb))
     memset(&stb, 0, sizeof(stb));
 #endif
-#ifdef NOSYSTEM
-  printf("no installed database:");
-  memset(&stb, 0, sizeof(stb));
-#endif
   calc_checksum_stat(&stb, REPOKEY_TYPE_SHA256, 0, installedcookie);
   if (usecachedrepo(repo, 0, installedcookie, 0))
     printf(" cached\n");
@@ -2385,6 +2374,17 @@ addfileprovides(Pool *pool)
 
 #endif
 
+#ifdef SUSE
+static void
+add_autopackages(Pool *pool)
+{
+  int i;
+  Repo *repo;
+  FOR_REPOS(i, repo)
+    repo_add_autopattern(repo, 0);
+}
+#endif
+
 #if defined(SUSE) || defined(FEDORA)
 static void
 add_patchjobs(Pool *pool, Queue *job)
@@ -2450,6 +2450,7 @@ showdiskusagechanges(Transaction *trans)
   int i;
 
   /* XXX: use mountpoints here */
+  memset(duc, 0, sizeof(duc));
   duc[0].path = "/";
   duc[1].path = "/usr/share/man";
   duc[2].path = "/sbin";
@@ -2928,6 +2929,9 @@ main(int argc, char **argv)
   if (pool->disttype == DISTTYPE_RPM)
     addfileprovides(pool);
 #endif
+#ifdef SUSE
+  add_autopackages(pool);
+#endif
   pool_createwhatprovides(pool);
 
   if (keyname)