summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-03-31 09:21:24 +0300
committerTimo Teräs <timo.teras@iki.fi>2011-03-31 09:22:12 +0300
commitdded261924dba3d86200a2c748443d0f3ec3247b (patch)
treea2756844dbb555af38c9a59efb7baa6e24041952
parente43ec608749a44a305afec89f46bcb282ab93d10 (diff)
downloadapk-tools-dded261924dba3d86200a2c748443d0f3ec3247b.tar.bz2
apk-tools-dded261924dba3d86200a2c748443d0f3ec3247b.tar.xz
state: late locking for install_if package selection
improves behaviour under certain corner case conditions.
-rw-r--r--src/state.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/state.c b/src/state.c
index d63e1bf..cbc0f25 100644
--- a/src/state.c
+++ b/src/state.c
@@ -454,6 +454,12 @@ int apk_state_autolock_name(struct apk_state *state, struct apk_name *name,
if (use == NULL)
return -2;
+ /* Install_if check did not result in package selection change:
+ * do not lock the package yet as the preferency might change
+ * later. */
+ if (install_if && use->ipkg != NULL)
+ return 0;
+
return apk_state_lock_name(state, name, use);
#else
/* If any of the choices is installed, we are good. Otherwise,