summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2014-04-16 15:15:42 +0200
committerMichael Schroeder <mls@suse.de>2014-04-16 15:15:42 +0200
commit67ba071573efb19964719240734e2f16d27a6bab (patch)
tree09296b22c2bd2080f8f3041bf44b56dbe122ba57
parent14c1dfbd0d9c3184178e5e1de3aa3f8d2e29f42f (diff)
downloadlibsolv-67ba071573efb19964719240734e2f16d27a6bab.tar.gz
libsolv-67ba071573efb19964719240734e2f16d27a6bab.tar.bz2
libsolv-67ba071573efb19964719240734e2f16d27a6bab.zip
add KEEP_ORPHANS and BREAK_ORPHANS solver flags
BREAK_ORPHANS is not implemented yet
-rw-r--r--ext/testcase.c2
-rw-r--r--src/rules.c9
-rw-r--r--src/solver.c24
-rw-r--r--src/solver.h4
4 files changed, 29 insertions, 10 deletions
diff --git a/ext/testcase.c b/ext/testcase.c
index 70d98b3..32547c8 100644
--- a/ext/testcase.c
+++ b/ext/testcase.c
@@ -102,6 +102,8 @@ static struct solverflags2str {
{ SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE, "dupallowarchchange", 1 },
{ SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE, "dupallowvendorchange", 1 },
{ SOLVER_FLAG_DUP_ALLOW_NAMECHANGE, "dupallownamechange", 1 },
+ { SOLVER_FLAG_KEEP_ORPHANS, "keeporphans", 0 },
+ { SOLVER_FLAG_BREAK_ORPHANS, "breakorphans", 0 },
{ 0, 0, 0 }
};
diff --git a/src/rules.c b/src/rules.c
index 3ba5a0e..b86ad77 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -1246,6 +1246,13 @@ solver_addupdaterule(Solver *solv, Solvable *s, int allow_all)
}
#endif
+ if (!allow_all && !p && solv->dupmap_all)
+ {
+ queue_push(&solv->orphaned, s - pool->solvables); /* an orphaned package */
+ if (solv->keep_orphans)
+ p = s - pool->solvables;
+ }
+
if (!allow_all && qs.count && solv->multiversion.size)
{
int i, j;
@@ -1286,7 +1293,7 @@ solver_addupdaterule(Solver *solv, Solvable *s, int allow_all)
}
if (j == 0 && p == -SYSTEMSOLVABLE && solv->dupmap_all)
{
- queue_push(&solv->orphaned, s - pool->solvables); /* treat as orphaned */
+ queue_push(&solv->orphaned, s - pool->solvables); /* also treat as orphaned */
j = qs.count;
}
qs.count = j;
diff --git a/src/solver.c b/src/solver.c
index f188e3d..054567e 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -1639,6 +1639,10 @@ solver_get_flag(Solver *solv, int flag)
return solv->dup_allowarchchange;
case SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE:
return solv->dup_allowvendorchange;
+ case SOLVER_FLAG_KEEP_ORPHANS:
+ return solv->keep_orphans;
+ case SOLVER_FLAG_BREAK_ORPHANS:
+ return solv->break_orphans;
default:
break;
}
@@ -1702,6 +1706,12 @@ solver_set_flag(Solver *solv, int flag, int value)
case SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE:
solv->dup_allowvendorchange = value;
break;
+ case SOLVER_FLAG_KEEP_ORPHANS:
+ solv->keep_orphans = value;
+ break;
+ case SOLVER_FLAG_BREAK_ORPHANS:
+ solv->break_orphans = value;
+ break;
default:
break;
}
@@ -3574,20 +3584,16 @@ solver_solve(Solver *solv, Queue *job)
* check for and remove duplicate
*/
r = solv->rules + solv->nrules - 1; /* r: update rule */
+ if (!r->p)
+ continue;
sr = r - (installed->end - installed->start); /* sr: feature rule */
- /* it's orphaned if there is no feature rule or the feature rule
- * consists just of the installed package */
- if (!sr->p || (sr->p == i && !sr->d && !sr->w2))
+ /* it's also orphaned if the feature rule consists just of the installed package */
+ if (!solv->dupmap_all && sr->p == i && !sr->d && !sr->w2)
queue_push(&solv->orphaned, i);
- if (!r->p)
- {
- /* assert(solv->dupmap_all && !sr->p); */
- continue;
- }
if (!solver_rulecmp(solv, r, sr))
memset(sr, 0, sizeof(*sr)); /* delete unneeded feature rule */
else
- solver_disablerule(solv, sr); /* disable feature rule */
+ solver_disablerule(solv, sr); /* disable feature rule for now */
}
/* consistency check: we added a rule for _every_ installed solvable */
assert(solv->nrules - solv->updaterules == installed->end - installed->start);
diff --git a/src/solver.h b/src/solver.h
index 81c5f2b..3316e76 100644
--- a/src/solver.h
+++ b/src/solver.h
@@ -185,6 +185,8 @@ struct _Solver {
Queue addedmap_deduceq; /* deduce addedmap from rpm rules */
Id *instbuddy; /* buddies of installed packages */
+ int keep_orphans; /* how to treat orphans */
+ int break_orphans; /* how to treat orphans */
#endif /* LIBSOLV_INTERNAL */
};
@@ -282,6 +284,8 @@ typedef struct _Solver Solver;
#define SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE 15
#define SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE 16
#define SOLVER_FLAG_DUP_ALLOW_NAMECHANGE 17
+#define SOLVER_FLAG_KEEP_ORPHANS 18
+#define SOLVER_FLAG_BREAK_ORPHANS 19
#define GET_USERINSTALLED_NAMES (1 << 0) /* package names instead if ids */
#define GET_USERINSTALLED_INVERTED (1 << 1) /* autoinstalled */