diff options
author | Timo Teräs <timo.teras@iki.fi> | 2023-04-26 13:13:32 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2023-04-26 13:13:32 +0300 |
commit | 06fef8ad8a936269a1868cbe1421ac72797f9a3e (patch) | |
tree | a51befaac7507975f545b4dee887cbda308cd5df | |
parent | 551f4683df801e63286f0c5b5eed40e2bb349578 (diff) | |
download | apk-tools-06fef8ad8a936269a1868cbe1421ac72797f9a3e.tar.gz apk-tools-06fef8ad8a936269a1868cbe1421ac72797f9a3e.tar.bz2 apk-tools-06fef8ad8a936269a1868cbe1421ac72797f9a3e.tar.xz apk-tools-06fef8ad8a936269a1868cbe1421ac72797f9a3e.zip |
db: fix apk_db_foreach_matching_name to match all without args
This is a fixup to the backport commit 67f5a753:
db, apps: sort display results based on package names
This makes apk_db_foreach_matching_name() act consistently on
between 2.14-stable and master. And updates the call sites where
differing behaviour is needed, and fixes dot and other call sites
to work again.
fixes #10893
-rw-r--r-- | src/app_del.c | 2 | ||||
-rw-r--r-- | src/app_fetch.c | 6 | ||||
-rw-r--r-- | src/database.c | 4 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/app_del.c b/src/app_del.c index 06deb43..e5c6aab 100644 --- a/src/app_del.c +++ b/src/app_del.c @@ -145,7 +145,7 @@ static int del_main(void *pctx, struct apk_database *db, struct apk_string_array int r = 0; apk_dependency_array_copy(&ctx->world, db->world); - apk_db_foreach_matching_name(db, args, delete_name, ctx); + if (args->num) apk_db_foreach_matching_name(db, args, delete_name, ctx); if (ctx->errors) return ctx->errors; r = apk_solver_solve(db, 0, ctx->world, &changeset); diff --git a/src/app_fetch.c b/src/app_fetch.c index 11602c1..58afff4 100644 --- a/src/app_fetch.c +++ b/src/app_fetch.c @@ -370,12 +370,14 @@ 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_db_foreach_matching_name(db, args, mark_name_flags, ctx); + if (args->num) + 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_db_foreach_matching_name(db, args, mark_name, ctx); + if (args->num) + apk_db_foreach_matching_name(db, args, mark_name, ctx); } if (!ctx->errors) apk_db_foreach_sorted_package(db, NULL, fetch_package, ctx); diff --git a/src/database.c b/src/database.c index d7f197b..48b5f17 100644 --- a/src/database.c +++ b/src/database.c @@ -3049,14 +3049,14 @@ int apk_db_foreach_matching_name(struct apk_database *db, struct apk_string_arra struct apk_name *name; struct match_ctx mctx = { .db = db, - .filter = filter, .cb = cb, .cb_ctx = ctx, }; int r; - if (!filter || !filter->num) return 0; + if (!filter || !filter->num) goto all; + mctx.filter = filter; foreach_array_item(pmatch, filter) if (strchr(*pmatch, '*') != NULL) goto all; |