- move create_obsolete_index to policy.c
[platform/upstream/libsolv.git] / src / policy.h
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(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);
24
25
26 /* The following default policies can be overloaded by the application by using callbacks which are
27  * descibed in solver.h:
28  *  
29  *  Finding best candidate
30  * 
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).
35  *
36  * Checking if two solvables has compatible architectures
37  *
38  * Callback definition:
39  *     int  archCheck (Pool *pool, Solvable *solvable1, Solvable *solvable2);
40  *     
41  *     return 0 it the two solvables has compatible architectures
42  *
43  * Checking if two solvables has compatible vendors
44  *
45  * Callback definition:
46  *     int  vendorCheck (Pool *pool, Solvable *solvable1, Solvable *solvable2);
47  *     
48  *     return 0 it the two solvables has compatible architectures
49  *
50  * Evaluate update candidate
51  *
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)
57  */   
58 extern void policy_filter_unwanted(Solver *solv, Queue *plist, 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,
62                                       Solvable *s,
63                                       Queue *qs,
64                                       int allowall); /* do not regard policies for vendor,architecuture,... change */
65
66 extern void policy_create_obsolete_index(Solver *solv);
67