summaryrefslogtreecommitdiff
path: root/src/problems.c
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-03-05 14:01:21 +0100
committerMichael Schroeder <mls@suse.de>2012-03-05 14:01:21 +0100
commit7dd686ea89c05e2b32f1def76bcdc973efce3f36 (patch)
tree0838587dafc072e69b01414cbfaf448f2adf05d1 /src/problems.c
parent9f63ef78d353c21f771726fa2e24ad1622c30671 (diff)
downloadlibsolv-7dd686ea89c05e2b32f1def76bcdc973efce3f36.tar.gz
libsolv-7dd686ea89c05e2b32f1def76bcdc973efce3f36.tar.bz2
libsolv-7dd686ea89c05e2b32f1def76bcdc973efce3f36.zip
- clean up update/feature rule handling in allowuninstall case. Automatically add the CLEANDEPS flags in solutions.
We no longer make the update/featurerule weak, but use a "autouninstall" function instead that checks if we can solve the problem by removing a package. We also automatically add CLEANDEPS in that case if all job rules in the problem have CLEANDEPS set.
Diffstat (limited to 'src/problems.c')
-rw-r--r--src/problems.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/problems.c b/src/problems.c
index 3a1409d..33bb099 100644
--- a/src/problems.c
+++ b/src/problems.c
@@ -531,6 +531,7 @@ create_solutions(Solver *solv, int probnr, int solidx)
int essentialok;
unsigned int now;
int oldmistakes = solv->cleandeps_mistakes ? solv->cleandeps_mistakes->count : 0;
+ Id extraflags = -1;
now = solv_timems(0);
queue_init(&redoq);
@@ -554,7 +555,11 @@ create_solutions(Solver *solv, int probnr, int solidx)
if (!v)
break;
queue_push(&problem, v);
+ if (v < 0)
+ extraflags &= solv->job.elements[-v - 1];
}
+ if (extraflags == -1)
+ extraflags = 0;
if (problem.count > 1)
solv_sort(problem.elements, problem.count, sizeof(Id), problems_sortcmp, &solv->job);
queue_push(&problem, 0); /* mark end for refine_suggestion */
@@ -609,6 +614,7 @@ create_solutions(Solver *solv, int probnr, int solidx)
queue_push(&solv->solutions, 0); /* add end marker */
queue_push(&solv->solutions, 0); /* add end marker */
queue_push(&solv->solutions, problem.elements[i]); /* just for bookkeeping */
+ queue_push(&solv->solutions, extraflags & SOLVER_CLEANDEPS); /* our extraflags */
solv->solutions.elements[solidx + 1 + nsol++] = solstart;
}
solv->solutions.elements[solidx + 1 + nsol] = 0; /* end marker */
@@ -697,6 +703,14 @@ solver_solutionelement_internalid(Solver *solv, Id problem, Id solution)
return solv->solutions.elements[solidx + 2 * solv->solutions.elements[solidx] + 3];
}
+Id
+solver_solutionelement_extrajobflags(Solver *solv, Id problem, Id solution)
+{
+ Id solidx = solv->problems.elements[problem * 2 - 1];
+ solidx = solv->solutions.elements[solidx + solution];
+ return solv->solutions.elements[solidx + 2 * solv->solutions.elements[solidx] + 4];
+}
+
/*
* return the next item of the proposed solution
@@ -738,7 +752,7 @@ solver_next_solutionelement(Solver *solv, Id problem, Id solution, Id element, I
}
void
-solver_take_solutionelement(Solver *solv, Id p, Id rp, Queue *job)
+solver_take_solutionelement(Solver *solv, Id p, Id rp, Id extrajobflags, Queue *job)
{
int i;
@@ -751,11 +765,11 @@ solver_take_solutionelement(Solver *solv, Id p, Id rp, Queue *job)
if (rp <= 0 && p <= 0)
return; /* just in case */
if (rp > 0)
- p = SOLVER_INSTALL|SOLVER_SOLVABLE;
+ p = SOLVER_INSTALL|SOLVER_SOLVABLE|extrajobflags;
else
{
rp = p;
- p = SOLVER_ERASE|SOLVER_SOLVABLE;
+ p = SOLVER_ERASE|SOLVER_SOLVABLE|extrajobflags;
}
for (i = 0; i < job->count; i += 2)
if (job->elements[i] == p && job->elements[i + 1] == rp)
@@ -767,8 +781,9 @@ void
solver_take_solution(Solver *solv, Id problem, Id solution, Queue *job)
{
Id p, rp, element = 0;
+ Id extrajobflags = solver_solutionelement_extrajobflags(solv, problem, solution);
while ((element = solver_next_solutionelement(solv, problem, solution, element, &p, &rp)) != 0)
- solver_take_solutionelement(solv, p, rp, job);
+ solver_take_solutionelement(solv, p, rp, extrajobflags, job);
}