satsolver  0.17.2
policy.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007, Novell Inc.
3  *
4  * This program is licensed under the BSD license, read LICENSE.BSD
5  * for further information
6  */
7 
8 /*
9  * Generic policy interface for SAT solver
10  * The policy* function can be "overloaded" by defining a callback in the solver struct.
11  */
12 
13 #include "solver.h"
14 
15 #define POLICY_MODE_CHOOSE 0
16 #define POLICY_MODE_RECOMMEND 1
17 #define POLICY_MODE_SUGGEST 2
18 
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);
22 
23 extern void prune_to_best_arch(const Pool *pool, Queue *plist);
24 extern void prune_to_best_version(Pool *pool, Queue *plist);
25 
26 
27 /* The following default policies can be overloaded by the application by using callbacks which are
28  * descibed in solver.h:
29  *
30  * Finding best candidate
31  *
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).
36  *
37  * Checking if two solvables has compatible architectures
38  *
39  * Callback definition:
40  * int archCheck (Pool *pool, Solvable *solvable1, Solvable *solvable2);
41  *
42  * return 0 it the two solvables has compatible architectures
43  *
44  * Checking if two solvables has compatible vendors
45  *
46  * Callback definition:
47  * int vendorCheck (Pool *pool, Solvable *solvable1, Solvable *solvable2);
48  *
49  * return 0 it the two solvables has compatible architectures
50  *
51  * Evaluate update candidate
52  *
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)
58  */
59 
60 #define POLICY_ILLEGAL_DOWNGRADE 1
61 #define POLICY_ILLEGAL_ARCHCHANGE 2
62 #define POLICY_ILLEGAL_VENDORCHANGE 4
63 
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,
69  Solvable *s,
70  Queue *qs,
71  int allowall); /* do not regard policies for vendor,architecuture,... change */
72 
73 extern void policy_create_obsolete_index(Solver *solv);
74