From: Michael Schroeder Date: Fri, 17 Jul 2009 11:32:59 +0000 (+0200) Subject: - tweak problem rule selection heuristic X-Git-Tag: BASE-SuSE-Code-12_1-Branch~165^2~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d266960ac3a8d76ea4653a47dbb9d7f4e25d11f;p=thirdparty%2Flibsolv.git - tweak problem rule selection heuristic - fix testcases --- diff --git a/src/problems.c b/src/problems.c index d90dfb75..74bea79d 100644 --- a/src/problems.c +++ b/src/problems.c @@ -732,7 +732,22 @@ findproblemrule_internal(Solver *solv, Id idx, Id *reqrp, Id *conrp, Id *sysrp, Id rid, d; Id lreqr, lconr, lsysr, ljobr; Rule *r; - int reqassert = 0; + Id jobassert = 0; + int i, reqset = 0; /* 0: unset, 1: installed, 2: jobassert, 3: assert */ + + /* find us a jobassert rule */ + for (i = idx; (rid = solv->learnt_pool.elements[i]) != 0; i++) + { + if (rid < solv->jobrules || rid >= solv->jobrules_end) + continue; + r = solv->rules + rid; + d = r->d < 0 ? -r->d - 1 : r->d; + if (!d && r->w2 == 0 && r->p > 0) + { + jobassert = r->p; + break; + } + } lreqr = lconr = lsysr = ljobr = 0; while ((rid = solv->learnt_pool.elements[idx++]) != 0) @@ -762,7 +777,7 @@ findproblemrule_internal(Solver *solv, Id idx, Id *reqrp, Id *conrp, Id *sysrp, } else { - if (!d && r->w2 == 0 && !reqassert) + if (!d && r->w2 == 0 && reqset < 3) { if (*reqrp > 0 && r->p < -1) { @@ -772,15 +787,22 @@ findproblemrule_internal(Solver *solv, Id idx, Id *reqrp, Id *conrp, Id *sysrp, } /* prefer assertions */ *reqrp = rid; - reqassert = 1; + reqset = 3; } - if (!*reqrp) - *reqrp = rid; - else if (solv->installed && r->p < 0 && solv->pool->solvables[-r->p].repo == solv->installed && !reqassert) + else if (jobassert && r->p == -jobassert) + { + /* prefer rules of job assertions */ + *reqrp = rid; + reqset = 2; + } + else if (solv->installed && r->p < 0 && solv->pool->solvables[-r->p].repo == solv->installed && reqset <= 1) { - /* prefer rules of installed packages */ + /* prefer rules of job installed package so that the user doesn't get confused by strange packages */ *reqrp = rid; + reqset = 1; } + else if (!*reqrp) + *reqrp = rid; } } } diff --git a/src/transaction.c b/src/transaction.c index 914e94b6..2c341d32 100644 --- a/src/transaction.c +++ b/src/transaction.c @@ -205,10 +205,17 @@ transaction_type(Transaction *trans, Id p, int mode) Queue oq, rq; Id type, q; int i, j, ref = 0; + const char *n; if (!s->repo) return SOLVER_TRANSACTION_IGNORE; + n = id2str(pool, s->name); + if (!strncmp(n, "patch:", 6)) + return SOLVER_TRANSACTION_IGNORE; + if (!strncmp(n, "pattern:", 8)) + return SOLVER_TRANSACTION_IGNORE; + type = transaction_base_type(trans, p); if (type == SOLVER_TRANSACTION_IGNORE) @@ -644,11 +651,13 @@ transaction_calculate(Transaction *trans, Queue *decisionq, Map *noobsmap) MAPSET(&trans->transactsmap, -p); if ((!installed || s->repo != installed) && p > 0) { +#if 0 const char *n = id2str(pool, s->name); if (!strncmp(n, "patch:", 6)) continue; if (!strncmp(n, "pattern:", 8)) continue; +#endif MAPSET(&trans->transactsmap, p); if (noobsmap && MAPTST(noobsmap, p)) neednoobs = 1;