diff options
author | Michael Schroeder <mls@suse.de> | 2009-03-02 16:05:09 +0100 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2009-03-02 16:05:09 +0100 |
commit | 33a18aaa8a472016c2fa8c0e1ce51a108209d01e (patch) | |
tree | ccd4bc581870a7d1dde21978fbebc8fe59e295b4 | |
parent | 753351f561983cee4027d1db2e0b351e45aa9746 (diff) | |
download | libsolv-33a18aaa8a472016c2fa8c0e1ce51a108209d01e.tar.gz libsolv-33a18aaa8a472016c2fa8c0e1ce51a108209d01e.tar.bz2 libsolv-33a18aaa8a472016c2fa8c0e1ce51a108209d01e.zip |
- frontport solver_trivial_installable() change
-rw-r--r-- | src/pool.c | 37 | ||||
-rw-r--r-- | src/pool.h | 1 | ||||
-rw-r--r-- | src/solver.c | 10 | ||||
-rw-r--r-- | src/solver.h | 1 | ||||
-rw-r--r-- | src/solverdebug.c | 5 |
5 files changed, 44 insertions, 10 deletions
@@ -1392,7 +1392,23 @@ static inline Id dep2name(Pool *pool, Id dep) return dep; } -static inline int providedbyinstalled(Pool *pool, unsigned char *map, Id dep, int ispatch) +static int providedbyinstalled_multiversion(Pool *pool, unsigned char *map, Id n, Id dep) +{ + Id p, pp; + Solvable *sn = pool->solvables + n; + + FOR_PROVIDES(p, pp, sn->name) + { + Solvable *s = pool->solvables + p; + if (s->name != sn->name || s->arch != sn->arch) + continue; + if ((map[p] & 9) == 9) + return 1; + } + return 0; +} + +static inline int providedbyinstalled(Pool *pool, unsigned char *map, Id dep, int ispatch, Map *noobsoletesmap) { Id p, pp; int r = 0; @@ -1402,6 +1418,9 @@ static inline int providedbyinstalled(Pool *pool, unsigned char *map, Id dep, in return 1; /* always boring, as never constraining */ if (ispatch && !pool_match_nevr(pool, pool->solvables + p, dep)) continue; + if (ispatch && noobsoletesmap && noobsoletesmap->size && MAPTST(noobsoletesmap, p) && ISRELDEP(dep)) + if (providedbyinstalled_multiversion(pool, map, p, dep)) + continue; if ((map[p] & 9) == 9) return 9; r |= map[p] & 17; @@ -1421,7 +1440,7 @@ static inline int providedbyinstalled(Pool *pool, unsigned char *map, Id dep, in */ void -pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res) +pool_trivial_installable_noobsoletesmap(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res, Map *noobsoletesmap) { int i, r, m, did; Id p, *dp, con, *conp, req, *reqp; @@ -1469,7 +1488,7 @@ pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res) { if (req == SOLVABLE_PREREQMARKER) continue; - r = providedbyinstalled(pool, map, req, 0); + r = providedbyinstalled(pool, map, req, 0, 0); if (!r) { /* decided and miss */ @@ -1492,7 +1511,7 @@ pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res) conp = s->repo->idarraydata + s->conflicts; while ((con = *conp++) != 0) { - if ((providedbyinstalled(pool, map, con, ispatch) & 1) != 0) + if ((providedbyinstalled(pool, map, con, ispatch, noobsoletesmap) & 1) != 0) { map[p] = 2; break; @@ -1500,7 +1519,7 @@ pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res) if ((m == 1 || m == 17) && ISRELDEP(con)) { con = dep2name(pool, con); - if ((providedbyinstalled(pool, map, con, ispatch) & 1) != 0) + if ((providedbyinstalled(pool, map, con, ispatch, noobsoletesmap) & 1) != 0) m = 9; } } @@ -1517,7 +1536,7 @@ pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res) obsp = s->repo->idarraydata + s->obsoletes; while ((obs = *obsp++) != 0) { - if ((providedbyinstalled(pool, map, obs, 0) & 1) != 0) + if ((providedbyinstalled(pool, map, obs, 0, 0) & 1) != 0) { map[p] = 2; break; @@ -1561,4 +1580,10 @@ pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res) free(map); } +void +pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res) +{ + pool_trivial_installable_noobsoletesmap(pool, installedmap, pkgs, res, 0); +} + // EOF @@ -293,6 +293,7 @@ typedef struct _duchanges { void pool_calc_duchanges(Pool *pool, Map *installedmap, DUChanges *mps, int nmps); int pool_calc_installsizechange(Pool *pool, Map *installedmap); void pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res); +void pool_trivial_installable_noobsoletesmap(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res, Map *noobsoletesmap); /* loop over all providers of d */ diff --git a/src/solver.c b/src/solver.c index 165e39e..7906e54 100644 --- a/src/solver.c +++ b/src/solver.c @@ -5360,6 +5360,16 @@ solver_calc_installsizechange(Solver *solv) return change; } +void +solver_trivial_installable(Solver *solv, Queue *pkgs, Queue *res) +{ + Map installedmap; + solver_create_state_maps(solv, &installedmap, 0); + pool_trivial_installable_noobsoletesmap(solv->pool, &installedmap, pkgs, res, solv->noobsoletes.size ? &solv->noobsoletes : 0); + map_free(&installedmap); +} + + #define FIND_INVOLVED_DEBUG 0 void solver_find_involved(Solver *solv, Queue *installedq, Solvable *ts, Queue *q) diff --git a/src/solver.h b/src/solver.h index 1f4d96e..13ac96c 100644 --- a/src/solver.h +++ b/src/solver.h @@ -350,6 +350,7 @@ solver_is_enhancing(Solver *solv, Solvable *s) void solver_calc_duchanges(Solver *solv, DUChanges *mps, int nmps); int solver_calc_installsizechange(Solver *solv); +void solver_trivial_installable(Solver *solv, Queue *pkgs, Queue *res); void solver_find_involved(Solver *solv, Queue *installedq, Solvable *s, Queue *q); diff --git a/src/solverdebug.c b/src/solverdebug.c index 6a49729..5b2a73e 100644 --- a/src/solverdebug.c +++ b/src/solverdebug.c @@ -573,7 +573,6 @@ solver_printtrivial(Solver *solv) { Pool *pool = solv->pool; Queue in, out; - Map installedmap; Id p; const char *n; Solvable *s; @@ -592,14 +591,12 @@ solver_printtrivial(Solver *solv) queue_free(&in); return; } - solver_create_state_maps(solv, &installedmap, 0); queue_init(&out); - pool_trivial_installable(pool, &installedmap, &in, &out); + solver_trivial_installable(solv, &in, &out); POOL_DEBUG(SAT_DEBUG_RESULT, "trivial installable status:\n"); for (i = 0; i < in.count; i++) POOL_DEBUG(SAT_DEBUG_RESULT, " %s: %d\n", solvable2str(pool, pool->solvables + in.elements[i]), out.elements[i]); POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); - map_free(&installedmap); queue_free(&in); queue_free(&out); } |