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