summaryrefslogtreecommitdiff
path: root/src/rules.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rules.c')
-rw-r--r--src/rules.c92
1 files changed, 56 insertions, 36 deletions
diff --git a/src/rules.c b/src/rules.c
index b5f3e3e..cf368e4 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -1466,7 +1466,7 @@ disableupdaterule(Solver *solv, Id p)
{
int i, ni;
ni = solv->bestrules_end - solv->bestrules;
- for (i = 0; i < ni; i++)
+ for (i = solv->bestrules_up - solv->bestrules; i < ni; i++)
if (solv->bestrules_pkg[i] == p)
solver_disablerule(solv, solv->rules + solv->bestrules + i);
}
@@ -1509,7 +1509,7 @@ reenableupdaterule(Solver *solv, Id p)
{
int i, ni;
ni = solv->bestrules_end - solv->bestrules;
- for (i = 0; i < ni; i++)
+ for (i = solv->bestrules_up - solv->bestrules; i < ni; i++)
if (solv->bestrules_pkg[i] == p)
solver_enablerule(solv, solv->rules + solv->bestrules + i);
}
@@ -1922,6 +1922,21 @@ solver_createdupmaps(Solver *solv)
}
if (solv->dupinvolvedmap.size)
MAPCLR(&solv->dupinvolvedmap, SYSTEMSOLVABLE);
+ /* set update for all involved installed packages. We need to do
+ * this before creating the update rules */
+ if (solv->dupinvolvedmap_all)
+ solv->updatemap_all = 1;
+ else if (installed && !solv->updatemap_all && solv->dupinvolvedmap.size)
+ {
+ FOR_REPO_SOLVABLES(installed, p, s)
+ {
+ if (!MAPTST(&solv->dupinvolvedmap, p))
+ continue;
+ if (!solv->updatemap.size)
+ map_grow(&solv->updatemap, installed->end - installed->start);
+ MAPSET(&solv->updatemap, p - installed->start);
+ }
+ }
}
void
@@ -1943,8 +1958,6 @@ solver_addduprules(Solver *solv, Map *addedmap)
Rule *r;
solv->duprules = solv->nrules;
- if (solv->dupinvolvedmap_all)
- solv->updatemap_all = 1;
for (i = 1; i < pool->nsolvables; i++)
{
if (i == SYSTEMSOLVABLE || !MAPTST(addedmap, i))
@@ -1964,12 +1977,6 @@ solver_addduprules(Solver *solv, Map *addedmap)
continue;
if (installed && ps->repo == installed)
{
- if (!solv->updatemap_all)
- {
- if (!solv->updatemap.size)
- map_grow(&solv->updatemap, installed->end - installed->start);
- MAPSET(&solv->updatemap, p - installed->start);
- }
if (!MAPTST(&solv->dupmap, p))
{
Id ip, ipp;
@@ -3257,36 +3264,47 @@ solver_addbestrules(Solver *solv, int havebestinstalljobs)
{
for (i = 0; i < solv->job.count; i += 2)
{
- if ((solv->job.elements[i] & (SOLVER_JOBMASK | SOLVER_FORCEBEST)) == (SOLVER_INSTALL | SOLVER_FORCEBEST))
+ Id how = solv->job.elements[i];
+ if ((how & (SOLVER_JOBMASK | SOLVER_FORCEBEST)) == (SOLVER_INSTALL | SOLVER_FORCEBEST))
{
int j;
Id p2, pp2;
for (j = 0; j < solv->ruletojob.count; j++)
- if (solv->ruletojob.elements[j] == i)
- break;
- if (j == solv->ruletojob.count)
- continue;
- r = solv->rules + solv->jobrules + j;
- queue_empty(&q);
- FOR_RULELITERALS(p2, pp2, r)
- if (p2 > 0)
- queue_push(&q, p2);
- if (!q.count)
- continue; /* orphaned */
- /* select best packages, just look at prio and version */
- oldcnt = q.count;
- policy_filter_unwanted(solv, &q, POLICY_MODE_RECOMMEND);
- if (q.count == oldcnt)
- continue; /* nothing filtered */
- p2 = queue_shift(&q);
- if (q.count < 2)
- solver_addrule(solv, p2, q.count ? q.elements[0] : 0, 0);
- else
- solver_addrule(solv, p2, 0, pool_queuetowhatprovides(pool, &q));
- queue_push(&r2pkg, -(solv->jobrules + j));
+ {
+ if (solv->ruletojob.elements[j] != i)
+ continue;
+ r = solv->rules + solv->jobrules + j;
+ queue_empty(&q);
+ queue_empty(&q2);
+ FOR_RULELITERALS(p2, pp2, r)
+ {
+ if (p2 > 0)
+ queue_push(&q, p2);
+ else if (p2 < 0)
+ queue_push(&q2, p2);
+ }
+ if (!q.count)
+ continue; /* orphaned */
+ /* select best packages, just look at prio and version */
+ oldcnt = q.count;
+ policy_filter_unwanted(solv, &q, POLICY_MODE_RECOMMEND);
+ if (q.count == oldcnt)
+ continue; /* nothing filtered */
+ if (q2.count)
+ queue_insertn(&q, 0, q2.count, q2.elements);
+ p2 = queue_shift(&q);
+ if (q.count < 2)
+ solver_addrule(solv, p2, q.count ? q.elements[0] : 0, 0);
+ else
+ solver_addrule(solv, p2, 0, pool_queuetowhatprovides(pool, &q));
+ if ((how & SOLVER_WEAK) != 0)
+ queue_push(&solv->weakruleq, solv->nrules - 1);
+ queue_push(&r2pkg, -(solv->jobrules + j));
+ }
}
}
}
+ solv->bestrules_up = solv->nrules;
if (installed && (solv->bestupdatemap_all || solv->bestupdatemap.size))
{
@@ -3398,6 +3416,8 @@ solver_addbestrules(Solver *solv, int havebestinstalljobs)
/* yumobs rule handling */
+/* note that we use pool->obsoleteusescolors || pool->implicitobsoleteusescolors
+ * like in policy_findupdatepackages */
static void
find_obsolete_group(Solver *solv, Id obs, Queue *q)
@@ -3422,7 +3442,7 @@ find_obsolete_group(Solver *solv, Id obs, Queue *q)
Id obs2, *obsp2;
if (!os->obsoletes)
continue;
- if (pool->obsoleteusescolors && !pool_colormatch(pool, s2, os))
+ if ((pool->obsoleteusescolors || pool->implicitobsoleteusescolors) && !pool_colormatch(pool, s2, os))
continue;
obsp2 = os->repo->idarraydata + os->obsoletes;
while ((obs2 = *obsp2++) != 0)
@@ -3440,7 +3460,7 @@ find_obsolete_group(Solver *solv, Id obs, Queue *q)
continue;
if (!os->obsoletes)
continue;
- if (pool->obsoleteusescolors && !pool_colormatch(pool, s2, os))
+ if ((pool->obsoleteusescolors || pool->implicitobsoleteusescolors) && !pool_colormatch(pool, s2, os))
continue;
obsp2 = os->repo->idarraydata + os->obsoletes;
while ((obs2 = *obsp2++) != 0)
@@ -3539,7 +3559,7 @@ printf("checking yumobs for %s\n", pool_solvable2str(pool, s));
continue;
if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, pool->solvables + p2, obs))
continue;
- if (pool->obsoleteusescolors && !pool_colormatch(pool, s, s2))
+ if ((pool->obsoleteusescolors || pool->implicitobsoleteusescolors) && !pool_colormatch(pool, s, s2))
continue;
queue_pushunique(&qo, obs);
break;