From f3dac9e97a4538021d9cd2f464470ec132050705 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 31 Jul 2024 01:30:41 -0400 Subject: Fixes readout of packages in delivery * Now that the overview is displayed after deferred packages are filtered out of the main list, filtered packages were no longer displayed * This combines the main list and deferred list for both conda, and pip packages. --- src/delivery.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/delivery.c b/src/delivery.c index f9907fc..4264016 100644 --- a/src/delivery.c +++ b/src/delivery.c @@ -941,26 +941,42 @@ void delivery_conda_show(struct Delivery *ctx) { puts("Native Packages:"); if (strlist_count(ctx->conda.conda_packages)) { - for (size_t i = 0; i < strlist_count(ctx->conda.conda_packages); i++) { - char *token = strlist_item(ctx->conda.conda_packages, i); + struct StrList *list_conda = strlist_init(); + strlist_append_strlist(list_conda, ctx->conda.conda_packages); + if (strlist_count(ctx->conda.conda_packages_defer)) { + strlist_append_strlist(list_conda, ctx->conda.conda_packages_defer); + } + strlist_sort(list_conda, STASIS_SORT_ALPHA); + + for (size_t i = 0; i < strlist_count(list_conda); i++) { + char *token = strlist_item(list_conda, i); if (isempty(token) || isblank(*token) || startswith(token, "-")) { continue; } printf("%21s%s\n", "", token); } + guard_strlist_free(&list_conda); } else { printf("%21s%s\n", "", "N/A"); } puts("Python Packages:"); if (strlist_count(ctx->conda.pip_packages)) { - for (size_t i = 0; i < strlist_count(ctx->conda.pip_packages); i++) { - char *token = strlist_item(ctx->conda.pip_packages, i); + struct StrList *list_python = strlist_init(); + strlist_append_strlist(list_python, ctx->conda.pip_packages); + if (strlist_count(ctx->conda.pip_packages_defer)) { + strlist_append_strlist(list_python, ctx->conda.pip_packages_defer); + } + strlist_sort(list_python, STASIS_SORT_ALPHA); + + for (size_t i = 0; i < strlist_count(list_python); i++) { + char *token = strlist_item(list_python, i); if (isempty(token) || isblank(*token) || startswith(token, "-")) { continue; } printf("%21s%s\n", "", token); } + guard_strlist_free(&list_python); } else { printf("%21s%s\n", "", "N/A"); } -- cgit