diff options
author | Timo Teräs <timo.teras@iki.fi> | 2012-02-24 15:50:39 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2012-02-24 16:31:40 +0200 |
commit | 99145e2c0dc0b5b3b5a2a72fb1bff140d1f583f3 (patch) | |
tree | 37eb5b28d99600d3b310e502218dbc8167adf986 /src/search.c | |
parent | 97d44b5a002b61c7b95303bb8616f1caa6556bca (diff) | |
download | apk-tools-99145e2c0dc0b5b3b5a2a72fb1bff140d1f583f3.tar.gz apk-tools-99145e2c0dc0b5b3b5a2a72fb1bff140d1f583f3.tar.bz2 apk-tools-99145e2c0dc0b5b3b5a2a72fb1bff140d1f583f3.tar.xz apk-tools-99145e2c0dc0b5b3b5a2a72fb1bff140d1f583f3.zip |
all: introduce apk_provides and use it in apk_name
in preparation for provides support. implements also some
dependency satisfaction helper routines.
ref #574.
Diffstat (limited to 'src/search.c')
-rw-r--r-- | src/search.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/search.c b/src/search.c index 0a158a7..e90076d 100644 --- a/src/search.c +++ b/src/search.c @@ -59,12 +59,12 @@ static void print_rdepends(struct search_ctx *ctx, struct apk_package *pkg) printf(PKG_VER_FMT ":", PKG_VER_PRINTF(pkg)); for (i = 0; i < name->rdepends->num; i++) { name0 = name->rdepends->item[i]; - for (j = 0; j < name0->pkgs->num; j++) { - pkg0 = name0->pkgs->item[j]; + + for (j = 0; j < name0->providers->num; j++) { + pkg0 = name0->providers->item[j].pkg; for (k = 0; k < pkg0->depends->num; k++) { dep = &pkg0->depends->item[k]; - if (name == dep->name && - apk_dep_is_satisfied(dep, pkg)) { + if (apk_dep_is_materialized_or_provided(dep, pkg)) { printf(" "); ctx->print_package(ctx, pkg0); } @@ -138,15 +138,16 @@ static int match_names(apk_hash_item item, void *ctx) } if (ictx->show_all) { - for (i = 0; i < name->pkgs->num; i++) - print_result(ictx, name->pkgs->item[i]); + for (i = 0; i < name->providers->num; i++) + print_result(ictx, name->providers->item[i].pkg); } else { struct apk_package *pkg = NULL; + apk_blob_t *version = NULL; - for (i = 0; i < name->pkgs->num; i++) { - if (pkg == NULL || - apk_pkg_version_compare(name->pkgs->item[i], pkg) == APK_VERSION_GREATER) - pkg = name->pkgs->item[i]; + for (i = 0; i < name->providers->num; i++) { + if (version == NULL || + apk_version_compare_blob(*name->providers->item[i].version, *version) == APK_VERSION_GREATER) + pkg = name->providers->item[i].pkg; } print_result(ictx, pkg); } |