Imported Upstream version 0.7.27
[platform/upstream/libsolv.git] / src / solverdebug.c
index afec8c5..1c53d4e 100644 (file)
@@ -108,7 +108,7 @@ solver_printruleclass(Solver *solv, int type, Rule *r)
   Id p = r - solv->rules;
   assert(p >= 0);
   if (p < solv->learntrules)
-    if (MAPTST(&solv->weakrulemap, p))
+    if (solv->weakrulemap.size && MAPTST(&solv->weakrulemap, p))
       POOL_DEBUG(type, "WEAK ");
   if (solv->learntrules && p >= solv->learntrules)
     POOL_DEBUG(type, "LEARNT ");
@@ -126,6 +126,14 @@ solver_printruleclass(Solver *solv, int type, Rule *r)
     POOL_DEBUG(type, "UPDATE ");
   else if (p >= solv->featurerules && p < solv->featurerules_end)
     POOL_DEBUG(type, "FEATURE ");
+  else if (p >= solv->yumobsrules && p < solv->yumobsrules_end)
+    POOL_DEBUG(type, "YUMOBS ");
+  else if (p >= solv->blackrules && p < solv->blackrules_end)
+    POOL_DEBUG(type, "BLACK ");
+  else if (p >= solv->strictrepopriorules && p < solv->strictrepopriorules_end)
+    POOL_DEBUG(type, "REPOPRIO ");
+  else if (p >= solv->recommendsrules && p < solv->recommendsrules_end)
+    POOL_DEBUG(type, "RECOMMENDS ");
   solver_printrule(solv, type, r);
 }
 
@@ -497,43 +505,17 @@ solver_printcompleteprobleminfo(Solver *solv, Id problem)
   queue_free(&q);
 }
 
-static int illegals[] = {
-  POLICY_ILLEGAL_DOWNGRADE,
-  POLICY_ILLEGAL_NAMECHANGE,
-  POLICY_ILLEGAL_ARCHCHANGE,
-  POLICY_ILLEGAL_VENDORCHANGE,
-  0
-};
-
 void
 solver_printsolution(Solver *solv, Id problem, Id solution)
 {
   Pool *pool = solv->pool;
-  Id p, rp, element;
-
-  element = 0;
-  while ((element = solver_next_solutionelement(solv, problem, solution, element, &p, &rp)) != 0)
-    {
-      if (p > 0 && rp > 0)
-       {
-         /* for replacements we want to know why it was illegal */
-         Solvable *s = pool->solvables + p, *rs = pool->solvables + rp;
-         int illegal = policy_is_illegal(solv, s, rs, 0);
-         if (illegal)
-           {
-             int i;
-             for (i = 0; illegals[i]; i++)
-               if ((illegal & illegals[i]) != 0)
-                 {
-                   POOL_DEBUG(SOLV_DEBUG_RESULT, "  - allow %s\n", policy_illegal2str(solv, illegals[i], s, rs));
-                   illegal ^= illegals[i];
-                 }
-             if (!illegal)
-               continue;
-           }
-       }
-      POOL_DEBUG(SOLV_DEBUG_RESULT, "  - %s\n", solver_solutionelement2str(solv, p, rp));
-    }
+  Queue q;
+  int i;
+  queue_init(&q);
+  solver_all_solutionelements(solv, problem, solution, 1, &q);
+  for (i = 0; i < q.count; i += 3)
+    POOL_DEBUG(SOLV_DEBUG_RESULT, "  - %s\n", solver_solutionelementtype2str(solv, q.elements[i], q.elements[i + 1], q.elements[i + 2]));
+  queue_free(&q);
 }
 
 void
@@ -566,36 +548,3 @@ solver_printallsolutions(Solver *solv)
     }
 }
 
-void
-solver_printtrivial(Solver *solv)
-{
-  Pool *pool = solv->pool;
-  Queue in, out;
-  Id p;
-  const char *n;
-  Solvable *s;
-  int i;
-
-  queue_init(&in);
-  for (p = 1, s = pool->solvables + p; p < solv->pool->nsolvables; p++, s++)
-    {
-      n = pool_id2str(pool, s->name);
-      if (strncmp(n, "patch:", 6) != 0 && strncmp(n, "pattern:", 8) != 0)
-        continue;
-      queue_push(&in, p);
-    }
-  if (!in.count)
-    {
-      queue_free(&in);
-      return;
-    }
-  queue_init(&out);
-  solver_trivial_installable(solv, &in, &out);
-  POOL_DEBUG(SOLV_DEBUG_RESULT, "trivial installable status:\n");
-  for (i = 0; i < in.count; i++)
-    POOL_DEBUG(SOLV_DEBUG_RESULT, "  %s: %d\n", pool_solvid2str(pool, in.elements[i]), out.elements[i]);
-  POOL_DEBUG(SOLV_DEBUG_RESULT, "\n");
-  queue_free(&in);
-  queue_free(&out);
-}
-