diff options
author | Timo Teräs <timo.teras@iki.fi> | 2023-03-04 13:54:54 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2023-04-11 20:47:43 +0300 |
commit | 67f5a753e50da8737dc28b0ea2c2194b21d76fdd (patch) | |
tree | 657a81a529d2733eecae1837cc48ac25abe73357 /src/app_fetch.c | |
parent | efb55ce650d3cac9a607560d840f95c1127e68f5 (diff) | |
download | apk-tools-67f5a753e50da8737dc28b0ea2c2194b21d76fdd.tar.gz apk-tools-67f5a753e50da8737dc28b0ea2c2194b21d76fdd.tar.bz2 apk-tools-67f5a753e50da8737dc28b0ea2c2194b21d76fdd.tar.xz apk-tools-67f5a753e50da8737dc28b0ea2c2194b21d76fdd.zip |
db, apps: sort display results based on package names
Diffstat (limited to 'src/app_fetch.c')
-rw-r--r-- | src/app_fetch.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/app_fetch.c b/src/app_fetch.c index 0cc1918..ea2ca13 100644 --- a/src/app_fetch.c +++ b/src/app_fetch.c @@ -235,7 +235,7 @@ static void mark_dep_flags(struct fetch_ctx *ctx, struct apk_dependency *dep) apk_deps_add(&ctx->world, dep); } -static void mark_name_flags(struct apk_database *db, const char *match, struct apk_name *name, void *pctx) +static int mark_name_flags(struct apk_database *db, const char *match, struct apk_name *name, void *pctx) { struct fetch_ctx *ctx = (struct fetch_ctx *) pctx; struct apk_dependency dep = (struct apk_dependency) { @@ -244,13 +244,15 @@ static void mark_name_flags(struct apk_database *db, const char *match, struct a .result_mask = APK_DEPMASK_ANY, }; - if (!IS_ERR_OR_NULL(name)) { - name->auto_select_virtual = 1; - apk_deps_add(&ctx->world, &dep); - } else { + if (!name) { ctx->errors++; mark_error(ctx, match, name); + return 0; } + + name->auto_select_virtual = 1; + apk_deps_add(&ctx->world, &dep); + return 0; } static void mark_names_recursive(struct apk_database *db, struct apk_string_array *args, void *pctx) @@ -271,7 +273,7 @@ static void mark_names_recursive(struct apk_database *db, struct apk_string_arra apk_change_array_free(&changeset.changes); } -static void mark_name(struct apk_database *db, const char *match, struct apk_name *name, void *ctx) +static int mark_name(struct apk_database *db, const char *match, struct apk_name *name, void *ctx) { struct apk_package *pkg = NULL; struct apk_provider *p; @@ -284,10 +286,11 @@ static void mark_name(struct apk_database *db, const char *match, struct apk_nam if (!pkg) goto err; mark_package(ctx, pkg); - return; + return 0; err: mark_error(ctx, match, name); + return 0; } static int purge_package(void *pctx, int dirfd, const char *filename) @@ -346,12 +349,12 @@ static int fetch_main(void *pctx, struct apk_database *db, struct apk_string_arr apk_dependency_array_init(&ctx->world); foreach_array_item(dep, db->world) mark_dep_flags(ctx, dep); - apk_name_foreach_matching(db, args, apk_foreach_genid(), mark_name_flags, ctx); + apk_db_foreach_matching_name(db, args, mark_name_flags, ctx); if (ctx->errors == 0) mark_names_recursive(db, args, ctx); apk_dependency_array_free(&ctx->world); } else { - apk_name_foreach_matching(db, args, apk_foreach_genid(), mark_name, ctx); + apk_db_foreach_matching_name(db, args, mark_name, ctx); } if (!ctx->errors) apk_hash_foreach(&db->available.packages, fetch_package, ctx); |