abort();
if (solv->decisionmap[-p])
return NULL;
- queuepush(&solv->decisionq, p);
- queuepush(&solv->decisionq_why, 0);
+ queue_push(&solv->decisionq, p);
+ queue_push(&solv->decisionq_why, 0);
solv->decisionmap[-p] = -1;
return 0;
}
vv = v > 0 ? v : -v;
if (solv->decisionmap[vv] == 0)
{
- queuepush(&solv->decisionq, v);
- queuepush(&solv->decisionq_why, r - solv->rules);
+ queue_push(&solv->decisionq, v);
+ queue_push(&solv->decisionq_why, r - solv->rules);
solv->decisionmap[vv] = v > 0 ? 1 : -1;
continue;
}
{
/* conflict with rpm rule, need only disable our rule */
printf("conflict with rpm rule, disabling rule #%d\n", ri);
- queuepush(&solv->problems, r - solv->rules);
- queuepush(&solv->problems, 0);
+ queue_push(&solv->problems, r - solv->rules);
+ queue_push(&solv->problems, 0);
r->w1 = 0; /* disable */
continue;
}
if (rr->p != v && rr->p != -v)
continue;
printf(" - disabling rule #%d\n", i);
- queuepush(&solv->problems, i);
+ queue_push(&solv->problems, i);
rr->w1 = 0; /* disable */
}
- queuepush(&solv->problems, 0);
+ queue_push(&solv->problems, 0);
}
}
Id *dp;
Id n;
- queueinit_buffer(&q, qbuf, sizeof(qbuf)/sizeof(*qbuf));
- queuepush(&q, s - pool->solvables); /* push solvable Id */
+ queue_init_buffer(&q, qbuf, sizeof(qbuf)/sizeof(*qbuf));
+ queue_push(&q, s - pool->solvables); /* push solvable Id */
while (q.count)
{
* s: Pointer to solvable
*/
- n = queueshift(&q);
+ n = queue_shift(&q);
if (MAPTST(m, n)) /* continue if already done */
continue;
for (; *dp; dp++) /* loop through all providers */
{
if (!MAPTST(m, *dp))
- queuepush(&q, *dp);
+ queue_push(&q, *dp);
}
} /* while, requirements of n */
{
FOR_PROVIDES(p, pp, rec)
if (!MAPTST(m, p))
- queuepush(&q, p);
+ queue_push(&q, p);
}
}
if (s->suggests)
{
FOR_PROVIDES(p, pp, sug)
if (!MAPTST(m, p))
- queuepush(&q, p);
+ queue_push(&q, p);
}
}
}
- queuefree(&q);
+ queue_free(&q);
}
static void
Id obs, *obsp;
Solvable *ps;
- QUEUEEMPTY(qs);
+ queue_empty(qs);
/*
* s = solvable ptr
* n = solvable Id
}
else
continue;
- queuepush(qs, p);
+ queue_push(qs, p);
if (m && !MAPTST(m, p)) /* mark p for install if not already done */
addrulesforsolvable(solv, pool->solvables + p, m);
{
for (pp = solv->obsoletes_data + solv->obsoletes[n - solv->system->start]; (p = *pp++) != 0;)
{
- queuepush(qs, p);
+ queue_push(qs, p);
if (m && !MAPTST(m, p)) /* mark p for install if not already done */
addrulesforsolvable(solv, pool->solvables + p, m);
}
Queue qs;
Id qsbuf[64];
- queueinit_buffer(&qs, qsbuf, sizeof(qsbuf)/sizeof(*qsbuf));
+ queue_init_buffer(&qs, qsbuf, sizeof(qsbuf)/sizeof(*qsbuf));
findupdatepackages(solv, s, &qs, m, allowdowngrade, allowarchchange);
p = s - pool->solvables;
if (dontaddrule) /* we consider update candidates but dont force them */
{
- queuefree(&qs);
+ queue_free(&qs);
return;
}
printf("new update rule: must keep %s-%s.%s\n", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
#endif
addrule(solv, p, 0); /* request 'install' of s */
- queuefree(&qs);
+ queue_free(&qs);
return;
}
d = pool_queuetowhatprovides(pool, &qs); /* intern computed provider queue */
- queuefree(&qs);
+ queue_free(&qs);
r = addrule(solv, p, d); /* allow update of s */
#if 0
printf("new update rule ");
decisionmap[ow] = level;
else
decisionmap[-ow] = -level;
- queuepush(&solv->decisionq, ow);
- queuepush(&solv->decisionq_why, r - solv->rules);
+ queue_push(&solv->decisionq, ow);
+ queue_push(&solv->decisionq_why, r - solv->rules);
#if 0
{
Solvable *s = pool->solvables + (ow > 0 ? ow : -ow);
int learnt_why = solv->learnt_pool.count;
Id *decisionmap = solv->decisionmap;
- queueinit(&r);
+ queue_init(&r);
if (pool->verbose) printf("ANALYZE at %d ----------------------\n", level);
- mapinit(&seen, pool->nsolvables);
+ map_init(&seen, pool->nsolvables);
idx = solv->decisionq.count;
for (;;)
{
printrule(solv, c);
- queuepush(&solv->learnt_pool, c - solv->rules);
+ queue_push(&solv->learnt_pool, c - solv->rules);
dp = c->d ? pool->whatprovidesdata + c->d : 0;
for (i = -1; ; i++)
{
break;
if (j == solv->decisionq.count)
abort();
- queuepush(&rulq, -(j + 1));
+ queue_push(&rulq, -(j + 1));
#endif
continue; /* initial setting */
}
num++; /* need to do this one as well */
else
{
- queuepush(&r, v);
+ queue_push(&r, v);
#if 0
printf("PUSH %d ", v);
printruleelement(solv, 0, v);
printruleelement(solv, 0, v);
}
}
- mapfree(&seen);
- queuepush(&solv->learnt_pool, 0);
+ map_free(&seen);
+ queue_push(&solv->learnt_pool, 0);
#if 0
for (i = learnt_why; solv->learnt_pool.elements[i]; i++)
{
/* delete all learnt rules */
solv->nrules = solv->learntrules;
- QUEUEEMPTY(&solv->learnt_why);
- QUEUEEMPTY(&solv->learnt_pool);
+ queue_empty(&solv->learnt_why);
+ queue_empty(&solv->learnt_pool);
/* redo all direct rpm rule decisions */
/* we break at the first decision with a why attached, this is
else if (solv->problems.elements[i] == why)
return;
}
- queuepush(&solv->problems, why);
+ queue_push(&solv->problems, why);
}
printf("ANALYZE UNSOLVABLE ----------------------\n");
#endif
oldproblemcount = solv->problems.count;
- mapinit(&seen, pool->nsolvables);
+ map_init(&seen, pool->nsolvables);
analyze_unsolvable_rule(solv, r);
dp = r->d ? pool->whatprovidesdata + r->d : 0;
for (i = -1; ; i++)
MAPSET(&seen, vv);
}
}
- mapfree(&seen);
- queuepush(&solv->problems, 0); /* mark end of this problem */
+ map_free(&seen);
+ queue_push(&solv->problems, 0); /* mark end of this problem */
lastweak = 0;
if (solv->weakrules != solv->learntrules)
solv->decisionmap[decision] = level;
else
solv->decisionmap[-decision] = -level;
- queuepush(&solv->decisionq, decision);
- queuepush(&solv->decisionq_why, 0);
+ queue_push(&solv->decisionq, decision);
+ queue_push(&solv->decisionq_why, 0);
}
for (;;)
{
printf("%d %d\n", solv->learnt_why.count, (int)(r - solv->rules) - solv->learntrules);
abort();
}
- queuepush(&solv->learnt_why, why);
+ queue_push(&solv->learnt_why, why);
if (d)
{
/* at least 2 literals, needs watches */
addwatches(solv, r);
}
solv->decisionmap[p > 0 ? p : -p] = p > 0 ? level : -level;
- queuepush(&solv->decisionq, p);
- queuepush(&solv->decisionq_why, r - solv->rules);
+ queue_push(&solv->decisionq, p);
+ queue_push(&solv->decisionq_why, r - solv->rules);
printf("decision: ");
printruleelement(solv, 0, p);
printf("new rule: ");
solv->system = system;
pool->verbose = 1;
- queueinit(&solv->ruletojob);
- queueinit(&solv->decisionq);
- queueinit(&solv->decisionq_why);
- queueinit(&solv->problems);
- queueinit(&solv->suggestions);
- queueinit(&solv->learnt_why);
- queueinit(&solv->learnt_pool);
+ queue_init(&solv->ruletojob);
+ queue_init(&solv->decisionq);
+ queue_init(&solv->decisionq_why);
+ queue_init(&solv->problems);
+ queue_init(&solv->suggestions);
+ queue_init(&solv->learnt_why);
+ queue_init(&solv->learnt_pool);
- mapinit(&solv->recommendsmap, pool->nsolvables);
- mapinit(&solv->suggestsmap, pool->nsolvables);
+ map_init(&solv->recommendsmap, pool->nsolvables);
+ map_init(&solv->suggestsmap, pool->nsolvables);
solv->recommends_index = 0;
solv->decisionmap = (Id *)xcalloc(pool->nsolvables, sizeof(Id));
void
solver_free(Solver *solv)
{
- queuefree(&solv->ruletojob);
- queuefree(&solv->decisionq);
- queuefree(&solv->decisionq_why);
- queuefree(&solv->learnt_why);
- queuefree(&solv->learnt_pool);
- queuefree(&solv->problems);
- queuefree(&solv->suggestions);
-
- mapfree(&solv->recommendsmap);
- mapfree(&solv->suggestsmap);
+ queue_free(&solv->ruletojob);
+ queue_free(&solv->decisionq);
+ queue_free(&solv->decisionq_why);
+ queue_free(&solv->learnt_why);
+ queue_free(&solv->learnt_pool);
+ queue_free(&solv->problems);
+ queue_free(&solv->suggestions);
+
+ map_free(&solv->recommendsmap);
+ map_free(&solv->suggestsmap);
xfree(solv->decisionmap);
xfree(solv->rules);
xfree(solv->watches);
systemlevel = level + 1;
if (pool->verbose) printf("solving...\n");
- queueinit(&dq);
+ queue_init(&dq);
for (;;)
{
/*
if (analyze_unsolvable(solv, r, disablerules))
continue;
printf("UNSOLVABLE\n");
- queuefree(&dq);
+ queue_free(&dq);
return;
}
}
if (level == 0)
{
printf("UNSOLVABLE\n");
- queuefree(&dq);
+ queue_free(&dq);
return;
}
if (level <= olevel)
break;
if (solv->decisionmap[i] > 0 || (solv->decisionmap[i] < 0 && solv->weaksystemrules[i - solv->system->start] == 0))
continue;
- QUEUEEMPTY(&dq);
+ queue_empty(&dq);
if (solv->decisionmap[i] == 0)
- queuepush(&dq, i);
+ queue_push(&dq, i);
if (solv->weaksystemrules[i - solv->system->start])
{
dp = pool->whatprovidesdata + solv->weaksystemrules[i - solv->system->start];
if (solv->decisionmap[p] > 0)
break;
if (solv->decisionmap[p] == 0)
- queuepush(&dq, p);
+ queue_push(&dq, p);
}
if (p)
continue; /* rule is already true */
if (level == 0)
{
printf("UNSOLVABLE\n");
- queuefree(&dq);
+ queue_free(&dq);
return;
}
if (level <= olevel)
r = solv->rules + i;
if (!r->w1)
continue;
- QUEUEEMPTY(&dq);
+ queue_empty(&dq);
if (r->d == 0)
{
/* binary or unary rule */
continue;
if (solv->decisionmap[r->p] || solv->decisionmap[r->w2])
continue;
- queuepush(&dq, r->p);
- queuepush(&dq, r->w2);
+ queue_push(&dq, r->p);
+ queue_push(&dq, r->w2);
}
else
{
if (solv->decisionmap[r->p] > 0)
continue;
if (solv->decisionmap[r->p] == 0)
- queuepush(&dq, r->p);
+ queue_push(&dq, r->p);
}
dp = pool->whatprovidesdata + r->d;
while ((p = *dp++) != 0)
if (solv->decisionmap[p] > 0)
break;
if (solv->decisionmap[p] == 0)
- queuepush(&dq, p);
+ queue_push(&dq, p);
}
}
if (p)
if (level == 0)
{
printf("UNSOLVABLE\n");
- queuefree(&dq);
+ queue_free(&dq);
return;
}
if (level < systemlevel)
int qcount;
if (pool->verbose) printf("installing recommended packages\n");
- QUEUEEMPTY(&dq);
+ queue_empty(&dq);
for (i = 1; i < pool->nsolvables; i++)
{
if (solv->decisionmap[i] < 0)
break;
}
else if (solv->decisionmap[p] == 0)
- queuepushunique(&dq, p);
+ queue_pushunique(&dq, p);
}
}
}
if (!sup)
continue;
}
- queuepushunique(&dq, i);
+ queue_pushunique(&dq, i);
}
}
if (dq.count)
}
break;
}
- queuefree(&dq);
+ queue_free(&dq);
}
if (sug >= solv->jobrules && sug < solv->systemrules)
sugjob = solv->ruletojob.elements[sug - solv->jobrules];
- queueinit(&disabled);
- QUEUEEMPTY(refined);
- queuepush(refined, sug);
+ queue_init(&disabled);
+ queue_empty(refined);
+ queue_push(refined, sug);
/* re-enable all rules but rule "sug" of the problem */
revert(solv, 1);
r->w1 = solv->pool->whatprovidesdata[r->d];
}
- QUEUEEMPTY(&solv->problems);
+ queue_empty(&solv->problems);
revert(solv, 1); /* XXX move to reset_solver? */
reset_solver(solv);
run_solver(solv, 0, 0);
break;
if (problem[j])
continue;
- queuepush(&disabled, v);
- queuepush(&disabled, 0); /* room for watch */
+ queue_push(&disabled, v);
+ queue_push(&disabled, 0); /* room for watch */
}
if (disabled.count == disabledcnt)
{
if (disabled.count == disabledcnt + 2)
{
/* just one suggestion, add it to refined list */
- queuepush(refined, disabled.elements[disabledcnt]);
+ queue_push(refined, disabled.elements[disabledcnt]);
}
else
{
*
*/
- mapinit(&addedmap, pool->nsolvables);
- mapinit(&noupdaterule, pool->nsolvables);
+ map_init(&addedmap, pool->nsolvables);
+ map_init(&noupdaterule, pool->nsolvables);
- queueinit(&q);
+ queue_init(&q);
/*
* always install our system solvable
*/
MAPSET(&addedmap, SYSTEMSOLVABLE);
- queuepush(&solv->decisionq, SYSTEMSOLVABLE);
- queuepush(&solv->decisionq_why, 0);
+ queue_push(&solv->decisionq, SYSTEMSOLVABLE);
+ queue_push(&solv->decisionq_why, 0);
solv->decisionmap[SYSTEMSOLVABLE] = 1;
/*
break;
case SOLVER_INSTALL_SOLVABLE_NAME:
case SOLVER_INSTALL_SOLVABLE_PROVIDES:
- QUEUEEMPTY(&q);
+ queue_empty(&q);
FOR_PROVIDES(p, pp, what)
{
/* if by name, ensure that the name matches */
printf(">!> Installing %s from channel %s\n", id2str(pool, s->name), repo_name(s->repo));
}
addrule(solv, what, 0); /* install by Id */
- queuepush(&solv->ruletojob, i);
+ queue_push(&solv->ruletojob, i);
break;
case SOLVER_ERASE_SOLVABLE:
addrule(solv, -what, 0); /* remove by Id */
- queuepush(&solv->ruletojob, i);
+ queue_push(&solv->ruletojob, i);
MAPSET(&noupdaterule, what);
break;
case SOLVER_INSTALL_SOLVABLE_NAME: /* install by capability */
case SOLVER_INSTALL_SOLVABLE_PROVIDES:
- QUEUEEMPTY(&q);
+ queue_empty(&q);
FOR_PROVIDES(p, pp, what)
{
/* if by name, ensure that the name matches */
if (how == SOLVER_INSTALL_SOLVABLE_NAME && pool->solvables[p].name != what)
continue;
- queuepush(&q, p);
+ queue_push(&q, p);
}
if (!q.count)
{
/* no provider, make this an impossible rule */
- queuepush(&q, -SYSTEMSOLVABLE);
+ queue_push(&q, -SYSTEMSOLVABLE);
}
- p = queueshift(&q); /* get first provider */
+ p = queue_shift(&q); /* get first provider */
if (!q.count)
d = 0; /* single provider ? -> make assertion */
else
d = pool_queuetowhatprovides(pool, &q); /* get all providers */
addrule(solv, p, d); /* add 'requires' rule */
- queuepush(&solv->ruletojob, i);
+ queue_push(&solv->ruletojob, i);
break;
case SOLVER_ERASE_SOLVABLE_NAME: /* remove by capability */
case SOLVER_ERASE_SOLVABLE_PROVIDES:
continue;
addrule(solv, -p, 0); /* add 'remove' rule */
- queuepush(&solv->ruletojob, i);
+ queue_push(&solv->ruletojob, i);
MAPSET(&noupdaterule, p);
}
break;
case SOLVER_INSTALL_SOLVABLE_UPDATE: /* find update for solvable */
addupdaterule(solv, pool->solvables + what, &addedmap, 0, 0, 0);
- queuepush(&solv->ruletojob, i);
+ queue_push(&solv->ruletojob, i);
break;
}
}
}
/* free unneeded memory */
- mapfree(&addedmap);
- mapfree(&noupdaterule);
- queuefree(&q);
+ map_free(&addedmap);
+ map_free(&noupdaterule);
+ queue_free(&q);
solv->weakrules = solv->nrules;
if (!enh)
continue;
}
- queuepush(&solv->suggestions, i);
+ queue_push(&solv->suggestions, i);
}
prune_best_version_arch(pool, &solv->suggestions);
}
if (!pool->verbose)
return;
- clonequeue(&problems, &solv->problems);
- queueinit(&solution);
+ queue_clone(&problems, &solv->problems);
+ queue_init(&solution);
printf("Encountered problems! Here are the solutions:\n");
problem = problems.elements;
for (i = 0; i < problems.count; i++)
}
}
printf("------------------------------------\n");
- queuefree(&problems);
- queuefree(&solution);
+ queue_free(&problems);
+ queue_free(&solution);
}
return;
}