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(const Solver *solv, Pool *pool, Queue *plist);
23 extern void prune_to_best_arch(const Pool *pool, Queue *plist);
24 extern void prune_to_best_version(Pool *pool, Queue *plist);
27 /* The following default policies can be overloaded by the application by using callbacks which are
28 * descibed in solver.h:
30 * Finding best candidate
32 * Callback definition:
33 * void bestSolvable (Pool *pool, Queue *canditates)
34 * candidates : List of canditates which has to be sorted by the function call
35 * return candidates: Sorted list of the candidates(first is the best).
37 * Checking if two solvables has compatible architectures
39 * Callback definition:
40 * int archCheck (Pool *pool, Solvable *solvable1, Solvable *solvable2);
42 * return 0 it the two solvables has compatible architectures
44 * Checking if two solvables has compatible vendors
46 * Callback definition:
47 * int vendorCheck (Pool *pool, Solvable *solvable1, Solvable *solvable2);
49 * return 0 it the two solvables has compatible architectures
51 * Evaluate update candidate
53 * Callback definition:
54 * void pdateCandidateCb (Pool *pool, Solvable *solvable, Queue *canditates)
55 * solvable : for which updates should be search
56 * candidates : List of candidates (This list depends on other
57 * restrictions like architecture and vendor policies too)
60 #define POLICY_ILLEGAL_DOWNGRADE 1
61 #define POLICY_ILLEGAL_ARCHCHANGE 2
62 #define POLICY_ILLEGAL_VENDORCHANGE 4
64 extern void policy_filter_unwanted(Solver *solv, Queue *plist, int mode);
65 extern int policy_illegal_archchange(Solver *solv, Solvable *s1, Solvable *s2);
66 extern int policy_illegal_vendorchange(Solver *solv, Solvable *s1, Solvable *s2);
67 extern int policy_is_illegal(Solver *solv, Solvable *s1, Solvable *s2, int ignore);
68 extern void policy_findupdatepackages(Solver *solv,
71 int allowall); /* do not regard policies for vendor,architecuture,... change */
73 extern void policy_create_obsolete_index(Solver *solv);