summaryrefslogtreecommitdiff
path: root/src/package.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-02-20 20:54:03 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-02-21 09:19:24 +0200
commit6f237d9149d3a27d1aae4d52dc8c73ed3e1508cc (patch)
tree140991992c191559823bf4f4e74f50ad4dd94256 /src/package.c
parent6ae573887df6722a94ba589a7ee1675e7ea573d6 (diff)
downloadapk-tools-6f237d9149d3a27d1aae4d52dc8c73ed3e1508cc.tar.gz
apk-tools-6f237d9149d3a27d1aae4d52dc8c73ed3e1508cc.tar.bz2
apk-tools-6f237d9149d3a27d1aae4d52dc8c73ed3e1508cc.tar.xz
apk-tools-6f237d9149d3a27d1aae4d52dc8c73ed3e1508cc.zip
solver: implement backwards jumping and various other optimizations
Diffstat (limited to 'src/package.c')
-rw-r--r--src/package.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/package.c b/src/package.c
index a162038..7cefc74 100644
--- a/src/package.c
+++ b/src/package.c
@@ -316,17 +316,26 @@ int apk_dep_is_satisfied(struct apk_dependency *dep, struct apk_package *pkg)
return dep->optional;
if (dep->name != pkg->name)
return 0;
- if (dep->result_mask == APK_DEPMASK_CHECKSUM) {
+
+ switch (dep->result_mask) {
+ case APK_DEPMASK_CHECKSUM: {
struct apk_checksum csum;
apk_blob_t b = *dep->version;
apk_blob_pull_csum(&b, &csum);
if (apk_checksum_compare(&csum, &pkg->csum) == 0)
return 1;
- } else {
+ break;
+ }
+ case APK_DEPMASK_CONFLICT:
+ return 0;
+ case APK_DEPMASK_REQUIRE:
+ return 1;
+ default:
if (apk_version_compare_blob(*pkg->version, *dep->version)
& dep->result_mask)
return 1;
+ break;
}
return 0;
}