summaryrefslogtreecommitdiff
path: root/src/state.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-03-19 14:21:58 +0200
committerTimo Teräs <timo.teras@iki.fi>2011-03-19 14:21:58 +0200
commit7b6e44b11b4b419a6af91555270b1ddc981c5a74 (patch)
tree06fdb978c823c94cdd67ed1ec7f224320fd7a9ed /src/state.c
parent4e72075fbab32e9368d1305431924f10e78c0546 (diff)
downloadapk-tools-7b6e44b11b4b419a6af91555270b1ddc981c5a74.tar.gz
apk-tools-7b6e44b11b4b419a6af91555270b1ddc981c5a74.tar.bz2
apk-tools-7b6e44b11b4b419a6af91555270b1ddc981c5a74.tar.xz
apk-tools-7b6e44b11b4b419a6af91555270b1ddc981c5a74.zip
upgrade: reset world dependencies during traversal
This allows us to get apk-tools dependencies get reset at proper time in world. As a bonus, it reduces code amount.
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/state.c b/src/state.c
index 005470c..3a8d3a6 100644
--- a/src/state.c
+++ b/src/state.c
@@ -138,14 +138,20 @@ static struct apk_name_choices *name_choices_new(struct apk_database *db,
if (dep->name != name)
continue;
- for (j = 0; j < nc->num; ) {
- if (apk_dep_is_satisfied(dep, nc->pkgs[j])) {
- j++;
- } else {
- nc->pkgs[j] = nc->pkgs[nc->num - 1];
- nc->num--;
+ if (apk_flags & APK_PREFER_AVAILABLE) {
+ dep->version = apk_blob_atomize(APK_BLOB_NULL);
+ dep->result_mask = APK_DEPMASK_REQUIRE;
+ } else {
+ for (j = 0; j < nc->num; ) {
+ if (apk_dep_is_satisfied(dep, nc->pkgs[j])) {
+ j++;
+ } else {
+ nc->pkgs[j] = nc->pkgs[nc->num - 1];
+ nc->num--;
+ }
}
}
+ break;
}
return nc;