summaryrefslogtreecommitdiff
path: root/src/apk_database.h
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/apk_database.h
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/apk_database.h')
-rw-r--r--src/apk_database.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/apk_database.h b/src/apk_database.h
index 194fe06..06b714a 100644
--- a/src/apk_database.h
+++ b/src/apk_database.h
@@ -102,6 +102,7 @@ struct apk_name {
unsigned auto_select_virtual: 1;
unsigned priority : 2;
unsigned solver_flags_set : 1;
+ unsigned providers_sorted : 1;
unsigned int foreach_genid;
union {
struct apk_solver_name_state ss;
@@ -203,6 +204,7 @@ typedef union apk_database_or_void {
static inline int apk_name_cmp_display(const struct apk_name *a, const struct apk_name *b) {
return strcmp(a->name, b->name);
}
+struct apk_provider_array *apk_name_sorted_providers(struct apk_name *);
struct apk_name *apk_db_get_name(struct apk_database *db, apk_blob_t name);
struct apk_name *apk_db_query_name(struct apk_database *db, apk_blob_t name);
@@ -283,4 +285,19 @@ int apk_db_foreach_matching_name(struct apk_database *db, struct apk_string_arra
int apk_db_foreach_sorted_name(struct apk_database *db, struct apk_string_array *filter,
apk_db_foreach_name_cb cb, void *ctx);
+typedef int (*apk_db_foreach_package_cb)(struct apk_database *db, const char *match, struct apk_package *pkg, void *ctx);
+
+int __apk_db_foreach_sorted_package(struct apk_database *db, struct apk_string_array *filter,
+ apk_db_foreach_package_cb cb, void *cb_ctx, int provides);
+
+static inline int apk_db_foreach_sorted_package(struct apk_database *db, struct apk_string_array *filter,
+ apk_db_foreach_package_cb cb, void *cb_ctx) {
+ return __apk_db_foreach_sorted_package(db, filter, cb, cb_ctx, 0);
+}
+
+static inline int apk_db_foreach_sorted_providers(struct apk_database *db, struct apk_string_array *filter,
+ apk_db_foreach_package_cb cb, void *cb_ctx) {
+ return __apk_db_foreach_sorted_package(db, filter, cb, cb_ctx, 1);
+}
+
#endif