summaryrefslogtreecommitdiff
path: root/src/solver.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-02-28 10:28:39 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-02-28 10:28:39 +0200
commit179b453ab7cef53104f348c342599b0276233a95 (patch)
treee071e1bd254324d08ae2a59b2cc692da28334747 /src/solver.c
parent536c21979b59a10592c7be0674be4c88a97e8d83 (diff)
downloadapk-tools-179b453ab7cef53104f348c342599b0276233a95.tar.gz
apk-tools-179b453ab7cef53104f348c342599b0276233a95.tar.bz2
apk-tools-179b453ab7cef53104f348c342599b0276233a95.tar.xz
apk-tools-179b453ab7cef53104f348c342599b0276233a95.zip
solver: fix conflicting provides detection
ref #574
Diffstat (limited to 'src/solver.c')
-rw-r--r--src/solver.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/solver.c b/src/solver.c
index 9084b1d..0814e18 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -788,7 +788,6 @@ static inline void unassign_name(struct apk_solver_state *ss, struct apk_name *n
}
}
-
static solver_result_t apply_decision(struct apk_solver_state *ss,
struct apk_decision *d)
{
@@ -894,6 +893,9 @@ static void undo_decision(struct apk_solver_state *ss,
ss->topology_position = pkg->topology_hard;
}
+ for (i = 0; i < pkg->provides->num; i++)
+ name_to_ns(pkg->provides->item[i].name)->name_touched = 1;
+
if (ns->locked) {
foreach_rinstall_if_pkg(ss, pkg, untrigger_install_if);
foreach_dependency(ss, pkg->depends, undo_constraint);
@@ -1140,7 +1142,7 @@ static int reconsider_name(struct apk_solver_state *ss, struct apk_name *name)
struct apk_name_state *ns = name_to_ns(name);
struct apk_provider *next_p = NULL;
unsigned int next_topology = 0, options = 0;
- int i, score_locked = FALSE;
+ int i, j, score_locked = FALSE;
if (!ns->none_excluded) {
struct apk_score minscore;
@@ -1166,6 +1168,17 @@ static int reconsider_name(struct apk_solver_state *ss, struct apk_name *name)
((pkg0->ipkg == NULL && !pkg_available(ss->db, pkg0))))
continue;
+ for (j = 0; j < pkg0->provides->num; j++) {
+ struct apk_dependency *p00 = &pkg0->provides->item[j];
+ if (!name_to_ns(p00->name)->locked)
+ continue;
+ if (name_to_ns(p00->name)->chosen.version != &apk_null_blob ||
+ p00->version != &apk_null_blob)
+ break;
+ }
+ if (j < pkg0->provides->num)
+ continue;
+
score_locked = get_topology_score(ss, ns, pkg0, &pkg0_score);
/* viable alternative? */