diff options
author | Michael Schroeder <mls@suse.de> | 2009-07-17 13:32:59 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2009-07-17 13:32:59 +0200 |
commit | 2d266960ac3a8d76ea4653a47dbb9d7f4e25d11f (patch) | |
tree | 09395ba9346d7a9ecea4b3981707b82593ee20b0 /src/problems.c | |
parent | b8811fd0903deb48940d7edf5f369f897c677aa0 (diff) | |
download | libsolv-2d266960ac3a8d76ea4653a47dbb9d7f4e25d11f.tar.gz libsolv-2d266960ac3a8d76ea4653a47dbb9d7f4e25d11f.tar.bz2 libsolv-2d266960ac3a8d76ea4653a47dbb9d7f4e25d11f.zip |
- tweak problem rule selection heuristic
- fix testcases
Diffstat (limited to 'src/problems.c')
-rw-r--r-- | src/problems.c | 36 |
1 files changed, 29 insertions, 7 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; } } } |