summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-04-27 09:13:11 +0300
committerTimo Teräs <timo.teras@iki.fi>2012-04-27 09:13:11 +0300
commitbbba72c694975e3f1a52275c2ff0e12a970b63dc (patch)
treede653e57cdb7e8bcc7d5365d1dbfc0baa58c4eaa /src
parent29c7fb359eb058fef81a465271ec6384a15b9a2f (diff)
downloadapk-tools-bbba72c694975e3f1a52275c2ff0e12a970b63dc.tar.gz
apk-tools-bbba72c694975e3f1a52275c2ff0e12a970b63dc.tar.bz2
apk-tools-bbba72c694975e3f1a52275c2ff0e12a970b63dc.tar.xz
apk-tools-bbba72c694975e3f1a52275c2ff0e12a970b63dc.zip
solver: fix install_if triggers on cyclic and early deps
Diffstat (limited to 'src')
-rw-r--r--src/solver.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/solver.c b/src/solver.c
index 0417616..457d5ff 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -750,19 +750,21 @@ static solver_result_t apply_decision(struct apk_solver_state *ss,
pkg->provides->item[i].name->ss.name_touched = 1;
ps->locked = 1;
- ps->handle_install_if = 0;
+
+ if (d->type == DECISION_ASSIGN &&
+ ps->topology_soft < ss->topology_position) {
+ ps->handle_install_if = 1;
+ dbg_printf("triggers due to " PKG_VER_FMT "\n",
+ PKG_VER_PRINTF(pkg));
+ } else {
+ ps->handle_install_if = 0;
+ }
if (d->topology_position) {
- if (ps->topology_soft < ss->topology_position) {
- if (d->type == DECISION_ASSIGN) {
- ps->handle_install_if = 1;
- dbg_printf("triggers due to " PKG_VER_FMT "\n",
- PKG_VER_PRINTF(pkg));
- }
+ if (ps->topology_soft < ss->topology_position)
ss->topology_position = ps->topology_soft;
- } else {
+ else
ss->topology_position = pkg->topology_hard;
- }
}
if (d->type == DECISION_ASSIGN) {
@@ -777,7 +779,8 @@ static solver_result_t apply_decision(struct apk_solver_state *ss,
}
foreach_dependency(ss, pkg->depends, apply_constraint);
- foreach_rinstall_if_pkg(ss, pkg, trigger_install_if);
+ if (ps->handle_install_if)
+ foreach_rinstall_if_pkg(ss, pkg, trigger_install_if);
}
} else {
dbg_printf("-->apply_decision: %s %s NOTHING\n",
@@ -844,7 +847,8 @@ static void undo_decision(struct apk_solver_state *ss,
pkg->provides->item[i].name->ss.name_touched = 1;
if (name->ss.locked) {
- foreach_rinstall_if_pkg(ss, pkg, untrigger_install_if);
+ if (ps->handle_install_if)
+ foreach_rinstall_if_pkg(ss, pkg, untrigger_install_if);
foreach_dependency(ss, pkg->depends, undo_constraint);
get_topology_score(ss, pkg, &score);