improve guessing of appdata.xml file name
[platform/upstream/libsolv.git] / tools / patchcheck.c
index 1414a2b..6a5c3f7 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"
 
@@ -89,6 +93,9 @@ showproblems(Solver *solv, Solvable *s, Queue *cand, Queue *badguys)
                      }
                  break;
                case SOLVER_RULE_JOB:
+               case SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM:
+               case SOLVER_RULE_JOB_UNKNOWN_PACKAGE:
+               case SOLVER_RULE_JOB_UNSUPPORTED:
                  break;
                case SOLVER_RULE_RPM:
                  printf("  some dependency problem\n");
@@ -482,12 +489,13 @@ main(int argc, char **argv)
 {
   char *arch, *mypatch;
   const char *pname;
-  int l;
+  int l, r;
   FILE *fp;
   int i;
   Id pid, p, pp;
   int tests = 0;
   context_t c;
+  static const char* langs[] = {"en"};
 
   c.install_available = 0;
   c.updatestart = 0;
@@ -499,7 +507,6 @@ main(int argc, char **argv)
   arch = argv[1];
   pool = pool_create();
   pool_setarch(pool, arch);
-  static const char* langs[] = {"en"};
   pool_set_languages(pool, langs, 1);
 
 #if 0
@@ -532,25 +539,35 @@ main(int argc, char **argv)
           perror(argv[i]);
           exit(1);
         }
-      if (l >= 8 && !strcmp(argv[i] + l - 8, "packages"))
+      r = 0;
+      if (0)
+       {
+       }
+#ifdef ENABLE_SUSEREPO
+      else if (l >= 8 && !strcmp(argv[i] + l - 8, "packages"))
         {
-          repo_add_susetags(c.repo, fp, 0, 0, 0);
+          r = repo_add_susetags(c.repo, fp, 0, 0, 0);
         }
       else if (l >= 11 && !strcmp(argv[i] + l - 11, "packages.gz"))
         {
-          repo_add_susetags(c.repo, fp, 0, 0, 0);
+          r = 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);
+          r = repo_add_rpmmd(c.repo, fp, 0, 0);
         }
       else if (l >= 17 && !strcmp(argv[i] + l - 17, "updateinfo.xml.gz"))
        {
-          repo_add_updateinfoxml(c.repo, fp, 0);
+          r = repo_add_updateinfoxml(c.repo, fp, 0);
        }
-      else if (repo_add_solv(c.repo, fp))
+#endif
+      else
+       r = repo_add_solv(c.repo, fp, 0);
+      if (r)
         {
-          fprintf(stderr, "could not add repo %s\n", argv[i]);
+          fprintf(stderr, "could not add repo %s: %s\n", argv[i], pool_errstr(pool));
           exit(1);
         }
       if (fp != stdin)
@@ -570,8 +587,9 @@ main(int argc, char **argv)
 
   for (pid = 1; pid < pool->nsolvables; pid++)
     {
+      Solvable *s;
       c.shown = 0;
-      Solvable *s = pool->solvables + pid;
+      s = pool->solvables + pid;
       if (!s->repo)
         continue;
       if (!pool_installable(pool, s))