]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
solv: add autopattern right after the repo has been read
authorMichael Schroeder <mls@suse.de>
Fri, 18 Nov 2016 12:52:12 +0000 (13:52 +0100)
committerMichael Schroeder <mls@suse.de>
Fri, 18 Nov 2016 12:52:12 +0000 (13:52 +0100)
Otherwise we get holes and other nasty things.

examples/solv/repoinfo.c
examples/solv/solv.c

index e08d160de7f86f05319232ed38c6bf6950ed6245..91f7c289f3edd4e5f4717fdb4d1d9b9bc491a729 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"
@@ -109,6 +113,9 @@ read_installed_repo(struct repoinfo *cinfo, Pool *pool)
 #endif
 #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 +242,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;
@@ -268,6 +278,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);
index 814f7e17c46580df4a8ce2bb4771732cd1027c14..330112677dfdfef47e1f07b685818c801021b0d5 100644 (file)
@@ -114,17 +114,6 @@ nscallback(Pool *pool, void *data, Id name, Id evr)
 }
 #endif
 
-#ifdef SUSE
-static void
-add_autopackages(Pool *pool)
-{
-  int i;
-  Repo *repo;
-  FOR_REPOS(i, repo)
-    repo_add_autopattern(repo, 0);
-}
-#endif
-
 #ifdef SUSE
 static void
 showdiskusagechanges(Transaction *trans)
@@ -500,15 +489,17 @@ main(int argc, char **argv)
          commandlinepkgs[i] = p;
        }
       if (commandlinerepo)
-       repo_internalize(commandlinerepo);
+       {
+         repo_internalize(commandlinerepo);
+#ifdef SUSE
+         repo_add_autopattern(commandlinerepo, 0);
+#endif
+       }
     }
 
 #if defined(ENABLE_RPMDB)
   if (pool->disttype == DISTTYPE_RPM)
     addfileprovides(pool);
-#endif
-#ifdef SUSE
-  add_autopackages(pool);
 #endif
   pool_createwhatprovides(pool);