summaryrefslogtreecommitdiff
path: root/src/solver.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-10-21 15:24:24 -0400
committerTimo Teräs <timo.teras@iki.fi>2011-10-24 10:16:40 -0400
commite682e6596c101d634b3780a98773c8433b3baadb (patch)
treec5f5ec848d972555fafc2333f72182734dd7df5b /src/solver.c
parentbd0242e1de1c21d4d58cfd86e98b223b6e3e7e12 (diff)
downloadapk-tools-e682e6596c101d634b3780a98773c8433b3baadb.tar.gz
apk-tools-e682e6596c101d634b3780a98773c8433b3baadb.tar.bz2
apk-tools-e682e6596c101d634b3780a98773c8433b3baadb.tar.xz
apk-tools-e682e6596c101d634b3780a98773c8433b3baadb.zip
solver, pkg: implement versioned conflicts
One can now say in dependency "!foo<2" which means, that if foo is installed, it needs to be >=2, but it's not a required dependency.
Diffstat (limited to 'src/solver.c')
-rw-r--r--src/solver.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/solver.c b/src/solver.c
index 49cfc79..d277bc5 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -126,8 +126,7 @@ static void foreach_dependency_pkg(
struct apk_package *pkg0 = name0->pkgs->item[j];
/* conflict depends on all to be not installed */
- if (dep->result_mask != APK_DEPMASK_CONFLICT &&
- !apk_dep_is_satisfied(dep, pkg0))
+ if (!apk_dep_is_satisfied(dep, pkg0))
continue;
cb(ss, pkg0);
@@ -154,8 +153,7 @@ static void foreach_rinstall_if_pkg(
for (k = 0; k < pkg0->install_if->num; k++) {
struct apk_dependency *dep = &pkg0->install_if->item[k];
if (dep->name == name &&
- (dep->result_mask == APK_DEPMASK_CONFLICT ||
- apk_dep_is_satisfied(dep, pkg)))
+ apk_dep_is_satisfied(dep, pkg))
break;
}
if (k >= pkg0->install_if->num)
@@ -635,7 +633,7 @@ static void apply_constraint(struct apk_solver_state *ss, struct apk_dependency
if (ss->latest_decision != NULL)
inherit_name_state(name, ss->latest_decision->name);
- if (dep->result_mask != APK_DEPMASK_CONFLICT)
+ if (!dep->optional)
ns->requirers++;
update_name_state(ss, name);
}
@@ -675,7 +673,7 @@ static void undo_constraint(struct apk_solver_state *ss, struct apk_dependency *
if (ss->latest_decision && has_inherited_state(ss->latest_decision->name))
recalculate_inherted_name_state(name);
- if (dep->result_mask != APK_DEPMASK_CONFLICT)
+ if (!dep->optional)
ns->requirers--;
update_name_state(ss, name);
}