From: Stefan Schubert Date: Thu, 7 Feb 2008 09:20:01 +0000 (+0000) Subject: cleanup X-Git-Tag: BASE-SuSE-Code-12_1-Branch~308^2~656 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76ea7b706b7fb29d5aa79883fb276f8eb6fe036a;p=thirdparty%2Flibsolv.git cleanup --- diff --git a/src/policy.c b/src/policy.c index a7ac6361..58d47316 100644 --- a/src/policy.c +++ b/src/policy.c @@ -170,7 +170,7 @@ prune_to_recommended(Solver *solv, Queue *plist) plist->count = j; } -static void +void prune_to_best_arch(Pool *pool, Queue *plist) { Id a, bestscore; @@ -212,7 +212,7 @@ prune_to_best_arch(Pool *pool, Queue *plist) * */ -static void +void prune_to_best_version(Solver *solv, Queue *plist) { Pool *pool = solv->pool; @@ -296,9 +296,8 @@ prune_to_best_version(Solver *solv, Queue *plist) plist->count = j; } -/* legacy, do not use anymore! */ void -prune_best_version_arch(Solver *solv, Pool *pool, Queue *plist) +prune_best_arch_name_version(Solver *solv, Pool *pool, Queue *plist) { if (solv && solv->bestSolvableCb) { /* The application is responsible for */ @@ -324,7 +323,7 @@ policy_filter_unwanted(Solver *solv, Queue *plist, Id inst, int mode) if (inst) queue_push(plist, inst); - prune_best_version_arch (solv, pool, plist); + prune_best_arch_name_version (solv, pool, plist); } diff --git a/src/policy.h b/src/policy.h index ea77e25c..9050a3e7 100644 --- a/src/policy.h +++ b/src/policy.h @@ -7,7 +7,7 @@ /* * Generic policy interface for SAT solver - * + * The policy* function can be "overloaded" by defining a callback in the solver struct. */ #include "solver.h" @@ -16,10 +16,46 @@ #define POLICY_MODE_RECOMMEND 1 #define POLICY_MODE_SUGGEST 2 -extern void prune_best_version_arch(Solver *solv, Pool *pool, Queue *plist); +/* This functions can be used for sorting solvables to a specific order like architecture, version. */ +/* Solvables which does not fit to the system will be deleted from the list. */ +extern void prune_best_arch_name_version(Solver *solv, Pool *pool, Queue *plist); +extern void prune_to_best_arch(Pool *pool, Queue *plist); +extern void prune_to_best_version(Solver *solv, Queue *plist); -extern void policy_filter_unwanted(Solver *solv, Queue *plist, Id inst, int mode); +/* The following default policies can be overloaded by the application by using callbacks which are + * descibed in solver.h: + * + * Finding best candidate + * + * Callback definition: + * void bestSolvable (Pool *pool, Queue *canditates) + * candidates : List of canditates which has to be sorted by the function call + * return candidates: Sorted list of the candidates(first is the best). + * + * Checking if two solvables has compatible architectures + * + * Callback definition: + * int archCheck (Pool *pool, Solvable *solvable1, Solvable *solvable2); + * + * return 0 it the two solvables has compatible architectures + * + * Checking if two solvables has compatible vendors + * + * Callback definition: + * int vendorCheck (Pool *pool, Solvable *solvable1, Solvable *solvable2); + * + * return 0 it the two solvables has compatible architectures + * + * Evaluate update candidate + * + * Callback definition: + * void pdateCandidateCb (Pool *pool, Solvable *solvable, Queue *canditates) + * solvable : for which updates should be search + * candidates : List of candidates (This list depends on other + * restrictions like architecture and vendor policies too) + */ +extern void policy_filter_unwanted(Solver *solv, Queue *plist, Id inst, int mode); extern int policy_illegal_archchange(Solver *solv, Solvable *s1, Solvable *s2); extern int policy_illegal_vendorchange(Solver *solv, Solvable *s1, Solvable *s2); extern void policy_findupdatepackages(Solver *solv,