2 * Copyright (c) 2007, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
9 * Generic policy interface for SAT solver
10 * The policy* function can be "overloaded" by defining a callback in the solver struct.
15 #define POLICY_MODE_CHOOSE 0
16 #define POLICY_MODE_RECOMMEND 1
17 #define POLICY_MODE_SUGGEST 2
19 /* This functions can be used for sorting solvables to a specific order like architecture, version. */
20 /* Solvables which does not fit to the system will be deleted from the list. */
21 extern void prune_best_arch_name_version(Solver *solv, Pool *pool, Queue *plist);
22 extern void prune_to_best_arch(Pool *pool, Queue *plist);
23 extern void prune_to_best_version(Solver *solv, Queue *plist);
26 /* The following default policies can be overloaded by the application by using callbacks which are
27 * descibed in solver.h:
29 * Finding best candidate
31 * Callback definition:
32 * void bestSolvable (Pool *pool, Queue *canditates)
33 * candidates : List of canditates which has to be sorted by the function call
34 * return candidates: Sorted list of the candidates(first is the best).
36 * Checking if two solvables has compatible architectures
38 * Callback definition:
39 * int archCheck (Pool *pool, Solvable *solvable1, Solvable *solvable2);
41 * return 0 it the two solvables has compatible architectures
43 * Checking if two solvables has compatible vendors
45 * Callback definition:
46 * int vendorCheck (Pool *pool, Solvable *solvable1, Solvable *solvable2);
48 * return 0 it the two solvables has compatible architectures
50 * Evaluate update candidate
52 * Callback definition:
53 * void pdateCandidateCb (Pool *pool, Solvable *solvable, Queue *canditates)
54 * solvable : for which updates should be search
55 * candidates : List of candidates (This list depends on other
56 * restrictions like architecture and vendor policies too)
58 extern void policy_filter_unwanted(Solver *solv, Queue *plist, Id inst, int mode);
59 extern int policy_illegal_archchange(Solver *solv, Solvable *s1, Solvable *s2);
60 extern int policy_illegal_vendorchange(Solver *solv, Solvable *s1, Solvable *s2);
61 extern void policy_findupdatepackages(Solver *solv,
64 int allowall); /* do not regard policies for vendor,architecuture,... change */