1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
/*
* Copyright (c) 2011, Novell Inc.
*
* This program is licensed under the BSD license, read LICENSE.BSD
* for further information
*/
/*
* solver_private.h - private functions
*
*/
#ifndef LIBSOLV_SOLVER_PRIVATE_H
#define LIBSOLV_SOLVER_PRIVATE_H
extern void solver_run_sat(Solver *solv, int disablerules, int doweak);
extern void solver_reset(Solver *solv);
extern int solver_splitprovides(Solver *solv, Id dep, Map *m);
static inline int
solver_dep_fulfilled(Solver *solv, Id dep)
{
Pool *pool = solv->pool;
Id p, pp;
if (ISRELDEP(dep))
{
Reldep *rd = GETRELDEP(pool, dep);
if (rd->flags == REL_COND)
{
if (ISRELDEP(rd->evr))
{
Reldep *rd2 = GETRELDEP(pool, rd->evr);
if (rd2->flags == REL_ELSE)
{
if (solver_dep_fulfilled(solv, rd2->name))
return solver_dep_fulfilled(solv, rd->name);
return solver_dep_fulfilled(solv, rd2->evr);
}
}
if (solver_dep_fulfilled(solv, rd->name))
return 1;
return !solver_dep_fulfilled(solv, rd->evr);
}
if (rd->flags == REL_AND)
{
if (!solver_dep_fulfilled(solv, rd->name))
return 0;
return solver_dep_fulfilled(solv, rd->evr);
}
if (rd->flags == REL_OR)
{
if (solver_dep_fulfilled(solv, rd->name))
return 1;
return solver_dep_fulfilled(solv, rd->evr);
}
if (rd->flags == REL_NAMESPACE && rd->name == NAMESPACE_SPLITPROVIDES)
return solver_splitprovides(solv, rd->evr, 0);
}
FOR_PROVIDES(p, pp, dep)
{
if (solv->decisionmap[p] > 0)
return 1;
}
return 0;
}
static inline int
solver_is_supplementing(Solver *solv, Solvable *s)
{
Id sup, *supp;
if (!s->supplements)
return 0;
supp = s->repo->idarraydata + s->supplements;
while ((sup = *supp++) != 0)
if (solver_dep_fulfilled(solv, sup))
return 1;
return 0;
}
static inline int
solver_is_enhancing(Solver *solv, Solvable *s)
{
Id enh, *enhp;
if (!s->enhances)
return 0;
enhp = s->repo->idarraydata + s->enhances;
while ((enh = *enhp++) != 0)
if (solver_dep_fulfilled(solv, enh))
return 1;
return 0;
}
#endif /* LIBSOLV_SOLVER_PRIVATE_H */
|