summaryrefslogtreecommitdiff
path: root/src/app_info.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2023-03-05 12:15:56 +0200
committerTimo Teräs <timo.teras@iki.fi>2023-04-11 20:47:43 +0300
commit58fa82642e1a155e92a218a58753974587b3b956 (patch)
treea83a3428e7fa9bf4a073baa51c85e0edf94f9d5a /src/app_info.c
parent18b8d1e8ad877eb1eaad5216b821c0fb8394c76b (diff)
downloadapk-tools-58fa82642e1a155e92a218a58753974587b3b956.tar.gz
apk-tools-58fa82642e1a155e92a218a58753974587b3b956.tar.bz2
apk-tools-58fa82642e1a155e92a218a58753974587b3b956.tar.xz
apk-tools-58fa82642e1a155e92a218a58753974587b3b956.zip
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
Diffstat (limited to 'src/app_info.c')
-rw-r--r--src/app_info.c12
1 files changed, 5 insertions, 7 deletions
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)