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);
return loc;
}
+/*****************************************************************************/
static inline Id dep2name(Pool *pool, 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
}
}
}
- if (0)
+ if (s->repo)
{
Repo *installed = 0;
if (s->obsoletes && s->repo != installed)
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)
{
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)
{
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;
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;
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 */
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 */