Author: mlschroe Date: Fri Apr 11 15:47:17 2008 New Revision: 9538 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9538&view=rev Log: - add support for SOLVER_WEAKEN_SOLVABLE_DEPS, weakens requires of one solvable. Handle with care. Modified: trunk/sat-solver/src/solver.c trunk/sat-solver/src/solver.h Modified: trunk/sat-solver/src/solver.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.c?rev=9538&r1=9537&r2=9538&view=diff ============================================================================== --- trunk/sat-solver/src/solver.c (original) +++ trunk/sat-solver/src/solver.c Fri Apr 11 15:47:17 2008 @@ -3582,6 +3582,21 @@ } } +static void +weaken_solvable_deps(Solver *solv, Id p) +{ + int i; + Rule *r; + + for (i = 1, r = solv->rules + i; i < solv->jobrules; i++, r++) + { + if (r->p != -p) + continue; + if (r->d == 0 && r->w2 < 0) + continue; /* conflict */ + queue_push(&solv->weakruleq, i); + } +} /*-----------------------------------------------------------------*/ /* main() */ @@ -3742,7 +3757,7 @@ { case SOLVER_INSTALL_SOLVABLE: /* install specific solvable */ s = pool->solvables + what; - POOL_DEBUG(SAT_DEBUG_JOB, "job: install solvable %s\n", solvable2str(pool, s)); + POOL_DEBUG(SAT_DEBUG_JOB, "job: %sinstall solvable %s\n", weak ? "weak " : "", solvable2str(pool, s)); addrule(solv, what, 0); /* install by Id */ queue_push(&solv->ruletojob, i); if (weak) @@ -3750,7 +3765,7 @@ break; case SOLVER_ERASE_SOLVABLE: s = pool->solvables + what; - POOL_DEBUG(SAT_DEBUG_JOB, "job: erase solvable %s\n", solvable2str(pool, s)); + 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) @@ -3759,9 +3774,9 @@ case SOLVER_INSTALL_SOLVABLE_NAME: /* install by capability */ case SOLVER_INSTALL_SOLVABLE_PROVIDES: if (how == SOLVER_INSTALL_SOLVABLE_NAME) - POOL_DEBUG(SAT_DEBUG_JOB, "job: install name %s\n", dep2str(pool, what)); + POOL_DEBUG(SAT_DEBUG_JOB, "job: %sinstall name %s\n", weak ? "weak " : "", dep2str(pool, what)); if (how == SOLVER_INSTALL_SOLVABLE_PROVIDES) - POOL_DEBUG(SAT_DEBUG_JOB, "job: install provides %s\n", dep2str(pool, what)); + POOL_DEBUG(SAT_DEBUG_JOB, "job: %sinstall provides %s\n", weak ? "weak " : "", dep2str(pool, what)); queue_empty(&q); name = (how == SOLVER_INSTALL_SOLVABLE_NAME) ? what : 0; while (ISRELDEP(name)) @@ -3795,9 +3810,9 @@ case SOLVER_ERASE_SOLVABLE_NAME: /* remove by capability */ case SOLVER_ERASE_SOLVABLE_PROVIDES: if (how == SOLVER_ERASE_SOLVABLE_NAME) - POOL_DEBUG(SAT_DEBUG_JOB, "job: erase name %s\n", dep2str(pool, what)); + POOL_DEBUG(SAT_DEBUG_JOB, "job: %serase name %s\n", weak ? "weak " : "", dep2str(pool, what)); if (how == SOLVER_ERASE_SOLVABLE_PROVIDES) - POOL_DEBUG(SAT_DEBUG_JOB, "job: erase provides %s\n", dep2str(pool, what)); + POOL_DEBUG(SAT_DEBUG_JOB, "job: %serase provides %s\n", weak ? "weak " : "", dep2str(pool, what)); name = (how == SOLVER_ERASE_SOLVABLE_NAME) ? what : 0; while (ISRELDEP(name)) { @@ -3817,14 +3832,14 @@ break; case SOLVER_INSTALL_SOLVABLE_UPDATE: /* find update for solvable */ s = pool->solvables + what; - POOL_DEBUG(SAT_DEBUG_JOB, "job: update %s\n", solvable2str(pool, s)); + POOL_DEBUG(SAT_DEBUG_JOB, "job: %supdate %s\n", weak ? "weak " : "", solvable2str(pool, s)); addupdaterule(solv, s, 0); queue_push(&solv->ruletojob, i); if (weak) queue_push(&solv->weakruleq, solv->nrules - 1); break; case SOLVER_INSTALL_SOLVABLE_ONE_OF: - POOL_DEBUG(SAT_DEBUG_JOB, "job: one of\n"); + POOL_DEBUG(SAT_DEBUG_JOB, "job: %sone of\n", weak ? "weak " : ""); for (pp = pool->whatprovidesdata + what; *pp; pp++) POOL_DEBUG(SAT_DEBUG_JOB, " %s\n", solvable2str(pool, pool->solvables + *pp)); addrule(solv, -SYSTEMSOLVABLE, what); @@ -3832,6 +3847,11 @@ if (weak) queue_push(&solv->weakruleq, solv->nrules - 1); break; + case SOLVER_WEAKEN_SOLVABLE_DEPS: + s = pool->solvables + what; + POOL_DEBUG(SAT_DEBUG_JOB, "job: weaken deps %s\n", solvable2str(pool, s)); + weaken_solvable_deps(solv, what); + break; } IF_POOLDEBUG (SAT_DEBUG_JOB) { Modified: trunk/sat-solver/src/solver.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.h?rev=9538&r1=9537&r2=9538&view=diff ============================================================================== --- trunk/sat-solver/src/solver.h (original) +++ trunk/sat-solver/src/solver.h Fri Apr 11 15:47:17 2008 @@ -182,6 +182,7 @@ SOLVER_ERASE_SOLVABLE_PROVIDES, SOLVER_INSTALL_SOLVABLE_UPDATE, SOLVER_INSTALL_SOLVABLE_ONE_OF, + SOLVER_WEAKEN_SOLVABLE_DEPS, SOLVER_WEAK = 0x100, } SolverCmd; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org