X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fsolverdebug.c;h=1c53d4e7f58b44c0a7a8abe7fbaa175e0123791a;hb=refs%2Ftags%2Fupstream%2F0.7.27;hp=993bc23c3403ac49c9afcf96f64b2b9ef6b89126;hpb=9e63fccb51e5425dd20d0750d573ff51ce6525bf;p=platform%2Fupstream%2Flibsolv.git diff --git a/src/solverdebug.c b/src/solverdebug.c index 993bc23..1c53d4e 100644 --- a/src/solverdebug.c +++ b/src/solverdebug.c @@ -18,91 +18,16 @@ #include #include "solver.h" +#include "solver_private.h" +#include "solverdebug.h" #include "bitmap.h" #include "pool.h" +#include "poolarch.h" #include "util.h" #include "evr.h" #include "policy.h" -/* - * create obsoletesmap from solver decisions - * - * for solvables in installed repo: - * 0 - not obsoleted - * p - one of the packages that obsolete us - * for all others: - * n - number of packages this package obsoletes - * - */ - -Id * -solver_create_decisions_obsoletesmap(Solver *solv) -{ - Pool *pool = solv->pool; - Repo *installed = solv->installed; - Id p, *obsoletesmap = NULL; - int i; - Solvable *s; - - obsoletesmap = (Id *)sat_calloc(pool->nsolvables, sizeof(Id)); - if (installed) - { - for (i = 0; i < solv->decisionq.count; i++) - { - Id *pp, n; - - n = solv->decisionq.elements[i]; - if (n < 0) - continue; - if (n == SYSTEMSOLVABLE) - continue; - s = pool->solvables + n; - if (s->repo == installed) /* obsoletes don't count for already installed packages */ - continue; - FOR_PROVIDES(p, pp, s->name) - { - if (!solv->implicitobsoleteusesprovides && s->name != pool->solvables[p].name) - continue; - if (pool->solvables[p].repo == installed && !obsoletesmap[p]) - { - obsoletesmap[p] = n; - obsoletesmap[n]++; - } - } - } - for (i = 0; i < solv->decisionq.count; i++) - { - Id obs, *obsp; - Id *pp, n; - - n = solv->decisionq.elements[i]; - if (n < 0) - continue; - if (n == SYSTEMSOLVABLE) - continue; - s = pool->solvables + n; - if (s->repo == installed) /* obsoletes don't count for already installed packages */ - continue; - if (!s->obsoletes) - continue; - obsp = s->repo->idarraydata + s->obsoletes; - while ((obs = *obsp++) != 0) - FOR_PROVIDES(p, pp, obs) - { - if (!solv->obsoleteusesprovides && s->name != pool->solvables[p].name) - continue; - if (pool->solvables[p].repo == installed && !obsoletesmap[p]) - { - obsoletesmap[p] = n; - obsoletesmap[n]++; - } - } - } - } - return obsoletesmap; -} - void solver_printruleelement(Solver *solv, int type, Rule *r, Id v) { @@ -111,13 +36,15 @@ solver_printruleelement(Solver *solv, int type, Rule *r, Id v) if (v < 0) { s = pool->solvables + -v; - POOL_DEBUG(type, " !%s [%d]", solvable2str(pool, s), -v); + POOL_DEBUG(type, " !%s [%d]", pool_solvable2str(pool, s), -v); } else { s = pool->solvables + v; - POOL_DEBUG(type, " %s [%d]", solvable2str(pool, s), v); + POOL_DEBUG(type, " %s [%d]", pool_solvable2str(pool, s), v); } + if (pool->installed && s->repo == pool->installed) + POOL_DEBUG(type, "I"); if (r) { if (r->w1 == v) @@ -148,7 +75,7 @@ solver_printrule(Solver *solv, int type, Rule *r) POOL_DEBUG(type, "Rule #%d:", (int)(r - solv->rules)); else POOL_DEBUG(type, "Rule:"); /* r is any rule */ - if (r && r->d < 0) + if (r->d < 0) POOL_DEBUG(type, " (disabled)"); POOL_DEBUG(type, "\n"); d = r->d < 0 ? -r->d - 1 : r->d; @@ -181,16 +108,32 @@ 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 (p >= solv->learntrules) + if (solv->learntrules && p >= solv->learntrules) POOL_DEBUG(type, "LEARNT "); - else if (p >= solv->featurerules) - POOL_DEBUG(type, "FEATURE "); - else if (p >= solv->updaterules) - POOL_DEBUG(type, "UPDATE "); - else if (p >= solv->jobrules) + else if (p >= solv->bestrules && p < solv->bestrules_end) + POOL_DEBUG(type, "BEST "); + else if (p >= solv->choicerules && p < solv->choicerules_end) + POOL_DEBUG(type, "CHOICE "); + else if (p >= solv->infarchrules && p < solv->infarchrules_end) + POOL_DEBUG(type, "INFARCH "); + else if (p >= solv->duprules && p < solv->duprules_end) + POOL_DEBUG(type, "DUP "); + else if (p >= solv->jobrules && p < solv->jobrules_end) POOL_DEBUG(type, "JOB "); + else if (p >= solv->updaterules && p < solv->updaterules_end) + 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); } @@ -203,19 +146,19 @@ solver_printproblem(Solver *solv, Id v) Id *jp; if (v > 0) - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, solv->rules + v); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, solv->rules + v); else { v = -(v + 1); - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "JOB %d\n", v); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "JOB %d\n", v); jp = solv->ruletojob.elements; - for (i = solv->jobrules, r = solv->rules + i; i < solv->updaterules; i++, r++, jp++) + for (i = solv->jobrules, r = solv->rules + i; i < solv->jobrules_end; i++, r++, jp++) if (*jp == v) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "- "); - solver_printrule(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "- "); + solver_printrule(solv, SOLV_DEBUG_SOLUTIONS, r); } - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "ENDJOB\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "ENDJOB\n"); } } @@ -230,283 +173,377 @@ solver_printwatches(Solver *solv, int type) POOL_DEBUG(type, " solvable [%d] -- rule [%d]\n", counter, solv->watches[counter + pool->nsolvables]); } -/* - * printdecisions - */ - void -solver_printdecisions(Solver *solv) +solver_printdecisionq(Solver *solv, int type) { Pool *pool = solv->pool; - Repo *installed = solv->installed; - Id p, *obsoletesmap = solver_create_decisions_obsoletesmap(solv); int i; - Solvable *s; + Id p, why; - IF_POOLDEBUG (SAT_DEBUG_SCHUBI) + POOL_DEBUG(type, "Decisions:\n"); + for (i = 0; i < solv->decisionq.count; i++) { - POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- Decisions -----\n"); - for (i = 0; i < solv->decisionq.count; i++) + p = solv->decisionq.elements[i]; + if (p > 0) + POOL_DEBUG(type, "%d %d install %s, ", i, solv->decisionmap[p], pool_solvid2str(pool, p)); + else + POOL_DEBUG(type, "%d %d conflict %s, ", i, -solv->decisionmap[-p], pool_solvid2str(pool, -p)); + why = solv->decisionq_why.elements[i]; + if (why > 0) { - p = solv->decisionq.elements[i]; - solver_printruleelement(solv, SAT_DEBUG_SCHUBI, 0, p); + POOL_DEBUG(type, "forced by "); + solver_printruleclass(solv, type, solv->rules + why); } - POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- Decisions end -----\n"); - } - - /* print solvables to be erased */ - - if (installed) - { - FOR_REPO_SOLVABLES(installed, p, s) + else if (why < 0) { - if (solv->decisionmap[p] >= 0) - continue; - if (obsoletesmap[p]) - continue; - POOL_DEBUG(SAT_DEBUG_RESULT, "erase %s\n", solvable2str(pool, s)); + POOL_DEBUG(type, "chosen from "); + solver_printruleclass(solv, type, solv->rules - why); } + else + POOL_DEBUG(type, "picked for some unknown reason.\n"); } +} - /* print solvables to be installed */ +/* + * printdecisions + */ - for (i = 0; i < solv->decisionq.count; i++) +void +solver_printdecisions(Solver *solv) +{ + Pool *pool = solv->pool; + Repo *installed = solv->installed; + Transaction *trans = solver_create_transaction(solv); + Id p, type; + int i, j; + Solvable *s; + Queue iq; + Queue recommendations; + Queue suggestions; + Queue orphaned; + + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "transaction:\n"); + + queue_init(&iq); + for (i = 0; i < trans->steps.count; i++) { - int j; - p = solv->decisionq.elements[i]; - if (p < 0) - continue; - if (p == SYSTEMSOLVABLE) - continue; + p = trans->steps.elements[i]; s = pool->solvables + p; - if (installed && s->repo == installed) - continue; - - if (!obsoletesmap[p]) + type = transaction_type(trans, p, SOLVER_TRANSACTION_SHOW_ACTIVE|SOLVER_TRANSACTION_SHOW_ALL|SOLVER_TRANSACTION_SHOW_OBSOLETES|SOLVER_TRANSACTION_SHOW_MULTIINSTALL); + switch(type) { - POOL_DEBUG(SAT_DEBUG_RESULT, "install %s", solvable2str(pool, s)); + case SOLVER_TRANSACTION_MULTIINSTALL: + POOL_DEBUG(SOLV_DEBUG_RESULT, " multi install %s", pool_solvable2str(pool, s)); + break; + case SOLVER_TRANSACTION_MULTIREINSTALL: + POOL_DEBUG(SOLV_DEBUG_RESULT, " multi reinstall %s", pool_solvable2str(pool, s)); + break; + case SOLVER_TRANSACTION_INSTALL: + POOL_DEBUG(SOLV_DEBUG_RESULT, " install %s", pool_solvable2str(pool, s)); + break; + case SOLVER_TRANSACTION_REINSTALL: + POOL_DEBUG(SOLV_DEBUG_RESULT, " reinstall %s", pool_solvable2str(pool, s)); + break; + case SOLVER_TRANSACTION_DOWNGRADE: + POOL_DEBUG(SOLV_DEBUG_RESULT, " downgrade %s", pool_solvable2str(pool, s)); + break; + case SOLVER_TRANSACTION_CHANGE: + POOL_DEBUG(SOLV_DEBUG_RESULT, " change %s", pool_solvable2str(pool, s)); + break; + case SOLVER_TRANSACTION_UPGRADE: + case SOLVER_TRANSACTION_OBSOLETES: + POOL_DEBUG(SOLV_DEBUG_RESULT, " upgrade %s", pool_solvable2str(pool, s)); + break; + case SOLVER_TRANSACTION_ERASE: + POOL_DEBUG(SOLV_DEBUG_RESULT, " erase %s", pool_solvable2str(pool, s)); + break; + default: + break; } - else - { - Id xp, *xpp; - FOR_PROVIDES(xp, xpp, s->name) + switch(type) + { + case SOLVER_TRANSACTION_INSTALL: + case SOLVER_TRANSACTION_ERASE: + case SOLVER_TRANSACTION_MULTIINSTALL: + case SOLVER_TRANSACTION_MULTIREINSTALL: + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); + break; + case SOLVER_TRANSACTION_REINSTALL: + case SOLVER_TRANSACTION_DOWNGRADE: + case SOLVER_TRANSACTION_CHANGE: + case SOLVER_TRANSACTION_UPGRADE: + case SOLVER_TRANSACTION_OBSOLETES: + transaction_all_obs_pkgs(trans, p, &iq); + if (iq.count) { - Solvable *s2 = pool->solvables + xp; - if (s2->name != s->name) - continue; - if (evrcmp(pool, s->evr, s2->evr, EVRCMP_MATCH_RELEASE) < 0) - break; + POOL_DEBUG(SOLV_DEBUG_RESULT, " (obsoletes"); + for (j = 0; j < iq.count; j++) + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s", pool_solvid2str(pool, iq.elements[j])); + POOL_DEBUG(SOLV_DEBUG_RESULT, ")"); } - if (xp) - POOL_DEBUG(SAT_DEBUG_RESULT, "downgrade %s", solvable2str(pool, s)); - else - POOL_DEBUG(SAT_DEBUG_RESULT, "upgrade %s", solvable2str(pool, s)); - POOL_DEBUG(SAT_DEBUG_RESULT, " (obsoletes"); - for (j = installed->start; j < installed->end; j++) - if (obsoletesmap[j] == p) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s", solvable2str(pool, pool->solvables + j)); - POOL_DEBUG(SAT_DEBUG_RESULT, ")"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); + break; + default: + break; } - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); } + queue_free(&iq); - sat_free(obsoletesmap); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); - if (solv->recommendations.count) + queue_init(&recommendations); + queue_init(&suggestions); + queue_init(&orphaned); + solver_get_recommendations(solv, &recommendations, &suggestions, 0); + solver_get_orphaned(solv, &orphaned); + if (recommendations.count) { - POOL_DEBUG(SAT_DEBUG_RESULT, "\nrecommended packages:\n"); - for (i = 0; i < solv->recommendations.count; i++) + POOL_DEBUG(SOLV_DEBUG_RESULT, "recommended packages:\n"); + for (i = 0; i < recommendations.count; i++) { - s = pool->solvables + solv->recommendations.elements[i]; - if (solv->decisionmap[solv->recommendations.elements[i]] > 0) + s = pool->solvables + recommendations.elements[i]; + if (solv->decisionmap[recommendations.elements[i]] > 0) { if (installed && s->repo == installed) - POOL_DEBUG(SAT_DEBUG_RESULT, "- %s (installed)\n", solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (installed)\n", pool_solvable2str(pool, s)); else - POOL_DEBUG(SAT_DEBUG_RESULT, "- %s (selected)\n", solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (selected)\n", pool_solvable2str(pool, s)); } else - POOL_DEBUG(SAT_DEBUG_RESULT, "- %s\n", solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", pool_solvable2str(pool, s)); } + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); } - if (solv->suggestions.count) + if (suggestions.count) { - POOL_DEBUG(SAT_DEBUG_RESULT, "\nsuggested packages:\n"); - for (i = 0; i < solv->suggestions.count; i++) + POOL_DEBUG(SOLV_DEBUG_RESULT, "suggested packages:\n"); + for (i = 0; i < suggestions.count; i++) { - s = pool->solvables + solv->suggestions.elements[i]; - if (solv->decisionmap[solv->suggestions.elements[i]] > 0) + s = pool->solvables + suggestions.elements[i]; + if (solv->decisionmap[suggestions.elements[i]] > 0) { if (installed && s->repo == installed) - POOL_DEBUG(SAT_DEBUG_RESULT, "- %s (installed)\n", solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (installed)\n", pool_solvable2str(pool, s)); else - POOL_DEBUG(SAT_DEBUG_RESULT, "- %s (selected)\n", solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (selected)\n", pool_solvable2str(pool, s)); } else - POOL_DEBUG(SAT_DEBUG_RESULT, "- %s\n", solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", pool_solvable2str(pool, s)); } + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); } + if (orphaned.count) + { + POOL_DEBUG(SOLV_DEBUG_RESULT, "orphaned packages:\n"); + for (i = 0; i < orphaned.count; i++) + { + s = pool->solvables + orphaned.elements[i]; + if (solv->decisionmap[solv->orphaned.elements[i]] > 0) + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (kept)\n", pool_solvable2str(pool, s)); + else + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (erased)\n", pool_solvable2str(pool, s)); + } + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); + } + queue_free(&recommendations); + queue_free(&suggestions); + queue_free(&orphaned); + transaction_free(trans); +} + +static inline +const char *id2strnone(Pool *pool, Id id) +{ + return !id || id == 1 ? "(none)" : pool_id2str(pool, id); +} + +void +transaction_print(Transaction *trans) +{ + Pool *pool = trans->pool; + Queue classes, pkgs; + int i, j, mode, l, linel; + char line[76]; + const char *n; + + queue_init(&classes); + queue_init(&pkgs); + mode = SOLVER_TRANSACTION_SHOW_OBSOLETES | SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE; + transaction_classify(trans, mode, &classes); + for (i = 0; i < classes.count; i += 4) + { + Id class = classes.elements[i]; + Id cnt = classes.elements[i + 1]; + switch(class) + { + case SOLVER_TRANSACTION_ERASE: + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d erased packages:\n", cnt); + break; + case SOLVER_TRANSACTION_INSTALL: + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d installed packages:\n", cnt); + break; + case SOLVER_TRANSACTION_REINSTALLED: + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d reinstalled packages:\n", cnt); + break; + case SOLVER_TRANSACTION_DOWNGRADED: + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d downgraded packages:\n", cnt); + break; + case SOLVER_TRANSACTION_CHANGED: + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d changed packages:\n", cnt); + break; + case SOLVER_TRANSACTION_UPGRADED: + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d upgraded packages:\n", cnt); + break; + case SOLVER_TRANSACTION_VENDORCHANGE: + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d vendor changes from '%s' to '%s':\n", cnt, id2strnone(pool, classes.elements[i + 2]), id2strnone(pool, classes.elements[i + 3])); + break; + case SOLVER_TRANSACTION_ARCHCHANGE: + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d arch changes from %s to %s:\n", cnt, pool_id2str(pool, classes.elements[i + 2]), pool_id2str(pool, classes.elements[i + 3])); + break; + default: + class = SOLVER_TRANSACTION_IGNORE; + break; + } + if (class == SOLVER_TRANSACTION_IGNORE) + continue; + transaction_classify_pkgs(trans, mode, class, classes.elements[i + 2], classes.elements[i + 3], &pkgs); + *line = 0; + linel = 0; + for (j = 0; j < pkgs.count; j++) + { + Id p = pkgs.elements[j]; + Solvable *s = pool->solvables + p; + Solvable *s2; + + switch(class) + { + case SOLVER_TRANSACTION_DOWNGRADED: + case SOLVER_TRANSACTION_UPGRADED: + s2 = pool->solvables + transaction_obs_pkg(trans, p); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - %s -> %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, s2)); + break; + case SOLVER_TRANSACTION_VENDORCHANGE: + case SOLVER_TRANSACTION_ARCHCHANGE: + n = pool_id2str(pool, s->name); + l = strlen(n); + if (l + linel > sizeof(line) - 3) + { + if (*line) + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", line); + *line = 0; + linel = 0; + } + if (l + linel > sizeof(line) - 3) + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", n); + else + { + if (*line) + { + strcpy(line + linel, ", "); + linel += 2; + } + strcpy(line + linel, n); + linel += l; + } + break; + default: + POOL_DEBUG(SOLV_DEBUG_RESULT, " - %s\n", pool_solvable2str(pool, s)); + break; + } + } + if (*line) + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", line); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); + } + queue_free(&classes); + queue_free(&pkgs); } void -solver_printprobleminfo(Solver *solv, Queue *job, Id problem) +solver_printproblemruleinfo(Solver *solv, Id probr) { Pool *pool = solv->pool; - Id probr; Id dep, source, target; - Solvable *s, *s2; + SolverRuleinfo type = solver_ruleinfo(solv, probr, &source, &target, &dep); + + POOL_DEBUG(SOLV_DEBUG_RESULT, "%s\n", solver_problemruleinfo2str(solv, type, source, target, dep)); +} + +void +solver_printprobleminfo(Solver *solv, Id problem) +{ + solver_printproblemruleinfo(solv, solver_findproblemrule(solv, problem)); +} + +void +solver_printcompleteprobleminfo(Solver *solv, Id problem) +{ + Queue q; + Id probr; + int i, nobad = 0; - probr = solver_findproblemrule(solv, problem); - switch (solver_problemruleinfo(solv, job, probr, &dep, &source, &target)) + queue_init(&q); + solver_findallproblemrules(solv, problem, &q); + for (i = 0; i < q.count; i++) + { + probr = q.elements[i]; + if (!(probr >= solv->updaterules && probr < solv->updaterules_end) && !(probr >= solv->jobrules && probr < solv->jobrules_end)) + { + nobad = 1; + break; + } + } + for (i = 0; i < q.count; i++) { - case SOLVER_PROBLEM_UPDATE_RULE: - s = pool_id2solvable(pool, source); - POOL_DEBUG(SAT_DEBUG_RESULT, "problem with installed package %s\n", solvable2str(pool, s)); - return; - case SOLVER_PROBLEM_JOB_RULE: - POOL_DEBUG(SAT_DEBUG_RESULT, "conflicting requests\n"); - return; - case SOLVER_PROBLEM_JOB_NOTHING_PROVIDES_DEP: - POOL_DEBUG(SAT_DEBUG_RESULT, "nothing provides requested %s\n", dep2str(pool, dep)); - return; - case SOLVER_PROBLEM_NOT_INSTALLABLE: - s = pool_id2solvable(pool, source); - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s is not installable\n", solvable2str(pool, s)); - return; - case SOLVER_PROBLEM_NOTHING_PROVIDES_DEP: - s = pool_id2solvable(pool, source); - POOL_DEBUG(SAT_DEBUG_RESULT, "nothing provides %s needed by %s\n", dep2str(pool, dep), solvable2str(pool, s)); - return; - case SOLVER_PROBLEM_SAME_NAME: - s = pool_id2solvable(pool, source); - s2 = pool_id2solvable(pool, target); - POOL_DEBUG(SAT_DEBUG_RESULT, "cannot install both %s and %s\n", solvable2str(pool, s), solvable2str(pool, s2)); - return; - case SOLVER_PROBLEM_PACKAGE_CONFLICT: - s = pool_id2solvable(pool, source); - s2 = pool_id2solvable(pool, target); - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s conflicts with %s provided by %s\n", solvable2str(pool, s), dep2str(pool, dep), solvable2str(pool, s2)); - return; - case SOLVER_PROBLEM_PACKAGE_OBSOLETES: - s = pool_id2solvable(pool, source); - s2 = pool_id2solvable(pool, target); - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s obsoletes %s provided by %s\n", solvable2str(pool, s), dep2str(pool, dep), solvable2str(pool, s2)); - return; - case SOLVER_PROBLEM_DEP_PROVIDERS_NOT_INSTALLABLE: - s = pool_id2solvable(pool, source); - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s requires %s, but none of the providers can be installed\n", solvable2str(pool, s), dep2str(pool, dep)); - return; - case SOLVER_PROBLEM_SELF_CONFLICT: - s = pool_id2solvable(pool, source); - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s conflicts with %s provided by itself\n", solvable2str(pool, s), dep2str(pool, dep)); - return; + probr = q.elements[i]; + if (nobad && ((probr >= solv->updaterules && probr < solv->updaterules_end) || (probr >= solv->jobrules && probr < solv->jobrules_end))) + continue; + solver_printproblemruleinfo(solv, probr); } + queue_free(&q); +} + +void +solver_printsolution(Solver *solv, Id problem, Id solution) +{ + Pool *pool = solv->pool; + 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 -solver_printsolutions(Solver *solv, Queue *job) +solver_printallsolutions(Solver *solv) { Pool *pool = solv->pool; int pcnt; - Id p, rp, how, what; - Id problem, solution, element; - Solvable *s, *sd; + Id problem, solution; - POOL_DEBUG(SAT_DEBUG_RESULT, "Encountered problems! Here are the solutions:\n\n"); - pcnt = 1; + POOL_DEBUG(SOLV_DEBUG_RESULT, "Encountered problems! Here are the solutions:\n\n"); + pcnt = 0; problem = 0; while ((problem = solver_next_problem(solv, problem)) != 0) { - POOL_DEBUG(SAT_DEBUG_RESULT, "Problem %d:\n", pcnt++); - POOL_DEBUG(SAT_DEBUG_RESULT, "====================================\n"); - solver_printprobleminfo(solv, job, problem); - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + pcnt++; + POOL_DEBUG(SOLV_DEBUG_RESULT, "Problem %d:\n", pcnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "====================================\n"); +#if 1 + solver_printprobleminfo(solv, problem); +#else + solver_printcompleteprobleminfo(solv, problem); +#endif + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); solution = 0; while ((solution = solver_next_solution(solv, problem, solution)) != 0) { - element = 0; - while ((element = solver_next_solutionelement(solv, problem, solution, element, &p, &rp)) != 0) - { - if (p == 0) - { - /* job, rp is index into job queue */ - how = job->elements[rp - 1] & ~SOLVER_WEAK; - what = job->elements[rp]; - switch (how) - { - case SOLVER_INSTALL_SOLVABLE: - s = pool->solvables + what; - if (solv->installed && s->repo == solv->installed) - POOL_DEBUG(SAT_DEBUG_RESULT, "- do not keep %s installed\n", solvable2str(pool, s)); - else - POOL_DEBUG(SAT_DEBUG_RESULT, "- do not install %s\n", solvable2str(pool, s)); - break; - case SOLVER_ERASE_SOLVABLE: - s = pool->solvables + what; - if (solv->installed && s->repo == solv->installed) - POOL_DEBUG(SAT_DEBUG_RESULT, "- do not deinstall %s\n", solvable2str(pool, s)); - else - POOL_DEBUG(SAT_DEBUG_RESULT, "- do not forbid installation of %s\n", solvable2str(pool, s)); - break; - case SOLVER_INSTALL_SOLVABLE_NAME: - POOL_DEBUG(SAT_DEBUG_RESULT, "- do not install %s\n", dep2str(pool, what)); - break; - case SOLVER_ERASE_SOLVABLE_NAME: - POOL_DEBUG(SAT_DEBUG_RESULT, "- do not deinstall %s\n", dep2str(pool, what)); - break; - case SOLVER_INSTALL_SOLVABLE_PROVIDES: - POOL_DEBUG(SAT_DEBUG_RESULT, "- do not install a solvable providing %s\n", dep2str(pool, what)); - break; - case SOLVER_ERASE_SOLVABLE_PROVIDES: - POOL_DEBUG(SAT_DEBUG_RESULT, "- do not deinstall all solvables providing %s\n", dep2str(pool, what)); - break; - case SOLVER_INSTALL_SOLVABLE_UPDATE: - s = pool->solvables + what; - POOL_DEBUG(SAT_DEBUG_RESULT, "- do not install most recent version of %s\n", solvable2str(pool, s)); - break; - default: - POOL_DEBUG(SAT_DEBUG_RESULT, "- do something different\n"); - break; - } - } - else - { - /* policy, replace p with rp */ - s = pool->solvables + p; - sd = rp ? pool->solvables + rp : 0; - if (sd) - { - int gotone = 0; - if (!solv->allowdowngrade && evrcmp(pool, s->evr, sd->evr, EVRCMP_MATCH_RELEASE) > 0) - { - POOL_DEBUG(SAT_DEBUG_RESULT, "- allow downgrade of %s to %s\n", solvable2str(pool, s), solvable2str(pool, sd)); - gotone = 1; - } - if (!solv->allowarchchange && s->name == sd->name && s->arch != sd->arch && policy_illegal_archchange(solv, s, sd)) - { - POOL_DEBUG(SAT_DEBUG_RESULT, "- allow architecture change of %s to %s\n", solvable2str(pool, s), solvable2str(pool, sd)); - gotone = 1; - } - if (!solv->allowvendorchange && s->name == sd->name && s->vendor != sd->vendor && policy_illegal_vendorchange(solv, s, sd)) - { - if (sd->vendor) - POOL_DEBUG(SAT_DEBUG_RESULT, "- allow vendor change from '%s' (%s) to '%s' (%s)\n", id2str(pool, s->vendor), solvable2str(pool, s), id2str(pool, sd->vendor), solvable2str(pool, sd)); - else - POOL_DEBUG(SAT_DEBUG_RESULT, "- allow vendor change from '%s' (%s) to no vendor (%s)\n", id2str(pool, s->vendor), solvable2str(pool, s), solvable2str(pool, sd)); - gotone = 1; - } - if (!gotone) - POOL_DEBUG(SAT_DEBUG_RESULT, "- allow replacement of %s with %s\n", solvable2str(pool, s), solvable2str(pool, sd)); - } - else - { - POOL_DEBUG(SAT_DEBUG_RESULT, "- allow deinstallation of %s\n", solvable2str(pool, s)); - } - - } - } - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + solver_printsolution(solv, problem, solution); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); } } }