summaryrefslogtreecommitdiff
path: root/src/state.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-01-13 15:21:20 +0200
committerTimo Teras <timo.teras@iki.fi>2009-01-13 15:21:20 +0200
commitc831ead63c5fdb4d1e75c264084576cfefe581e6 (patch)
tree5b801e35207a4c651a053c1d5b950766152e15b5 /src/state.c
parent3755e1cde35828aad4af0578d4271af6b7d57b61 (diff)
downloadapk-tools-c831ead63c5fdb4d1e75c264084576cfefe581e6.tar.gz
apk-tools-c831ead63c5fdb4d1e75c264084576cfefe581e6.tar.bz2
apk-tools-c831ead63c5fdb4d1e75c264084576cfefe581e6.tar.xz
apk-tools-c831ead63c5fdb4d1e75c264084576cfefe581e6.zip
state: fix generation of change-set to honour dependencies
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/state.c b/src/state.c
index a07d10b..3dc2b9b 100644
--- a/src/state.c
+++ b/src/state.c
@@ -253,13 +253,17 @@ int apk_state_satisfy_name(struct apk_state *state,
}
apk_state_set(state, preferred->id, APK_STATE_INSTALL);
+ r = apk_state_satisfy_deps(state, preferred->depends);
+ if (r != 0)
+ return r;
+
if (preferred != installed) {
r = apk_state_add_change(state, installed, preferred);
if (r != 0)
return r;
}
- return apk_state_satisfy_deps(state, preferred->depends);
+ return 0;
}
int apk_state_satisfy_deps(struct apk_state *state,
@@ -271,7 +275,7 @@ int apk_state_satisfy_deps(struct apk_state *state,
if (deps == NULL)
return 0;
- for (i = 0; i < deps->num; i++) {
+ for (i = deps->num - 1; i >= 0; i--) {
name = deps->item[i].name;
if (name->pkgs == NULL) {
apk_error("No providers for '%s'", name->name);