summaryrefslogtreecommitdiff
path: root/src/rules.c
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2020-11-27 14:44:14 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2020-11-27 14:44:14 +0900
commitf2f190a043324e9ab4fefab6e16577a9a103f5a9 (patch)
tree85a43ade0bd8f232f383cd1ea3b44cd840db28e5 /src/rules.c
parent308ed24db702bd76267a5e347fe83144294ed4e0 (diff)
downloadlibsolv-f2f190a043324e9ab4fefab6e16577a9a103f5a9.tar.gz
libsolv-f2f190a043324e9ab4fefab6e16577a9a103f5a9.tar.bz2
libsolv-f2f190a043324e9ab4fefab6e16577a9a103f5a9.zip
Imported Upstream version 0.7.7upstream/0.7.7
Diffstat (limited to 'src/rules.c')
-rw-r--r--src/rules.c32
1 files changed, 32 insertions, 0 deletions
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);