From: Michael Schroeder Date: Fri, 11 Apr 2008 10:07:01 +0000 (+0000) Subject: - beautfy, rename & document X-Git-Tag: BASE-SuSE-Code-12_1-Branch~308^2~417 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1f5def8a1645b5bad264d52fa698862bfca46c45;p=thirdparty%2Flibsolv.git - beautfy, rename & document --- diff --git a/src/pool.h b/src/pool.h index 965ce582..c29687a7 100644 --- a/src/pool.h +++ b/src/pool.h @@ -180,7 +180,8 @@ const char *solvable_lookup_checksum(Solvable *s, Id keyname, Id *typep); 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); diff --git a/src/solvable.c b/src/solvable.c index a0d96483..b4d5ddf0 100644 --- a/src/solvable.c +++ b/src/solvable.c @@ -359,6 +359,7 @@ solvable_get_location(Solvable *s, unsigned int *medianrp) return loc; } +/*****************************************************************************/ static inline Id dep2name(Pool *pool, Id dep) { @@ -384,6 +385,16 @@ static inline int providedbyinstalled(Pool *pool, Map *installed, Id dep) } /* + * 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 @@ solvable_trivial_installable_map(Solvable *s, Map *installedmap, Map *conflictsm } } } - if (0) + if (s->repo) { Repo *installed = 0; if (s->obsoletes && s->repo != installed) @@ -478,6 +489,11 @@ solvable_trivial_installable_map(Solvable *s, Map *installedmap, Map *conflictsm 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 @@ solvable_trivial_installable_queue(Solvable *s, Queue *installed) 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 @@ solvable_trivial_installable_repo(Solvable *s, Repo *installed) 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; diff --git a/src/solver.c b/src/solver.c index c21af311..33f63a81 100644 --- a/src/solver.c +++ b/src/solver.c @@ -4152,31 +4152,20 @@ solver_solve(Solver *solv, Queue *job) 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; diff --git a/src/solver.h b/src/solver.h index 383abe2d..f9ef7140 100644 --- a/src/solver.h +++ b/src/solver.h @@ -209,6 +209,7 @@ extern Id solver_next_solutionelement(Solver *solv, Id problem, Id solution, Id 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 @@ solver_is_enhancing(Solver *solv, Solvable *s) 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 */