summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/order.c2
-rw-r--r--src/policy.c2
-rw-r--r--src/pool.c17
-rw-r--r--src/pool.h2
-rw-r--r--src/repo.h20
-rw-r--r--src/repo_write.c10
-rw-r--r--src/rules.c32
-rw-r--r--src/solver.c17
8 files changed, 83 insertions, 19 deletions
diff --git a/src/order.c b/src/order.c
index c45a9a2..b8d4b82 100644
--- a/src/order.c
+++ b/src/order.c
@@ -598,6 +598,7 @@ breakcycle(struct orderdata *od, Id *cycle)
POOL_DEBUG(SOLV_DEBUG_STATS, "\n");
}
+#if 0
static inline void
dump_tes(struct orderdata *od)
{
@@ -628,6 +629,7 @@ dump_tes(struct orderdata *od)
}
}
}
+#endif
static void
reachable(struct orderdata *od, Id i)
diff --git a/src/policy.c b/src/policy.c
index 823a008..10a2c4d 100644
--- a/src/policy.c
+++ b/src/policy.c
@@ -1579,6 +1579,8 @@ policy_findupdatepackages(Solver *solv, Solvable *s, Queue *qs, int allow_all)
continue;
ps = pool->solvables + p;
+ if (pool->considered && pool->whatprovideswithdisabled && ps->repo != pool->installed && pool_disabled_solvable(pool, ps))
+ continue;
if (s->name == ps->name) /* name match */
{
if (pool->implicitobsoleteusescolors && !pool_colormatch(pool, s, ps))
diff --git a/src/pool.c b/src/pool.c
index 4b63727..76636a7 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -202,6 +202,8 @@ pool_get_flag(Pool *pool, int flag)
return pool->addfileprovidesfiltered;
case POOL_FLAG_NOWHATPROVIDESAUX:
return pool->nowhatprovidesaux;
+ case POOL_FLAG_WHATPROVIDESWITHDISABLED:
+ return pool->whatprovideswithdisabled;
default:
break;
}
@@ -247,6 +249,9 @@ pool_set_flag(Pool *pool, int flag, int value)
case POOL_FLAG_NOWHATPROVIDESAUX:
pool->nowhatprovidesaux = value;
break;
+ case POOL_FLAG_WHATPROVIDESWITHDISABLED:
+ pool->whatprovideswithdisabled = value;
+ break;
default:
break;
}
@@ -450,7 +455,6 @@ pool_createwhatprovides(Pool *pool)
Offset *whatprovides;
Id *whatprovidesdata, *dp, *whatprovidesauxdata;
Offset *whatprovidesaux;
- Repo *installed = pool->installed;
unsigned int now;
now = solv_timems(0);
@@ -473,9 +477,7 @@ pool_createwhatprovides(Pool *pool)
s = pool->solvables + i;
if (!s->provides || !s->repo || s->repo->disabled)
continue;
- /* we always need the installed solvable in the whatprovides data,
- otherwise obsoletes/conflicts on them won't work */
- if (s->repo != installed && !pool_installable(pool, s))
+ if (!pool_installable_whatprovides(pool, s))
continue;
pp = s->repo->idarraydata + s->provides;
while ((id = *pp++) != 0)
@@ -534,9 +536,8 @@ pool_createwhatprovides(Pool *pool)
s = pool->solvables + i;
if (!s->provides || !s->repo || s->repo->disabled)
continue;
- if (s->repo != installed && !pool_installable(pool, s))
+ if (!pool_installable_whatprovides(pool, s))
continue;
-
/* for all provides of this solvable */
pp = s->repo->idarraydata + s->provides;
while ((id = *pp++) != 0)
@@ -963,7 +964,7 @@ pool_addstdproviders(Pool *pool, Id d)
* and those should not use filelist entries */
if (s->repo->disabled)
continue;
- if (s->repo != pool->installed && !pool_installable(pool, s))
+ if (!pool_installable_whatprovides(pool, s))
continue;
queue_push(&q, di.solvid);
}
@@ -1243,7 +1244,7 @@ pool_addrelproviders(Pool *pool, Id d)
FOR_POOL_SOLVABLES(p)
{
Solvable *s = pool->solvables + p;
- if (s->repo != pool->installed && !pool_installable(pool, s))
+ if (!pool_installable_whatprovides(pool, s))
continue;
if (s->arch == evr)
queue_push(&plist, p);
diff --git a/src/pool.h b/src/pool.h
index c90c29a..aa173ea 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -166,6 +166,7 @@ struct s_Pool {
Id *whatprovidesauxdata;
Offset whatprovidesauxdataoff;
+ int whatprovideswithdisabled;
#endif
};
@@ -204,6 +205,7 @@ struct s_Pool {
#define POOL_FLAG_ADDFILEPROVIDESFILTERED 9
#define POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS 10
#define POOL_FLAG_NOWHATPROVIDESAUX 11
+#define POOL_FLAG_WHATPROVIDESWITHDISABLED 12
/* ----------------------------------------------- */
diff --git a/src/repo.h b/src/repo.h
index 58704f1..9a5e981 100644
--- a/src/repo.h
+++ b/src/repo.h
@@ -123,6 +123,26 @@ static inline int pool_installable(const Pool *pool, Solvable *s)
return 1;
}
+#ifdef LIBSOLV_INTERNAL
+static inline int pool_installable_whatprovides(const Pool *pool, Solvable *s)
+{
+ /* we always need the installed solvable in the whatprovides data,
+ otherwise obsoletes/conflicts on them won't work */
+ if (s->repo != pool->installed)
+ {
+ if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC || pool_badarch_solvable(pool, s))
+ return 0;
+ if (pool->considered && !pool->whatprovideswithdisabled)
+ {
+ Id id = s - pool->solvables;
+ if (!MAPTST(pool->considered, id))
+ return 0;
+ }
+ }
+ return 1;
+}
+#endif
+
/* not in solvable.h because we need the repo definition */
static inline Solvable *solvable_free(Solvable *s, int reuseids)
{
diff --git a/src/repo_write.c b/src/repo_write.c
index d3b8a83..2a03e58 100644
--- a/src/repo_write.c
+++ b/src/repo_write.c
@@ -187,16 +187,6 @@ write_id(Repodata *data, Id x)
}
static inline void
-write_id_eof(Repodata *data, Id x, int eof)
-{
- if (x >= 64)
- x = (x & 63) | ((x & ~63) << 1);
- write_id(data, x | (eof ? 0 : 64));
-}
-
-
-
-static inline void
write_str(Repodata *data, const char *str)
{
if (data->error)
diff --git a/src/rules.c b/src/rules.c
index 3aef6ee..57895c0 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -1373,6 +1373,14 @@ solver_addupdaterule(Solver *solv, Solvable *s)
int dupinvolved = 0;
p = s - pool->solvables;
+
+ if (pool->considered && pool_disabled_solvable(pool, s))
+ {
+ /* disabled installed solvables must stay installed */
+ solver_addrule(solv, p, 0, 0);
+ return;
+ }
+
/* Orphan detection. We cheat by looking at the feature rule, which
* we already calculated */
r = solv->rules + solv->featurerules + (p - solv->installed->start);
@@ -2003,6 +2011,8 @@ solver_addduprules(Solver *solv, Map *addedmap)
continue;
if (installed && ps->repo == installed)
{
+ if (pool->considered && pool_disabled_solvable(pool, ps))
+ continue; /* always keep disabled installed packages */
if (!MAPTST(&solv->dupmap, p))
{
Id ip, ipp;
@@ -3323,6 +3333,21 @@ prune_best_update(Solver *solv, Id p, Queue *q)
policy_filter_unwanted(solv, q, POLICY_MODE_RECOMMEND);
}
+static void
+prune_disabled(Pool *pool, Queue *q)
+{
+ int i, j;
+ for (i = j = 0; i < q->count; i++)
+ {
+ Id p = q->elements[i];
+ Solvable *s = pool->solvables + p;
+ if (s->repo && s->repo != pool->installed && !MAPTST(pool->considered, p))
+ continue;
+ q->elements[j++] = p;
+ }
+ queue_truncate(q, j);
+}
+
void
solver_addbestrules(Solver *solv, int havebestinstalljobs, int haslockjob)
{
@@ -3377,6 +3402,8 @@ solver_addbestrules(Solver *solv, int havebestinstalljobs, int haslockjob)
else if (p2 < 0)
queue_push(&q2, p2);
}
+ if (pool->considered && pool->whatprovideswithdisabled)
+ prune_disabled(pool, &q);
if (!q.count)
continue; /* orphaned */
/* select best packages, just look at prio and version */
@@ -3386,6 +3413,8 @@ solver_addbestrules(Solver *solv, int havebestinstalljobs, int haslockjob)
continue; /* nothing filtered */
if (lockedmap)
{
+ queue_insertn(&q, 0, q2.count, q2.elements);
+ queue_empty(&q2);
FOR_RULELITERALS(p2, pp2, r)
{
if (p2 <= 0)
@@ -3399,9 +3428,12 @@ solver_addbestrules(Solver *solv, int havebestinstalljobs, int haslockjob)
continue;
queue_push(&q2, p2);
}
+ if (pool->considered && pool->whatprovideswithdisabled)
+ prune_disabled(pool, &q2);
policy_filter_unwanted(solv, &q2, POLICY_MODE_RECOMMEND);
for (k = 0; k < q2.count; k++)
queue_pushunique(&q, q2.elements[k]);
+ queue_empty(&q2);
}
if (q2.count)
queue_insertn(&q, 0, q2.count, q2.elements);
diff --git a/src/solver.c b/src/solver.c
index 5453b39..45f9dbf 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -1910,6 +1910,8 @@ resolve_dependencies(Solver *solv, int level, int disablerules, Queue *dq)
Rule *r;
int origlevel = level;
Id p, *dp;
+ int focusbest = solv->focus_best && solv->do_extra_reordering;
+ Repo *installed = solv->installed;
/*
* decide
@@ -1928,7 +1930,7 @@ resolve_dependencies(Solver *solv, int level, int disablerules, Queue *dq)
}
if (i == solv->nrules)
i = 1;
- if (solv->focus_best && solv->do_extra_reordering && i >= solv->featurerules)
+ if (focusbest && i >= solv->featurerules)
continue;
r = solv->rules + i;
if (r->d < 0) /* ignore disabled rules */
@@ -1938,6 +1940,19 @@ resolve_dependencies(Solver *solv, int level, int disablerules, Queue *dq)
if (r->d == 0 || solv->decisionmap[-r->p] <= 0)
continue;
}
+ if (focusbest && r->d != 0 && installed)
+ {
+ /* make sure at least one negative literal is from a new package */
+ if (!(r->p < 0 && pool->solvables[-r->p].repo != installed))
+ {
+ dp = pool->whatprovidesdata + r->d;
+ while ((p = *dp++) != 0)
+ if (p < 0 && solv->decisionmap[-p] > 0 && pool->solvables[-p].repo != installed)
+ break;
+ if (!p)
+ continue; /* sorry */
+ }
+ }
if (dq->count)
queue_empty(dq);
if (r->d == 0)