From b24db2af7615ff7c138ae9c201c3ba7579487d4b Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 20 Dec 2008 07:50:58 +0100 Subject: [PATCH] plist.c: fix showing pkginfo with multiple repos. --HG-- extra : convert_revision : 6c4d3b17e5fd6ea6d08ba9d697f2557ef11d8b37 --- utils/plist.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/utils/plist.c b/utils/plist.c index 7f0c30ce1fc..bcb8c77e955 100644 --- a/utils/plist.c +++ b/utils/plist.c @@ -34,6 +34,7 @@ #include "xbps_api.h" static bool xbps_list_strings_in_array2(prop_object_t, void *); +static bool repo_haspkg; bool xbps_add_obj_to_dict(prop_dictionary_t dict, prop_object_t obj, @@ -71,23 +72,27 @@ xbps_callback_array_iter_in_dict(prop_dictionary_t dict, const char *key, { prop_object_iterator_t iter; prop_object_t obj; + bool run = false, ret = false; if (func == NULL) return false; + repo_haspkg = false; + iter = xbps_get_array_iter_from_dict(dict, key); if (iter == NULL) return false; while ((obj = prop_object_iterator_next(iter))) { - if (!(*func)(obj, arg)) { - prop_object_iterator_release(iter); - return false; + run = (*func)(obj, arg); + if (run && repo_haspkg) { + ret = true; + break; } } prop_object_iterator_release(iter); - return true; + return ret; } prop_dictionary_t @@ -267,10 +272,9 @@ xbps_show_pkg_info(prop_dictionary_t dict) sep = " "; } printf("\n\t"); - if (!xbps_callback_array_iter_in_dict(dict, + xbps_callback_array_iter_in_dict(dict, prop_dictionary_keysym_cstring_nocopy(obj), - xbps_list_strings_in_array2, (void *)sep)) - return; + xbps_list_strings_in_array2, (void *)sep); printf("\n"); if (rundeps) printf("\n"); @@ -307,6 +311,7 @@ xbps_show_pkg_info_from_repolist(prop_object_t obj, void *arg) printf("Repository: %s\n", repoloc); xbps_show_pkg_info(pkgdict); + repo_haspkg = true; return true; }