|
|
@@ -12,21 +12,17 @@ Signed-off-by: Christian Marangi <[email protected]>
|
|
|
|
|
|
--- a/src/app_list.c
|
|
|
+++ b/src/app_list.c
|
|
|
-@@ -27,6 +27,7 @@ struct list_ctx {
|
|
|
- unsigned int match_depends : 1;
|
|
|
+@@ -49,12 +49,53 @@ struct list_ctx {
|
|
|
unsigned int match_providers : 1;
|
|
|
+ unsigned int match_depends : 1;
|
|
|
unsigned int manifest : 1;
|
|
|
++ unsigned int installed : 1; /* Solely for print_full patch */
|
|
|
+ unsigned int full : 1;
|
|
|
-
|
|
|
- struct apk_string_array *filters;
|
|
|
};
|
|
|
-@@ -105,6 +106,40 @@ static void print_manifest(const struct
|
|
|
- printf("%s " BLOB_FMT "\n", pkg->name->name, BLOB_PRINTF(*pkg->version));
|
|
|
- }
|
|
|
|
|
|
+static void print_full(const struct apk_package *pkg, const struct list_ctx *ctx)
|
|
|
+{
|
|
|
-+ struct apk_dependency *d;
|
|
|
++ struct apk_dependency d;
|
|
|
+
|
|
|
+ printf("Package: %s\n", pkg->name->name);
|
|
|
+ printf("Version: " BLOB_FMT "\n", BLOB_PRINTF(*pkg->version));
|
|
|
@@ -34,7 +30,7 @@ Signed-off-by: Christian Marangi <[email protected]>
|
|
|
+ int i = 0;
|
|
|
+
|
|
|
+ printf("Depends: ");
|
|
|
-+ foreach_array_item(d, pkg->depends) {
|
|
|
++ apk_array_foreach(d, pkg->depends) {
|
|
|
+ i++;
|
|
|
+ printf("%s%s", d->name->name, i < apk_array_len(pkg->depends) ? ", ": "\n");
|
|
|
+ }
|
|
|
@@ -43,7 +39,7 @@ Signed-off-by: Christian Marangi <[email protected]>
|
|
|
+ int i = 0;
|
|
|
+
|
|
|
+ printf("Provides: ");
|
|
|
-+ foreach_array_item(d, pkg->provides) {
|
|
|
++ apk_array_foreach(d, pkg->provides) {
|
|
|
+ i++;
|
|
|
+ printf("%s%s", d->name->name, i < apk_array_len(pkg->provides) ? ", ": "\n");
|
|
|
+ }
|
|
|
@@ -58,35 +54,41 @@ Signed-off-by: Christian Marangi <[email protected]>
|
|
|
+ printf("\n");
|
|
|
+}
|
|
|
+
|
|
|
- static void filter_package(const struct apk_database *db, const struct apk_package *pkg, const struct list_ctx *ctx, const struct apk_name *name)
|
|
|
+ static void print_package(const struct apk_database *db, const struct apk_name *name, const struct apk_package *pkg, const struct list_ctx *ctx)
|
|
|
{
|
|
|
- if (ctx->match_origin && !origin_matches(ctx, pkg)) return;
|
|
|
-@@ -114,7 +149,9 @@ static void filter_package(const struct
|
|
|
- if (ctx->upgradable && !is_upgradable(db, pkg)) return;
|
|
|
-
|
|
|
if (ctx->match_providers) printf("<%s> ", name->name);
|
|
|
-- if (ctx->manifest)
|
|
|
-+ if (ctx->full)
|
|
|
+
|
|
|
++ if (ctx->full) {
|
|
|
+ print_full(pkg, ctx);
|
|
|
-+ else if (ctx->manifest)
|
|
|
- print_manifest(pkg, ctx);
|
|
|
- else
|
|
|
- print_package(db, pkg, ctx);
|
|
|
-@@ -154,6 +191,7 @@ static int print_result(struct apk_datab
|
|
|
++ return;
|
|
|
++ }
|
|
|
++
|
|
|
+ if (ctx->manifest) {
|
|
|
+ printf("%s " BLOB_FMT "\n", pkg->name->name, BLOB_PRINTF(*pkg->version));
|
|
|
+ return;
|
|
|
+@@ -96,6 +137,7 @@ static void print_package(const struct apk_database *db, const struct apk_name *
|
|
|
OPT(OPT_LIST_depends, APK_OPT_SH("d") "depends") \
|
|
|
- OPT(OPT_LIST_installed, APK_OPT_SH("I") "installed") \
|
|
|
+ OPT(OPT_LIST_installed, APK_OPT_SH("I")) \
|
|
|
OPT(OPT_LIST_manifest, "manifest") \
|
|
|
+ OPT(OPT_LIST_full, "full") \
|
|
|
OPT(OPT_LIST_origin, APK_OPT_SH("o") "origin") \
|
|
|
- OPT(OPT_LIST_orphaned, APK_OPT_SH("O") "orphaned") \
|
|
|
+ OPT(OPT_LIST_orphaned, APK_OPT_SH("O")) \
|
|
|
OPT(OPT_LIST_providers, APK_OPT_SH("P") "providers") \
|
|
|
-@@ -167,6 +205,9 @@ static int list_parse_option(void *pctx,
|
|
|
- struct list_ctx *ctx = pctx;
|
|
|
+@@ -109,6 +151,9 @@ static int list_parse_option(void *pctx, struct apk_ctx *ac, int opt, const char
|
|
|
+ struct apk_query_spec *qs = &ac->query;
|
|
|
|
|
|
switch (opt) {
|
|
|
+ case OPT_LIST_full:
|
|
|
+ ctx->full = 1;
|
|
|
+ break;
|
|
|
case OPT_LIST_available:
|
|
|
- ctx->available = 1;
|
|
|
- ctx->orphaned = 0;
|
|
|
+ qs->filter.available = 1;
|
|
|
+ break;
|
|
|
+@@ -117,6 +162,7 @@ static int list_parse_option(void *pctx, struct apk_ctx *ac, int opt, const char
|
|
|
+ break;
|
|
|
+ case OPT_LIST_installed:
|
|
|
+ installed:
|
|
|
++ ctx->installed = 1;
|
|
|
+ qs->filter.installed = 1;
|
|
|
+ ac->open_flags |= APK_OPENF_NO_SYS_REPOS;
|
|
|
+ break;
|