From: Michael Schroeder Date: Wed, 17 Oct 2007 13:19:20 +0000 (+0000) Subject: - inline source_name function X-Git-Tag: BASE-SuSE-Code-12_1-Branch~308^2~918 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5da331165df06c10581edea99be1a57330c6d9f1;p=thirdparty%2Flibsolv.git - inline source_name function - fix dependency resolving loop to restart on any action - fix supplement rule creation, it did not work for complex (i.e. AND) supplements --- diff --git a/src/solver.c b/src/solver.c index 4b29e2d6..5dacf257 100644 --- a/src/solver.c +++ b/src/solver.c @@ -107,6 +107,32 @@ dep_fulfilled(Solver *solv, Id dep) return 0; } +static inline int +dep_possible(Solver *solv, Id dep, Map *m) +{ + Pool *pool = solv->pool; + Id p, *pp; + + if (ISRELDEP(dep)) + { + Reldep *rd = GETRELDEP(pool, dep); + if (rd->flags == REL_AND) + { + if (!dep_possible(solv, rd->name, m)) + return 0; + return dep_possible(solv, rd->evr, m); + } + if (rd->flags == REL_NAMESPACE && rd->name == NAMESPACE_INSTALLED) + return dep_installed(solv, rd->evr); + } + FOR_PROVIDES(p, pp, dep) + { + if (MAPTST(m, p)) + return 1; + } + return 0; +} + /* * prune_to_recommended * @@ -876,7 +902,6 @@ addrulesforsupplements(Solver *solv, Map *m) Pool *pool = solv->pool; Solvable *s; Id sup, *supp; - Id p, *pp; int i, n; if (pool->verbose) printf("addrulesforsupplements... (%d)\n", solv->nrules); @@ -893,27 +918,13 @@ addrulesforsupplements(Solver *solv, Map *m) continue; sup = 0; if ((supp = s->supplements) != 0) - { - while ((sup = *supp++) != ID_NULL) - { - FOR_PROVIDES(p, pp, sup) - if (MAPTST(m, p)) - break; - if (p) - break; - } - } + while ((sup = *supp++) != ID_NULL) + if (dep_possible(solv, sup, m)) + break; if (!sup && (supp = s->freshens) != 0) - { - while ((sup = *supp++) != ID_NULL) - { - FOR_PROVIDES(p, pp, sup) - if (MAPTST(m, p)) - break; - if (p) - break; - } - } + while ((sup = *supp++) != ID_NULL) + if (dep_possible(solv, sup, m)) + break; if (!sup) continue; addrulesforsolvable(solv, s, m); @@ -2078,8 +2089,7 @@ run_solver(Solver *solv, int disablerules, int doweak) } if (level < systemlevel) break; - if (level <= olevel) - n = 0; + n = 0; } /* for(), decide */ if (n != solv->nrules) /* continue if level < systemlevel */ diff --git a/src/source.c b/src/source.c index 15042ee2..ed9cb8ef 100644 --- a/src/source.c +++ b/src/source.c @@ -16,16 +16,6 @@ #define IDARRAY_BLOCK 4095 -/* - * get name of source - */ - -const char * -source_name(const Source *source) -{ - return source->name; -} - /* * create empty source diff --git a/src/source.h b/src/source.h index 6a511f87..a26830b3 100644 --- a/src/source.h +++ b/src/source.h @@ -28,5 +28,9 @@ extern unsigned int source_fix_legacy(Source *source, unsigned int provides, uns extern Source *pool_addsource_empty(Pool *pool); -extern const char *source_name(const Source *source); +static inline const char *source_name(const Source *source) +{ + return source->name; +} + #endif /* SOURCE_H */