/*-------------------------------------------------------------------
* Check if dependency is possible
*
- * mirrors solver_dep_fulfilled but uses map m instead of the decisionmap
- * used in solver_addrpmrulesforweak and solver_createcleandepsmap
+ * mirrors solver_dep_fulfilled but uses map m instead of the decisionmap.
+ * used in solver_addrpmrulesforweak and solver_createcleandepsmap.
*/
static inline int
}
int
-solver_samerule(Solver *solv, Rule *r1, Rule *r2)
+solver_rulecmp(Solver *solv, Rule *r1, Rule *r2)
{
return unifyrules_sortcmp(r1, r2, solv->pool);
}
return r;
}
+void
+solver_shrinkrules(Solver *solv, int nrules)
+{
+ solv->nrules = nrules;
+ solv->rules = solv_extend_resize(solv->rules, solv->nrules, sizeof(Rule), RULES_BLOCK);
+}
/******************************************************************************
***
dontfix = 1; /* dont care about broken rpm deps */
}
- if (!dontfix
- && s->arch != ARCH_SRC
- && s->arch != ARCH_NOSRC
- && !pool_installable(pool, s))
+ if (!dontfix)
{
- POOL_DEBUG(SOLV_DEBUG_RULE_CREATION, "package %s [%d] is not installable\n", pool_solvable2str(pool, s), (Id)(s - pool->solvables));
- addrpmrule(solv, -n, 0, SOLVER_RULE_RPM_NOT_INSTALLABLE, 0);
+ if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC
+ ? pool_disabled_solvable(pool, s)
+ : !pool_installable(pool, s))
+ {
+ POOL_DEBUG(SOLV_DEBUG_RULE_CREATION, "package %s [%d] is not installable\n", pool_solvable2str(pool, s), (Id)(s - pool->solvables));
+ addrpmrule(solv, -n, 0, SOLVER_RULE_RPM_NOT_INSTALLABLE, 0);
+ }
}
/* yet another SUSE hack, sigh */
continue;
s = pool->solvables + i;
- if (!pool_installable(pool, s)) /* only look at installable ones */
+ if (!s->repo)
continue;
+ if (s->repo != pool->installed && !pool_installable(pool, s))
+ continue; /* only look at installable ones */
sup = 0;
if (s->supplements)
***
***/
+static inline void
+add_cleandeps_package(Solver *solv, Id p)
+{
+ if (!solv->cleandeps_updatepkgs)
+ {
+ solv->cleandeps_updatepkgs = solv_calloc(1, sizeof(Queue));
+ queue_init(solv->cleandeps_updatepkgs);
+ }
+ queue_pushunique(solv->cleandeps_updatepkgs, p);
+}
+
+static inline void
+solver_addtodupmaps(Solver *solv, Id p, Id how, int targeted)
+{
+ Pool *pool = solv->pool;
+ Solvable *ps, *s = pool->solvables + p;
+ Repo *installed = solv->installed;
+ Id pi, pip, obs, *obsp;
+
+ MAPSET(&solv->dupinvolvedmap, p);
+ if (targeted)
+ MAPSET(&solv->dupmap, p);
+ FOR_PROVIDES(pi, pip, s->name)
+ {
+ ps = pool->solvables + pi;
+ if (ps->name != s->name)
+ continue;
+ MAPSET(&solv->dupinvolvedmap, pi);
+ if (targeted && ps->repo == installed && solv->obsoletes && solv->obsoletes[pi - installed->start])
+ {
+ Id *opp, pi2;
+ for (opp = solv->obsoletes_data + solv->obsoletes[pi - installed->start]; (pi2 = *opp++) != 0;)
+ if (pool->solvables[pi2].repo != installed)
+ MAPSET(&solv->dupinvolvedmap, pi2);
+ }
+ if (ps->repo == installed && (how & SOLVER_FORCEBEST) != 0)
+ {
+ if (!solv->bestupdatemap.size)
+ map_grow(&solv->bestupdatemap, installed->end - installed->start);
+ MAPSET(&solv->bestupdatemap, pi - installed->start);
+ }
+ if (ps->repo == installed && (how & SOLVER_CLEANDEPS) != 0)
+ add_cleandeps_package(solv, pi);
+ if (!targeted && ps->repo != installed)
+ MAPSET(&solv->dupmap, pi);
+ }
+ if (s->repo == installed && solv->obsoletes && solv->obsoletes[p - installed->start])
+ {
+ Id *opp;
+ for (opp = solv->obsoletes_data + solv->obsoletes[p - installed->start]; (pi = *opp++) != 0;)
+ {
+ ps = pool->solvables + pi;
+ if (ps->repo == installed)
+ continue;
+ MAPSET(&solv->dupinvolvedmap, pi);
+ if (!targeted)
+ MAPSET(&solv->dupmap, pi);
+ }
+ }
+ if (targeted && s->repo != installed && s->obsoletes)
+ {
+ /* XXX: check obsoletes/provides combination */
+ obsp = s->repo->idarraydata + s->obsoletes;
+ while ((obs = *obsp++) != 0)
+ {
+ FOR_PROVIDES(pi, pip, obs)
+ {
+ Solvable *ps = pool->solvables + pi;
+ if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, ps, obs))
+ continue;
+ if (pool->obsoleteusescolors && !pool_colormatch(pool, s, ps))
+ continue;
+ MAPSET(&solv->dupinvolvedmap, pi);
+ if (targeted && ps->repo == installed && solv->obsoletes && solv->obsoletes[pi - installed->start])
+ {
+ Id *opp, pi2;
+ for (opp = solv->obsoletes_data + solv->obsoletes[pi - installed->start]; (pi2 = *opp++) != 0;)
+ if (pool->solvables[pi2].repo != installed)
+ MAPSET(&solv->dupinvolvedmap, pi2);
+ }
+ if (ps->repo == installed && (how & SOLVER_FORCEBEST) != 0)
+ {
+ if (!solv->bestupdatemap.size)
+ map_grow(&solv->bestupdatemap, installed->end - installed->start);
+ MAPSET(&solv->bestupdatemap, pi - installed->start);
+ }
+ if (ps->repo == installed && (how & SOLVER_CLEANDEPS) != 0)
+ add_cleandeps_package(solv, pi);
+ }
+ }
+ }
+}
+
void
solver_createdupmaps(Solver *solv)
{
Queue *job = &solv->job;
Pool *pool = solv->pool;
- Repo *repo;
Repo *installed = solv->installed;
- Id select, how, what, p, pi, pp, pip, obs, *obsp;
- Solvable *s, *ps;
- int i;
+ Id select, how, what, p, pp;
+ Solvable *s;
+ int i, targeted;
map_init(&solv->dupmap, pool->nsolvables);
map_init(&solv->dupinvolvedmap, pool->nsolvables);
switch (how & SOLVER_JOBMASK)
{
case SOLVER_DISTUPGRADE:
- if (select != SOLVER_SOLVABLE_REPO)
+ if (select == SOLVER_SOLVABLE_REPO)
{
- int haveinstalled;
- p = 0;
- if (installed)
+ Repo *repo;
+ if (what <= 0 || what > pool->nrepos)
+ break;
+ repo = pool_id2repo(pool, what);
+ if (!repo)
+ break;
+ if (repo != installed && !(how & SOLVER_TARGETED) && solv->noautotarget)
+ break;
+ targeted = repo != installed || (how & SOLVER_TARGETED) != 0;
+ FOR_REPO_SOLVABLES(repo, p, s)
+ {
+ if (repo != installed && !pool_installable(pool, s))
+ continue;
+ solver_addtodupmaps(solv, p, how, targeted);
+ }
+ }
+ else
+ {
+ targeted = how & SOLVER_TARGETED ? 1 : 0;
+ if (installed && !targeted && !solv->noautotarget)
{
FOR_JOB_SELECT(p, pp, select, what)
if (pool->solvables[p].repo == installed)
break;
+ targeted = p == 0;
}
- haveinstalled = p != 0;
+ else if (!installed && !solv->noautotarget)
+ targeted = 1;
FOR_JOB_SELECT(p, pp, select, what)
{
Solvable *s = pool->solvables + p;
if (!s->repo)
continue;
- if (haveinstalled && s->repo != installed)
+ if (s->repo != installed && !targeted)
continue;
if (s->repo != installed && !pool_installable(pool, s))
continue;
- MAPSET(&solv->dupinvolvedmap, p);
- if (!haveinstalled)
- MAPSET(&solv->dupmap, p);
- FOR_PROVIDES(pi, pip, s->name)
- {
- ps = pool->solvables + pi;
- if (ps->name != s->name)
- continue;
- MAPSET(&solv->dupinvolvedmap, pi);
- if (ps->repo == installed && (how & SOLVER_FORCEBEST) != 0)
- {
- if (!solv->bestupdatemap.size)
- map_grow(&solv->bestupdatemap, installed->end - installed->start);
- MAPSET(&solv->bestupdatemap, pi - installed->start);
- }
- if (haveinstalled && ps->repo != installed)
- MAPSET(&solv->dupmap, pi);
- }
- if (haveinstalled)
- {
- if (solv->obsoletes && solv->obsoletes[p - installed->start])
- {
- Id *opp;
- for (opp = solv->obsoletes_data + solv->obsoletes[p - installed->start]; (pi = *opp++) != 0;)
- {
- ps = pool->solvables + pi;
- if (ps->repo == installed)
- continue;
- MAPSET(&solv->dupinvolvedmap, pi);
- MAPSET(&solv->dupmap, pi);
- }
- }
- }
- else if (s->obsoletes)
- {
- /* XXX: check obsoletes/provides combination */
- obsp = s->repo->idarraydata + s->obsoletes;
- while ((obs = *obsp++) != 0)
- {
- FOR_PROVIDES(pi, pp, obs)
- {
- Solvable *ps = pool->solvables + pi;
- if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, ps, obs))
- continue;
- if (pool->obsoleteusescolors && !pool_colormatch(pool, s, ps))
- continue;
- MAPSET(&solv->dupinvolvedmap, pi);
- if (ps->repo == installed && (how & SOLVER_FORCEBEST) != 0)
- {
- if (!solv->bestupdatemap.size)
- map_grow(&solv->bestupdatemap, installed->end - installed->start);
- MAPSET(&solv->bestupdatemap, pi - installed->start);
- }
- }
- }
- }
- }
- break;
- }
- if (what <= 0 || what > pool->nrepos)
- break;
- repo = pool_id2repo(pool, what);
- FOR_REPO_SOLVABLES(repo, p, s)
- {
- if (repo != installed && !pool_installable(pool, s))
- continue;
- MAPSET(&solv->dupmap, p);
- FOR_PROVIDES(pi, pip, s->name)
- {
- ps = pool->solvables + pi;
- if (ps->name != s->name)
- continue;
- MAPSET(&solv->dupinvolvedmap, pi);
- if (ps->repo == installed && (how & SOLVER_FORCEBEST) != 0)
- {
- if (!solv->bestupdatemap.size)
- map_grow(&solv->bestupdatemap, installed->end - installed->start);
- MAPSET(&solv->bestupdatemap, pi - installed->start);
- }
- }
- if (s->obsoletes)
- {
- /* XXX: check obsoletes/provides combination */
- obsp = s->repo->idarraydata + s->obsoletes;
- while ((obs = *obsp++) != 0)
- {
- FOR_PROVIDES(pi, pp, obs)
- {
- Solvable *ps = pool->solvables + pi;
- if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, ps, obs))
- continue;
- if (pool->obsoleteusescolors && !pool_colormatch(pool, s, ps))
- continue;
- MAPSET(&solv->dupinvolvedmap, pi);
- if (ps->repo == installed && (how & SOLVER_FORCEBEST) != 0)
- {
- if (!solv->bestupdatemap.size)
- map_grow(&solv->bestupdatemap, installed->end - installed->start);
- MAPSET(&solv->bestupdatemap, pi - installed->start);
- }
- }
- }
+ solver_addtodupmaps(solv, p, how, targeted);
}
}
break;
solver_reenablepolicyrules(Solver *solv, int jobidx)
{
Queue *job = &solv->job;
- int i, j;
+ int i, j, k, ai;
Queue q, allq;
Rule *r;
Id lastjob = -1;
- Id qbuf[32], allqbuf[128];
+ Id qbuf[32], allqbuf[32];
queue_init_buffer(&q, qbuf, sizeof(qbuf)/sizeof(*qbuf));
- queue_init_buffer(&allq, allqbuf, sizeof(allqbuf)/sizeof(*allqbuf));
jobtodisablelist(solv, job->elements[jobidx - 1], job->elements[jobidx], &q);
if (!q.count)
- return;
+ {
+ queue_free(&q);
+ return;
+ }
+ /* now remove everything from q that is disabled by other jobs */
+
+ /* first remove cleandeps packages, they count as DISABLE_UPDATE */
+ if (solv->cleandepsmap.size)
+ {
+ solver_createcleandepsmap(solv, &solv->cleandepsmap, 0);
+ for (j = k = 0; j < q.count; j += 2)
+ {
+ if (q.elements[j] == DISABLE_UPDATE)
+ {
+ Id p = q.elements[j + 1];
+ if (p >= solv->installed->start && p < solv->installed->end && MAPTST(&solv->cleandepsmap, p - solv->installed->start))
+ continue; /* remove element from q */
+ }
+ q.elements[k++] = q.elements[j];
+ q.elements[k++] = q.elements[j + 1];
+ }
+ q.count = k;
+ if (!q.count)
+ {
+ queue_free(&q);
+ return;
+ }
+ }
+
+ /* now go through the disable list of all other jobs */
+ queue_init_buffer(&allq, allqbuf, sizeof(allqbuf)/sizeof(*allqbuf));
for (i = solv->jobrules; i < solv->jobrules_end; i++)
{
r = solv->rules + i;
continue;
lastjob = j;
jobtodisablelist(solv, job->elements[j], job->elements[j + 1], &allq);
+ if (!allq.count)
+ continue;
+ /* remove all elements in allq from q */
+ for (j = k = 0; j < q.count; j += 2)
+ {
+ Id type = q.elements[j], arg = q.elements[j + 1];
+ for (ai = 0; ai < allq.count; ai += 2)
+ if (allq.elements[ai] == type && allq.elements[ai + 1] == arg)
+ break;
+ if (ai < allq.count)
+ continue; /* found it in allq, remove element from q */
+ q.elements[k++] = q.elements[j];
+ q.elements[k++] = q.elements[j + 1];
+ }
+ q.count = k;
+ if (!q.count)
+ {
+ queue_free(&q);
+ queue_free(&allq);
+ return;
+ }
+ queue_empty(&allq);
}
- if (solv->cleandepsmap.size)
- {
- solver_createcleandepsmap(solv, &solv->cleandepsmap, 0);
- for (i = solv->installed->start; i < solv->installed->end; i++)
- if (MAPTST(&solv->cleandepsmap, i - solv->installed->start))
- queue_push2(&allq, DISABLE_UPDATE, i);
- }
+ queue_free(&allq);
+
+ /* now re-enable anything that's left in q */
for (j = 0; j < q.count; j += 2)
{
Id type = q.elements[j], arg = q.elements[j + 1];
- for (i = 0; i < allq.count; i += 2)
- if (allq.elements[i] == type && allq.elements[i + 1] == arg)
- break;
- if (i < allq.count)
- continue; /* still disabled */
switch(type)
{
case DISABLE_UPDATE:
break;
}
}
- queue_free(&allq);
queue_free(&q);
}
*depp = solv->job.elements[jidx + 1];
if ((r->d == 0 || r->d == -1) && r->w2 == 0 && r->p == -SYSTEMSOLVABLE)
{
- if ((solv->job.elements[jidx] & SOLVER_SELECTMASK) == SOLVER_SOLVABLE_NAME)
+ if ((solv->job.elements[jidx] & (SOLVER_JOBMASK|SOLVER_SELECTMASK)) == (SOLVER_INSTALL|SOLVER_SOLVABLE_NAME))
return SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP;
- if ((solv->job.elements[jidx] & SOLVER_SELECTMASK) == SOLVER_SOLVABLE_PROVIDES)
+ if ((solv->job.elements[jidx] & (SOLVER_JOBMASK|SOLVER_SELECTMASK)) == (SOLVER_INSTALL|SOLVER_SOLVABLE_PROVIDES))
return SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP;
+ if ((solv->job.elements[jidx] & (SOLVER_JOBMASK|SOLVER_SELECTMASK)) == (SOLVER_ERASE|SOLVER_SOLVABLE_NAME))
+ return SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM;
+ if ((solv->job.elements[jidx] & (SOLVER_JOBMASK|SOLVER_SELECTMASK)) == (SOLVER_ERASE|SOLVER_SOLVABLE_PROVIDES))
+ return SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM;
}
return SOLVER_RULE_JOB;
}
solver_ruleliterals(Solver *solv, Id rid, Queue *q)
{
Pool *pool = solv->pool;
- Id p, *pp;
+ Id p, pp;
Rule *r;
queue_empty(q);
Rule *r;
Queue q, qi;
int i, j, rid, havechoice;
- Id p, d, *pp;
+ Id p, d, pp;
Id p2, pp2;
Solvable *s, *s2;
Id lastaddedp, lastaddedd;
if (i == q.count)
continue; /* already added that one */
}
-
d = q.count ? pool_queuetowhatprovides(pool, &q) : 0;
- solver_addrule(solv, r->p, d);
- queue_push(&solv->weakruleq, solv->nrules - 1);
- solv->choicerules_ref[solv->nrules - 1 - solv->choicerules] = rid;
+
lastaddedp = r->p;
lastaddedd = d;
lastaddedcnt = q.count;
+
+ solver_addrule(solv, r->p, d);
+ queue_push(&solv->weakruleq, solv->nrules - 1);
+ solv->choicerules_ref[solv->nrules - 1 - solv->choicerules] = rid;
#if 0
printf("OLD ");
solver_printrule(solv, SOLV_DEBUG_RESULT, solv->rules + rid);
void
solver_disablechoicerules(Solver *solv, Rule *r)
{
- Id rid, p, *pp;
+ Id rid, p, pp;
Pool *pool = solv->pool;
Map m;
Rule *or;
if ((solv->job.elements[i] & (SOLVER_JOBMASK | SOLVER_FORCEBEST)) == (SOLVER_INSTALL | SOLVER_FORCEBEST))
{
int j;
- Id p2, *pp2;
+ Id p2, pp2;
for (j = 0; j < solv->ruletojob.count; j++)
if (solv->ruletojob.elements[j] == i)
break;
{
FOR_REPO_SOLVABLES(installed, p, s)
{
- Id d, p2, *pp2;
+ Id d, p2, pp2;
if (!solv->updatemap_all && (!solv->updatemap.size || !MAPTST(&solv->updatemap, p - installed->start)))
continue;
if (!solv->bestupdatemap_all && (!solv->bestupdatemap.size || !MAPTST(&solv->bestupdatemap, p - installed->start)))
queue_push(q, p);
}
+static int
+check_xsupp(Solver *solv, Queue *depq, Id dep)
+{
+ Pool *pool = solv->pool;
+ Id p, pp;
+
+ if (ISRELDEP(dep))
+ {
+ Reldep *rd = GETRELDEP(pool, dep);
+ if (rd->flags >= 8)
+ {
+ if (rd->flags == REL_AND)
+ {
+ if (!check_xsupp(solv, depq, rd->name))
+ return 0;
+ return check_xsupp(solv, depq, rd->evr);
+ }
+ if (rd->flags == REL_OR)
+ {
+ if (check_xsupp(solv, depq, rd->name))
+ return 1;
+ return check_xsupp(solv, depq, rd->evr);
+ }
+ if (rd->flags == REL_NAMESPACE && rd->name == NAMESPACE_SPLITPROVIDES)
+ return solver_splitprovides(solv, rd->evr);
+ if (rd->flags == REL_NAMESPACE && rd->name == NAMESPACE_INSTALLED)
+ return solver_dep_installed(solv, rd->evr);
+ }
+ if (depq && rd->flags == REL_NAMESPACE)
+ {
+ int i;
+ for (i = 0; i < depq->count; i++)
+ if (depq->elements[i] == dep || depq->elements[i] == rd->name)
+ return 1;
+ }
+ }
+ FOR_PROVIDES(p, pp, dep)
+ if (p == SYSTEMSOLVABLE || pool->solvables[p].repo == solv->installed)
+ return 1;
+ return 0;
+}
+
+static inline int
+queue_contains(Queue *q, Id id)
+{
+ int i;
+ for (i = 0; i < q->count; i++)
+ if (q->elements[i] == id)
+ return 1;
+ return 0;
+}
+
+
/*
* Find all installed packages that are no longer
* needed regarding the current solver job.
Map installedm;
Rule *r;
Id rid, how, what, select;
- Id p, pp, ip, *jp;
+ Id p, pp, ip, jp;
Id req, *reqp, sup, *supp;
Solvable *s;
- Queue iq;
+ Queue iq, iqcopy, xsuppq;
int i;
map_empty(cleandepsmap);
map_init(&im, pool->nsolvables);
map_init(&installedm, pool->nsolvables);
queue_init(&iq);
+ queue_init(&xsuppq);
for (i = 0; i < job->count; i += 2)
{
if (pool->solvables[p].repo == installed)
MAPSET(&userinstalled, p - installed->start);
}
+ if ((how & (SOLVER_JOBMASK | SOLVER_SELECTMASK)) == (SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES))
+ {
+ what = job->elements[i + 1];
+ if (ISRELDEP(what))
+ {
+ Reldep *rd = GETRELDEP(pool, what);
+ if (rd->flags != REL_NAMESPACE)
+ continue;
+ if (rd->evr == 0)
+ {
+ queue_pushunique(&iq, rd->name);
+ continue;
+ }
+ FOR_PROVIDES(p, pp, what)
+ if (p)
+ break;
+ if (p)
+ continue;
+ queue_pushunique(&iq, what);
+ }
+ }
+ }
+
+ /* have special namespace cleandeps erases */
+ if (iq.count)
+ {
+ for (ip = solv->installed->start; ip < solv->installed->end; ip++)
+ {
+ s = pool->solvables + ip;
+ if (s->repo != installed)
+ continue;
+ if (!s->supplements)
+ continue;
+ supp = s->repo->idarraydata + s->supplements;
+ while ((sup = *supp++) != 0)
+ if (check_xsupp(solv, &iq, sup) && !check_xsupp(solv, 0, sup))
+ {
+#ifdef CLEANDEPSDEBUG
+ printf("xsupp %s from %s\n", pool_dep2str(pool, sup), pool_solvid2str(pool, ip));
+#endif
+ queue_pushunique(&xsuppq, sup);
+ }
+ }
+ queue_empty(&iq);
}
/* also add visible patterns to userinstalled for openSUSE */
if (di.solvid <= 0)
continue;
s = pool->solvables + di.solvid;
- if (!s->requires)
+ if (!s->repo || !s->requires)
continue;
- if (!pool_installable(pool, s))
+ if (s->repo != installed && !pool_installable(pool, s))
continue;
if (strncmp(pool_id2str(pool, s->name), "pattern:", 8) != 0)
continue;
for (rid = solv->jobrules; rid < solv->jobrules_end; rid++)
{
r = solv->rules + rid;
- if (r->d < 0)
+ if (r->d < 0) /* disabled? */
continue;
- if (r->d == 0 && r->p < 0 && r->w2 == 0)
+ if (r->d == 0 && r->p < 0 && r->w2 == 0) /* negative assertion (erase job)? */
{
p = -r->p;
if (pool->solvables[p].repo != installed)
if ((how & (SOLVER_JOBMASK|SOLVER_CLEANDEPS)) == (SOLVER_ERASE|SOLVER_CLEANDEPS))
queue_push(&iq, p);
}
- else if (r->p > 0)
+ else if (r->p > 0) /* install job */
{
if (unneeded)
continue;
}
}
}
+ queue_init_clone(&iqcopy, &iq);
if (!unneeded)
{
continue;
MAPSET(&im, p);
}
+ MAPSET(&installedm, SYSTEMSOLVABLE);
+ MAPSET(&im, SYSTEMSOLVABLE);
#ifdef CLEANDEPSDEBUG
printf("REMOVE PASS\n");
if (unneeded)
break;
/* supplements pass */
- for (ip = solv->installed->start; ip < solv->installed->end; ip++)
+ for (ip = installed->start; ip < installed->end; ip++)
{
if (!MAPTST(&installedm, ip))
continue;
{
supp = s->repo->idarraydata + s->supplements;
while ((sup = *supp++) != 0)
- if (dep_possible(solv, sup, &installedm))
+ if (dep_possible(solv, sup, &installedm) || (xsuppq.count && queue_contains(&xsuppq, sup)))
{
/* no longer supplemented, also erase */
int iqcount = iq.count;
}
queue_truncate(&iq, iqcount);
#ifdef CLEANDEPSDEBUG
- printf("%s supplemented\n", pool_solvid2str(pool, ip));
+ printf("%s supplemented [%s]\n", pool_solvid2str(pool, ip), pool_dep2str(pool, sup));
#endif
queue_push(&iq, ip);
}
}
}
if (!iq.count)
- break;
+ break; /* no supplementing package found, we're done */
}
ip = queue_shift(&iq);
s = pool->solvables + ip;
#endif
FOR_PROVIDES(p, pp, req)
{
- if (MAPTST(&im, p))
+ if (p != SYSTEMSOLVABLE && MAPTST(&im, p))
{
#ifdef CLEANDEPSDEBUG
printf("%s requires %s\n", pool_solvid2str(pool, ip), pool_solvid2str(pool, p));
#endif
FOR_PROVIDES(p, pp, req)
{
- if (MAPTST(&im, p))
+ if (p != SYSTEMSOLVABLE && MAPTST(&im, p))
{
#ifdef CLEANDEPSDEBUG
printf("%s recommends %s\n", pool_solvid2str(pool, ip), pool_solvid2str(pool, p));
if (pool->solvables[p].repo == installed)
MAPSET(&userinstalled, p - installed->start);
}
+ MAPSET(&im, SYSTEMSOLVABLE); /* in case we cleared it above */
for (p = installed->start; p < installed->end; p++)
if (MAPTST(&im, p))
queue_push(&iq, p);
while ((req = *reqp++) != 0)
{
FOR_PROVIDES(p, pp, req)
+ if (MAPTST(&im, p))
+ break;
+ if (p)
+ continue;
+ FOR_PROVIDES(p, pp, req)
{
if (!MAPTST(&im, p) && MAPTST(&installedm, p))
{
while ((req = *reqp++) != 0)
{
FOR_PROVIDES(p, pp, req)
+ if (MAPTST(&im, p))
+ break;
+ if (p)
+ continue;
+ FOR_PROVIDES(p, pp, req)
{
if (!MAPTST(&im, p) && MAPTST(&installedm, p))
{
}
queue_free(&iq);
+ /* make sure the updatepkgs and mistakes are not in the cleandeps map */
if (solv->cleandeps_updatepkgs)
for (i = 0; i < solv->cleandeps_updatepkgs->count; i++)
MAPSET(&im, solv->cleandeps_updatepkgs->elements[i]);
if (solv->cleandeps_mistakes)
for (i = 0; i < solv->cleandeps_mistakes->count; i++)
MAPSET(&im, solv->cleandeps_mistakes->elements[i]);
+ /* also remove original iq packages */
+ for (i = 0; i < iqcopy.count; i++)
+ MAPSET(&im, iqcopy.elements[i]);
+ queue_free(&iqcopy);
for (p = installed->start; p < installed->end; p++)
{
if (pool->solvables[p].repo != installed)
map_free(&im);
map_free(&installedm);
map_free(&userinstalled);
+ queue_free(&xsuppq);
+#ifdef CLEANDEPSDEBUG
+ printf("=== final cleandeps map:\n");
+ for (p = installed->start; p < installed->end; p++)
+ if (MAPTST(cleandepsmap, p - installed->start))
+ printf(" - %s\n", pool_solvid2str(pool, p));
+#endif
}