summaryrefslogtreecommitdiff
path: root/src/state.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-05-23 15:35:02 +0300
committerTimo Teräs <timo.teras@iki.fi>2011-05-23 15:35:02 +0300
commit57572979a9659033f79e88aab054693236c32f74 (patch)
tree3d2c42c4d379d332276b63dea7f7e3e40c39f64b /src/state.c
parentc5de3cdc4c86f4c1f7fcb94eb0d43bbb657bdc75 (diff)
downloadapk-tools-57572979a9659033f79e88aab054693236c32f74.tar.gz
apk-tools-57572979a9659033f79e88aab054693236c32f74.tar.bz2
apk-tools-57572979a9659033f79e88aab054693236c32f74.tar.xz
apk-tools-57572979a9659033f79e88aab054693236c32f74.zip
state: fix commit order of packages
commit 4e72075fbab introduced a bug where package installation might happen in wrong order (reminder for self to separate the package version deduction to separate step from installation ordering). this restricts the earlier commit to not mingle with the install order.
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/state.c b/src/state.c
index 8641e9b..fc7ecb5 100644
--- a/src/state.c
+++ b/src/state.c
@@ -265,17 +265,27 @@ static struct apk_package *get_locked_or_installed_package(
return NULL;
}
+static int check_dependency(struct apk_state *state,
+ struct apk_dependency *dep)
+{
+ struct apk_package *pkg;
+
+ pkg = get_locked_or_installed_package(state, dep->name);
+ if (pkg == NULL && dep->result_mask != APK_DEPMASK_CONFLICT)
+ return 0;
+ if (!apk_dep_is_satisfied(dep, pkg))
+ return 0;
+
+ return 1;
+}
+
static int check_dependency_array(struct apk_state *state,
struct apk_dependency_array *da)
{
- struct apk_package *pkg;
int i;
for (i = 0; i < da->num; i++) {
- pkg = get_locked_or_installed_package(state, da->item[i].name);
- if (pkg == NULL && da->item[i].result_mask != APK_DEPMASK_CONFLICT)
- return 0;
- if (!apk_dep_is_satisfied(&da->item[i], pkg))
+ if (!check_dependency(state, &da->item[i]))
return 0;
}
@@ -494,7 +504,8 @@ static int apk_state_fix_package(struct apk_state *state,
return 0;
for (i = 0; i < pkg->depends->num; i++) {
- if (pkg->depends->item[i].name->flags & APK_NAME_TOPLEVEL_OVERRIDE) {
+ if ((pkg->depends->item[i].name->flags & APK_NAME_TOPLEVEL_OVERRIDE) &&
+ check_dependency(state, &pkg->depends->item[i])) {
r = apk_state_prune_dependency(state,
&pkg->depends->item[i]);
if (r < 0)