}
static int
-decisionsort(const void *va, const void *vb, void *vd)
+decisionsort_cmp(const void *va, const void *vb, void *vd)
{
Solver *solv = vd;
Pool *pool = solv->pool;
bits = merged;
}
j -= 8;
- if (j == i)
- continue;
for (; i < j; i += 8)
q->elements[i + 3] = bits;
}
/* put learnt rule premises in front */
MAPZERO(&seen);
+ MAPSET(&seen, 1);
i = 0;
if ((flags & SOLVER_DECISIONLIST_TYPEMASK) == SOLVER_DECISIONLIST_LEARNTRULE)
{
MAPSET(&seen, p >= 0 ? p : -p);
i += 8;
}
- if (i > 8)
- solv_sort(q->elements, i / 8, 8 * sizeof(Id), decisionsort, solv);
}
if (flags & SOLVER_DECISIONLIST_SORTED)
{
+ /* sort premise block */
+ if (i > 8)
+ solv_sort(q->elements, i / 8, 8 * sizeof(Id), decisionsort_cmp, solv);
+
/* move rules:
* if a package is installed, move conflicts right after
* if a package is conflicted, move requires right after
if (k == i)
continue;
if (i + 8 < k)
- solv_sort(q->elements + i, (k - i) / 8, 8 * sizeof(Id), decisionsort, solv);
+ solv_sort(q->elements + i, (k - i) / 8, 8 * sizeof(Id), decisionsort_cmp, solv);
for (; i < k; i += 8)
{
Id truelit = q->elements[i];
printf("%s %s:\n", v < 0 ? "conflicted" : "installed", testcase_solvid2str(pool, v >= 0 ? v : -v));
/* special case some reasons where we want to show multiple rule infos or extra info */
- if (reason == SOLVER_REASON_UNIT_RULE || reason == SOLVER_REASON_RESOLVE || reason == SOLVER_REASON_WEAKDEP)
+ if (reason == SOLVER_REASON_WEAKDEP || reason == SOLVER_REASON_UNIT_RULE || reason == SOLVER_REASON_RESOLVE)
{
if (reason == SOLVER_REASON_WEAKDEP)
solver_allweakdepinfos(solv, v, &iq);
- else
+ else if (info > 0)
solver_allruleinfos(solv, info, &iq);
if (iq.count)
{
}
void
-doshowproof(Solver *solv, Id problem, int flags, Queue *lq)
+doshowproof(Solver *solv, Id id, int flags, Queue *lq)
{
Pool *pool = solv->pool;
Queue q, qp;
queue_init(&q);
queue_init(&qp);
- solver_get_decisionlist(solv, problem, flags | SOLVER_DECISIONLIST_SORTED | SOLVER_DECISIONLIST_WITHINFO | SOLVER_DECISIONLIST_MERGEDINFO, &q);
+ solver_get_decisionlist(solv, id, flags | SOLVER_DECISIONLIST_SORTED | SOLVER_DECISIONLIST_WITHINFO | SOLVER_DECISIONLIST_MERGEDINFO, &q);
for (i = 0; i < q.count; i += 8)
{
Id v = q.elements[i];
printf("unsolvable: ");
else
printf("%s %s: ", v < 0 ? "conflicted" : "installed", pool_solvidset2str(pool, &qp));
- if (reason == SOLVER_REASON_PREMISE)
+ if (type == 0)
{
printf("%s\n", solver_reason2str(solv, reason));
continue;
}
- if (lq && type == SOLVER_RULE_LEARNT)
+ if (type == SOLVER_RULE_LEARNT && lq)
{
for (j = 0; j < lq->count; j++)
if (lq->elements[j] == q.elements[i + 2])