Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 141 lines (115 sloc) 4.157 kB
77c1182 @mlschroe - split rule generation from solver.c into rules.c
mlschroe authored
1 /*
2 * Copyright (c) 2007-2009, Novell Inc.
3 *
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
6 */
7
8 /*
9 * rules.h
10 *
11 */
12
4cd5d62 @mlschroe rename satsolver -> libsolv
mlschroe authored
13 #ifndef LIBSOLV_RULES_H
14 #define LIBSOLV_RULES_H
77c1182 @mlschroe - split rule generation from solver.c into rules.c
mlschroe authored
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 /* ----------------------------------------------
21 * Rule
22 *
23 * providerN(B) == Package Id of package providing tag B
24 * N = 1, 2, 3, in case of multiple providers
25 *
26 * A requires B : !A | provider1(B) | provider2(B)
27 *
28 * A conflicts B : (!A | !provider1(B)) & (!A | !provider2(B)) ...
29 *
30 * 'not' is encoded as a negative Id
31 *
32 * Binary rule: p = first literal, d = 0, w2 = second literal, w1 = p
33 *
34 * There are a lot of rules, so the struct is kept as small as
35 * possible. Do not add new members unless there is no other way.
36 */
37
38 typedef struct _Rule {
39 Id p; /* first literal in rule */
40 Id d; /* Id offset into 'list of providers terminated by 0' as used by whatprovides; pool->whatprovides + d */
41 /* in case of binary rules, d == 0, w1 == p, w2 == other literal */
42 /* in case of disabled rules: ~d, aka -d - 1 */
43 Id w1, w2; /* watches, literals not-yet-decided */
44 /* if !w2, assertion, not rule */
45 Id n1, n2; /* next rules in linked list, corresponding to w1, w2 */
46 } Rule;
47
48
49 typedef enum {
50 SOLVER_RULE_UNKNOWN = 0,
51 SOLVER_RULE_RPM = 0x100,
52 SOLVER_RULE_RPM_NOT_INSTALLABLE,
53 SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP,
54 SOLVER_RULE_RPM_PACKAGE_REQUIRES,
55 SOLVER_RULE_RPM_SELF_CONFLICT,
56 SOLVER_RULE_RPM_PACKAGE_CONFLICT,
57 SOLVER_RULE_RPM_SAME_NAME,
58 SOLVER_RULE_RPM_PACKAGE_OBSOLETES,
59 SOLVER_RULE_RPM_IMPLICIT_OBSOLETES,
395b110 @mlschroe Also look at obsoletes of installed packages, like newer versions of …
mlschroe authored
60 SOLVER_RULE_RPM_INSTALLEDPKG_OBSOLETES,
77c1182 @mlschroe - split rule generation from solver.c into rules.c
mlschroe authored
61 SOLVER_RULE_UPDATE = 0x200,
62 SOLVER_RULE_FEATURE = 0x300,
63 SOLVER_RULE_JOB = 0x400,
64 SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP,
65 SOLVER_RULE_DISTUPGRADE = 0x500,
66 SOLVER_RULE_INFARCH = 0x600,
cce9570 @mlschroe - add experimental support for choice rules to fix #485409
mlschroe authored
67 SOLVER_RULE_CHOICE = 0x700,
68 SOLVER_RULE_LEARNT = 0x800
77c1182 @mlschroe - split rule generation from solver.c into rules.c
mlschroe authored
69 } SolverRuleinfo;
70
71 #define SOLVER_RULE_TYPEMASK 0xff00
72
73 struct _Solver;
74
75 /*-------------------------------------------------------------------
76 * disable rule
77 */
78
79 static inline void
80 solver_disablerule(struct _Solver *solv, Rule *r)
81 {
82 if (r->d >= 0)
83 r->d = -r->d - 1;
84 }
85
86 /*-------------------------------------------------------------------
87 * enable rule
88 */
89
90 static inline void
91 solver_enablerule(struct _Solver *solv, Rule *r)
92 {
93 if (r->d < 0)
94 r->d = -r->d - 1;
95 }
96
76fb56c @mlschroe [backend] more introspection: solver_ruleliterals, solver_rule2jobidx…
mlschroe authored
97 extern Rule *solver_addrule(struct _Solver *solv, Id p, Id d);
98 extern void solver_unifyrules(struct _Solver *solv);
99 extern int solver_samerule(struct _Solver *solv, Rule *r1, Rule *r2);
ee15afa @mlschroe - move rest of rule functions from solver.c to rules.c
mlschroe authored
100
101 /* rpm rules */
76fb56c @mlschroe [backend] more introspection: solver_ruleliterals, solver_rule2jobidx…
mlschroe authored
102 extern void solver_addrpmrulesforsolvable(struct _Solver *solv, Solvable *s, Map *m);
103 extern void solver_addrpmrulesforweak(struct _Solver *solv, Map *m);
104 extern void solver_addrpmrulesforupdaters(struct _Solver *solv, Solvable *s, Map *m, int allow_all);
ee15afa @mlschroe - move rest of rule functions from solver.c to rules.c
mlschroe authored
105
106 /* update/feature rules */
76fb56c @mlschroe [backend] more introspection: solver_ruleliterals, solver_rule2jobidx…
mlschroe authored
107 extern void solver_addupdaterule(struct _Solver *solv, Solvable *s, int allow_all);
ee15afa @mlschroe - move rest of rule functions from solver.c to rules.c
mlschroe authored
108
109 /* infarch rules */
76fb56c @mlschroe [backend] more introspection: solver_ruleliterals, solver_rule2jobidx…
mlschroe authored
110 extern void solver_addinfarchrules(struct _Solver *solv, Map *addedmap);
ee15afa @mlschroe - move rest of rule functions from solver.c to rules.c
mlschroe authored
111
112 /* dup rules */
76fb56c @mlschroe [backend] more introspection: solver_ruleliterals, solver_rule2jobidx…
mlschroe authored
113 extern void solver_createdupmaps(struct _Solver *solv);
114 extern void solver_freedupmaps(struct _Solver *solv);
115 extern void solver_addduprules(struct _Solver *solv, Map *addedmap);
116
117 /* choice rules */
118 extern void solver_addchoicerules(struct _Solver *solv);
119 extern void solver_disablechoicerules(struct _Solver *solv, Rule *r);
ee15afa @mlschroe - move rest of rule functions from solver.c to rules.c
mlschroe authored
120
121 /* policy rule disabling/reenabling */
76fb56c @mlschroe [backend] more introspection: solver_ruleliterals, solver_rule2jobidx…
mlschroe authored
122 extern void solver_disablepolicyrules(struct _Solver *solv);
123 extern void solver_reenablepolicyrules(struct _Solver *solv, int jobidx);
baca23f @mlschroe - fix cleandeps mistake handling
mlschroe authored
124 extern void solver_reenablepolicyrules_cleandeps(struct _Solver *solv, Id pkg);
ee15afa @mlschroe - move rest of rule functions from solver.c to rules.c
mlschroe authored
125
126 /* rule info */
76fb56c @mlschroe [backend] more introspection: solver_ruleliterals, solver_rule2jobidx…
mlschroe authored
127 extern int solver_allruleinfos(struct _Solver *solv, Id rid, Queue *rq);
128 extern SolverRuleinfo solver_ruleinfo(struct _Solver *solv, Id rid, Id *fromp, Id *top, Id *depp);
4c6908c @mlschroe - hide solver internals
mlschroe authored
129 extern SolverRuleinfo solver_ruleclass(struct _Solver *solv, Id rid);
76fb56c @mlschroe [backend] more introspection: solver_ruleliterals, solver_rule2jobidx…
mlschroe authored
130 extern void solver_ruleliterals(struct _Solver *solv, Id rid, Queue *q);
131 extern int solver_rule2jobidx(struct _Solver *solv, Id rid);
132 extern Id solver_rule2job(struct _Solver *solv, Id rid, Id *whatp);
77c1182 @mlschroe - split rule generation from solver.c into rules.c
mlschroe authored
133
134
135 #ifdef __cplusplus
136 }
137 #endif
138
139 #endif
140
Something went wrong with that request. Please try again.