ref: refs/heads/master
commit e789d5cf5c0ee87839fba6348afd9fe1fbb3dc24
Author: Michael Schroeder
Date: Fri Jul 17 13:32:59 2009 +0200
- tweak problem rule selection heuristic
- fix testcases
---
src/problems.c | 36 ++++++++++++++++----
src/transaction.c | 9 +++++
.../bugzilla-tests/bug222531-test.solution | 10 +++---
tests/solver/deptestomatic.c | 5 +++
4 files changed, 48 insertions(+), 12 deletions(-)
diff --git a/src/problems.c b/src/problems.c
index d90dfb7..74bea79 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 914e94b..2c341d3 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;
diff --git a/tests/solver/data.libzypp/bugzilla-tests/bug222531-test.solution b/tests/solver/data.libzypp/bugzilla-tests/bug222531-test.solution
index 186f7fc..26f9185 100644
--- a/tests/solver/data.libzypp/bugzilla-tests/bug222531-test.solution
+++ b/tests/solver/data.libzypp/bugzilla-tests/bug222531-test.solution
@@ -2,11 +2,11 @@ Encountered problems! Here are the solutions:
Problem 1:
====================================
-package atom:libzypp-2.8.1-3.i586 requires libzypp >= 2.8.1-3, but none of the providers can be installed
+package patch:libzypp-2287-0.noarch requires atom:libzypp = 2.8.1-3, but none of the providers can be installed
-- do not install patch:libzypp-2287-0.noarch
+ - do not install patch:libzypp-2287-0.noarch
-- do not keep libzypp-2.7.2-7.i586 installed
-- do not keep libzypp-2.7.2-7.i586 installed
-- do not keep libzypp-2.7.2-7.i586 installed
+ - do not keep libzypp-2.7.2-7.i586 installed
+ - do not keep libzypp-2.7.2-7.i586 installed
+ - do not keep libzypp-2.7.2-7.i586 installed
diff --git a/tests/solver/deptestomatic.c b/tests/solver/deptestomatic.c
index dc1f184..daccc5e 100644
--- a/tests/solver/deptestomatic.c
+++ b/tests/solver/deptestomatic.c
@@ -1634,9 +1634,14 @@ rc_printdecisions(Solver *solv, Queue *job)
for (i = 0; i < trans->steps.count; i++)
{
+ const char *name;
p = trans->steps.elements[i];
s = pool->solvables + p;
+
type = transaction_type(trans, p, 0);
+ name = id2str(pool, s->name);
+ if (!strncmp(name, "pattern:", 8) || !strncmp(name, "patch:", 6))
+ type = s->repo == pool->installed ? SOLVER_TRANSACTION_ERASE : SOLVER_TRANSACTION_INSTALL;
switch(type)
{
case SOLVER_TRANSACTION_INSTALL:
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org