Also optimize the sort_by_common_deps code a bit.
Id r = aa[1] - bb[1];
if (r)
return r < 0 ? -1 : 1;
+ if (aa[2] == bb[2])
+ return 0;
a = aa[2] < 0 ? -aa[2] : aa[2];
b = bb[2] < 0 ? -bb[2] : bb[2];
- if (pool->disttype != DISTTYPE_DEB)
+ if (pool->disttype != DISTTYPE_DEB && a != b)
{
/* treat release-less versions different */
const char *as = pool_id2str(pool, a);
prune_to_best_arch(pool, plist);
if (plist->count > 1)
prune_to_best_version(pool, plist);
- if (plist->count > 1 && mode == POLICY_MODE_CHOOSE)
+ if (plist->count > 1 && (mode == POLICY_MODE_CHOOSE || mode == POLICY_MODE_CHOOSE_NOREORDER))
{
prune_to_recommended(solv, plist);
- if (plist->count > 1)
+ if (plist->count > 1 && mode != POLICY_MODE_CHOOSE_NOREORDER)
{
/* do some fancy reordering */
#if 0
#define POLICY_MODE_CHOOSE 0
#define POLICY_MODE_RECOMMEND 1
#define POLICY_MODE_SUGGEST 2
+#define POLICY_MODE_CHOOSE_NOREORDER 3 /* internal, do not use */
#define POLICY_ILLEGAL_DOWNGRADE 1
int i, j, n;
Solvable *s;
Pool *pool = solv->pool;
- Id p, pp, *dp;
+ Id p, pp, *dp, postponed;
int minimizationsteps;
int installedpos = solv->installed ? solv->installed->start : 0;
if (!solv->decisioncnt_resolve)
solv->decisioncnt_resolve = solv->decisionq.count;
POOL_DEBUG(SOLV_DEBUG_POLICY, "deciding unresolved rules\n");
- for (i = 1, n = 1; n < solv->nrules; i++, n++)
+ postponed = 0;
+ for (i = 1, n = 1; ; i++, n++)
{
+ if (n >= solv->nrules)
+ {
+ if (postponed <= 0)
+ break;
+ i = postponed;
+ postponed = -1;
+ n = 1;
+ }
if (i == solv->nrules)
i = 1;
r = solv->rules + i;
}
}
+ if (dq.count > 1 && postponed >= 0)
+ {
+ policy_filter_unwanted(solv, &dq, POLICY_MODE_CHOOSE_NOREORDER);
+ if (dq.count > 1)
+ {
+ if (!postponed)
+ postponed = i;
+ continue;
+ }
+ }
+
olevel = level;
level = selectandinstall(solv, level, &dq, disablerules, r - solv->rules);
if (level == 0)
n = 0;
}
- if (n != solv->nrules) /* ran into trouble? */
+ if (n < solv->nrules) /* ran into trouble? */
{
if (level == 0)
break; /* unsolvable */