Author: mlschroe Date: Fri Oct 24 14:54:29 2008 New Revision: 11482 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11482&view=rev Log: - backport support for SOLVER_ERASE_SOLVABLE, may be used to fix bug #438438 Modified: branches/SuSE-Linux-11_0-Branch/sat-solver/src/solver.c Modified: branches/SuSE-Linux-11_0-Branch/sat-solver/src/solver.c URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-11_0-Branch/sat-solver/src/solver.c?rev=11482&r1=11481&r2=11482&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/sat-solver/src/solver.c (original) +++ branches/SuSE-Linux-11_0-Branch/sat-solver/src/solver.c Fri Oct 24 14:54:29 2008 @@ -3867,7 +3867,8 @@ int i; int oldnrules; Map addedmap; /* '1' == have rpm-rules for solvable */ - Id how, what, weak, p, *pp, d; + Map installcandidatemap; + Id how, what, name, weak, p, *pp, d; Queue q, redoq; Solvable *s; int goterase; @@ -3917,6 +3918,7 @@ } map_init(&addedmap, pool->nsolvables); + map_init(&installcandidatemap, pool->nsolvables); queue_init(&q); /* @@ -3961,6 +3963,7 @@ switch(how) { case SOLVER_INSTALL_SOLVABLE: + MAPSET(&installcandidatemap, what); addrpmrulesforsolvable(solv, pool->solvables + what, &addedmap); break; case SOLVER_INSTALL_SOLVABLE_NAME: @@ -3970,6 +3973,7 @@ /* if by name, ensure that the name matches */ if (how == SOLVER_INSTALL_SOLVABLE_NAME && !pool_match_nevr(pool, pool->solvables + p, what)) continue; + MAPSET(&installcandidatemap, p); addrpmrulesforsolvable(solv, pool->solvables + p, &addedmap); } break; @@ -4171,10 +4175,36 @@ case SOLVER_ERASE_SOLVABLE: s = pool->solvables + what; POOL_DEBUG(SAT_DEBUG_JOB, "job: %serase solvable %s\n", weak ? "weak " : "", solvable2str(pool, s)); - addrule(solv, -what, 0); /* remove by Id */ - queue_push(&solv->ruletojob, i); - if (weak) - queue_push(&solv->weakruleq, solv->nrules - 1); + name = s->name; + if (solv->installed && s->repo == solv->installed) + { + FOR_PROVIDES(p, pp, s->name) + { + s = pool->solvables + p; + if (s->name != name) + continue; + if (p != what) + { + /* keep other versions installed */ + if (s->repo == solv->installed) + continue; + /* keep installcandidates of other jobs */ + if (MAPTST(&installcandidatemap, p)) + continue; + } + addrule(solv, -p, 0); /* remove by Id */ + queue_push(&solv->ruletojob, i); + if (weak) + queue_push(&solv->weakruleq, solv->nrules - 1); + } + } + else + { + addrule(solv, -what, 0); /* remove by Id */ + queue_push(&solv->ruletojob, i); + if (weak) + queue_push(&solv->weakruleq, solv->nrules - 1); + } break; case SOLVER_INSTALL_SOLVABLE_NAME: /* install by capability */ case SOLVER_INSTALL_SOLVABLE_PROVIDES: @@ -4282,6 +4312,7 @@ /* free unneeded memory */ map_free(&addedmap); + map_free(&installcandidatemap); queue_free(&q); /* create weak map */ -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org