Author: mlschroe Date: Fri Apr 11 12:07:01 2008 New Revision: 9526 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9526&view=rev Log: - beautfy, rename & document Modified: trunk/sat-solver/src/pool.h trunk/sat-solver/src/solvable.c trunk/sat-solver/src/solver.c trunk/sat-solver/src/solver.h Modified: trunk/sat-solver/src/pool.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.h?rev=9526&r1=9525&r2=9526&view=diff ============================================================================== --- trunk/sat-solver/src/pool.h (original) +++ trunk/sat-solver/src/pool.h Fri Apr 11 12:07:01 2008 @@ -180,7 +180,8 @@ int solvable_trivial_installable_map(Solvable *s, Map *installedmap, Map *conflictsmap); int solvable_trivial_installable_repo(Solvable *s, struct _Repo *installed); int solvable_trivial_installable_queue(Solvable *s, Queue *installed); -void create_trivial_installable_maps(Pool *pool, Queue *installed, Map *installedmap, Map *conflictsmap); + +void pool_create_state_maps(Pool *pool, Queue *installed, Map *installedmap, Map *conflictsmap); Modified: trunk/sat-solver/src/solvable.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solvable.c?rev=9526&r1=9525&r2=9526&view=diff ============================================================================== --- trunk/sat-solver/src/solvable.c (original) +++ trunk/sat-solver/src/solvable.c Fri Apr 11 12:07:01 2008 @@ -359,6 +359,7 @@ return loc; } +/*****************************************************************************/ static inline Id dep2name(Pool *pool, Id dep) { @@ -384,6 +385,16 @@ } /* + * solvable_trivial_installable_map - anwers is a solvable is installable + * without any other installs/deinstalls. + * The packages considered to be installed are provided via the + * installedmap bitmap. A additional "conflictsmap" bitmap providing + * information about the conflicts of the installed packages can be + * used for extra speed up. Provide a NULL pointer if you do not + * have this information. + * Both maps can be created with pool_create_state_maps() or + * solver_create_state_maps(). + * * returns: * 1: solvable is installable without any other package changes * 0: solvable is not installable @@ -431,7 +442,7 @@ } } } - if (0) + if (s->repo) { Repo *installed = 0; if (s->obsoletes && s->repo != installed) @@ -478,6 +489,11 @@ return interesting ? 1 : -1; } +/* + * different interface for solvable_trivial_installable_map, where + * the information about the installed packages is provided + * by a queue. + */ int solvable_trivial_installable_queue(Solvable *s, Queue *installed) { @@ -499,6 +515,11 @@ return r; } +/* + * different interface for solvable_trivial_installable_map, where + * the information about the installed packages is provided + * by a repo containing the installed solvables. + */ int solvable_trivial_installable_repo(Solvable *s, Repo *installed) { @@ -516,8 +537,19 @@ return r; } + +/*****************************************************************************/ + +/* + * Create maps containing the state of each solvable. Input is a "installed" queue, + * it contains all solvable ids that are considered to be installed. + * + * The created maps can be used for solvable_trivial_installable_map(), + * pool_calc_duchanges(), pool_calc_installsizechange(). + * + */ void -create_trivial_installable_maps(Pool *pool, Queue *installed, Map *installedmap, Map *conflictsmap) +pool_create_state_maps(Pool *pool, Queue *installed, Map *installedmap, Map *conflictsmap) { int i; Solvable *s; Modified: trunk/sat-solver/src/solver.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.c?rev=9526&r1=9525&r2=9526&view=diff ============================================================================== --- trunk/sat-solver/src/solver.c (original) +++ trunk/sat-solver/src/solver.c Fri Apr 11 12:07:01 2008 @@ -4152,31 +4152,20 @@ void solver_calc_duchanges(Solver *solv, DUChanges *mps, int nmps) { - Pool *pool = solv->pool; Map installedmap; - Id p; - int i; - map_init(&installedmap, pool->nsolvables); - for (i = 1; i < solv->decisionq.count; i++) - if ((p = solv->decisionq.elements[i]) > 0) - MAPSET(&installedmap, p); - pool_calc_duchanges(pool, solv->installed, &installedmap, mps, nmps); + solver_create_state_maps(solv, &installedmap, 0); + pool_calc_duchanges(solv->pool, solv->installed, &installedmap, mps, nmps); map_free(&installedmap); } int solver_calc_installsizechange(Solver *solv) { - Pool *pool = solv->pool; Map installedmap; - Id p; - int i, change; + int change; - map_init(&installedmap, pool->nsolvables); - for (i = 1; i < solv->decisionq.count; i++) - if ((p = solv->decisionq.elements[i]) > 0) - MAPSET(&installedmap, p); + solver_create_state_maps(solv, &installedmap, 0); change = pool_calc_installsizechange(solv->pool, solv->installed, &installedmap); map_free(&installedmap); return change; Modified: trunk/sat-solver/src/solver.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.h?rev=9526&r1=9525&r2=9526&view=diff ============================================================================== --- trunk/sat-solver/src/solver.h (original) +++ trunk/sat-solver/src/solver.h Fri Apr 11 12:07:01 2008 @@ -209,6 +209,7 @@ extern Id solver_findproblemrule(Solver *solv, Id problem); extern SolverProbleminfo solver_problemruleinfo(Solver *solv, Queue *job, Id rid, Id *depp, Id *sourcep, Id *targetp); +/* XXX: why is this not static? */ Id *create_decisions_obsoletesmap(Solver *solv); /* debug functions, do not use */ @@ -287,5 +288,10 @@ void solver_calc_duchanges(Solver *solv, DUChanges *mps, int nmps); int solver_calc_installsizechange(Solver *solv); +static inline void +solver_create_state_maps(Solver *solv, Map *installedmap, Map *conflictsmap) +{ + pool_create_state_maps(solv->pool, &solv->decisionq, installedmap, conflictsmap); +} #endif /* SATSOLVER_SOLVER_H */ -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org