From 58fa82642e1a155e92a218a58753974587b3b956 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Sun, 5 Mar 2023 12:15:56 +0200 Subject: db, apps: sort packages by pkgname and pkgver This will also fix "search" to display one match from each principal pkgname group. "search -e vim" will now show both vim and gvim. fixes #10864 fixes #10777 --- src/app_info.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/app_info.c') diff --git a/src/app_info.c b/src/app_info.c index 2cdbad6..1187dae 100644 --- a/src/app_info.c +++ b/src/app_info.c @@ -350,18 +350,16 @@ static void info_subaction(struct info_ctx *ctx, struct apk_package *pkg) } } -static int print_name_info(struct apk_database *db, const char *match, struct apk_name *name, void *pctx) +static int print_name_info(struct apk_database *db, const char *match, struct apk_package *pkg, void *pctx) { struct info_ctx *ctx = (struct info_ctx *) pctx; - struct apk_provider *p; - if (name == NULL) { + if (!pkg) { ctx->errors++; return 0; } - foreach_array_item(p, name->providers) - info_subaction(ctx, p->pkg); + info_subaction(ctx, pkg); return 0; } @@ -454,8 +452,8 @@ static int info_main(void *ctx, struct apk_database *db, struct apk_string_array if (ictx->action != NULL) { ictx->action(ictx, db, args); } else if (args->num > 0) { - /* Print info on given names */ - apk_db_foreach_sorted_name(db, args, print_name_info, ctx); + /* Print info on given packages */ + apk_db_foreach_sorted_providers(db, args, print_name_info, ctx); } else { /* Print all installed packages */ list_for_each_entry(ipkg, &db->installed.packages, installed_pkgs_list) -- cgit v1.2.3-70-g09d2