int nsolvables = solv->pool->nsolvables;
solv_free(solv->watches);
- /* lower half for removals, upper half for installs */
+ /* lower half for removals, upper half for installs */
solv->watches = solv_calloc(2 * nsolvables, sizeof(Id));
-#if 1
- /* do it reverse so pkg rules get triggered first (XXX: obsolete?) */
for (i = 1, r = solv->rules + solv->nrules - 1; i < solv->nrules; i++, r--)
-#else
- for (i = 1, r = solv->rules + 1; i < solv->nrules; i++, r++)
-#endif
{
if (!r->w2) /* assertions do not need watches */
continue;
Id p, pkg, other_watch;
Id *dp;
Id *decisionmap = solv->decisionmap;
-
Id *watches = solv->watches + pool->nsolvables; /* place ptr in middle */
POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "----- propagate -----\n");
/* foreach non-propagated decision */
while (solv->propagate_index < solv->decisionq.count)
{
- /*
- * 'pkg' was just decided
- * negate because our watches trigger if literal goes FALSE
- */
+ /*
+ * 'pkg' was just decided
+ * negate because our watches trigger if literal goes FALSE
+ */
pkg = -solv->decisionq.elements[solv->propagate_index++];
IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE)
solver_printrule(solv, SOLV_DEBUG_PROPAGATE, r);
}
- /* 'pkg' was just decided (was set to FALSE)
- *
- * now find other literal watch, check clause
- * and advance on linked list
- */
+ /*
+ * 'pkg' was just decided (was set to FALSE), so this rule
+ * may now be unit.
+ */
+ /* find the other watch */
if (pkg == r->w1)
{
other_watch = r->w2;
next_rp = &r->n2;
}
- /*
- * This term is already true (through the other literal)
- * so we have nothing to do
- */
+ /*
+ * if the other watch is true we have nothing to do
+ */
if (DECISIONMAP_TRUE(other_watch))
continue;
- /*
- * The other literal is FALSE or UNDEF
- *
- */
+ /*
+ * The other literal is FALSE or UNDEF
+ *
+ */
if (r->d)
{
* and not FALSE
*
* (TRUE is also ok, in that case the rule is fulfilled)
+ * As speed matters here we do not use the FOR_RULELITERALS
+ * macro.
*/
if (r->p /* we have a 'p' */
&& r->p != other_watch /* which is not watched */
if (p > 0)
POOL_DEBUG(SOLV_DEBUG_PROPAGATE, " -> move w%d to %s\n", (pkg == r->w1 ? 1 : 2), pool_solvid2str(pool, p));
else
- POOL_DEBUG(SOLV_DEBUG_PROPAGATE," -> move w%d to !%s\n", (pkg == r->w1 ? 1 : 2), pool_solvid2str(pool, -p));
+ POOL_DEBUG(SOLV_DEBUG_PROPAGATE, " -> move w%d to !%s\n", (pkg == r->w1 ? 1 : 2), pool_solvid2str(pool, -p));
}
*rp = *next_rp;
* Otherwise we return -1 if disablerules is not set or disable
* _all_ of the problem rules and return 0.
*
- * return: 0 - disabled some rules, try again
+ * return: 0 - disabled some rules, try again
* -1 - hopeless
*/
* install best package from the queue. We add an extra package, inst, if
* provided. See comment in weak install section.
*
- * returns the new solver level or 0 if unsolvable
+ * returns the new solver level or -1 if unsolvable
*
*/
level = selectandinstall(solv, level, dq, disablerules, i);
if (level <= olevel)
{
- if (level == 0)
- return 0; /* unsolvable */
if (level == olevel)
{
i--;
}
static int
-cleandeps_check_mistakes(Solver *solv, int level)
+cleandeps_check_mistakes(Solver *solv)
{
Pool *pool = solv->pool;
Rule *r;
solver_reenablepolicyrules_cleandeps(solv, i);
mademistake = 1;
}
- if (mademistake)
- solver_reset(solv);
return mademistake;
}
continue; /* back to main loop */
}
- if (solv->installed && solv->cleandepsmap.size)
+ if (solv->installed && solv->cleandepsmap.size && cleandeps_check_mistakes(solv))
{
- if (cleandeps_check_mistakes(solv, level))
- {
- level = 0; /* restart from scratch */
- continue;
- }
+ solver_reset(solv);
+ level = 0; /* restart from scratch */
+ continue;
}
if (solv->solution_callback)