plist.c: fix showing pkginfo with multiple repos.

--HG--
extra : convert_revision : 6c4d3b17e5fd6ea6d08ba9d697f2557ef11d8b37
This commit is contained in:
Juan RP 2008-12-20 07:50:58 +01:00
parent 741f559536
commit b24db2af76

View File

@ -34,6 +34,7 @@
#include "xbps_api.h" #include "xbps_api.h"
static bool xbps_list_strings_in_array2(prop_object_t, void *); static bool xbps_list_strings_in_array2(prop_object_t, void *);
static bool repo_haspkg;
bool bool
xbps_add_obj_to_dict(prop_dictionary_t dict, prop_object_t obj, 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_iterator_t iter;
prop_object_t obj; prop_object_t obj;
bool run = false, ret = false;
if (func == NULL) if (func == NULL)
return false; return false;
repo_haspkg = false;
iter = xbps_get_array_iter_from_dict(dict, key); iter = xbps_get_array_iter_from_dict(dict, key);
if (iter == NULL) if (iter == NULL)
return false; return false;
while ((obj = prop_object_iterator_next(iter))) { while ((obj = prop_object_iterator_next(iter))) {
if (!(*func)(obj, arg)) { run = (*func)(obj, arg);
prop_object_iterator_release(iter); if (run && repo_haspkg) {
return false; ret = true;
break;
} }
} }
prop_object_iterator_release(iter); prop_object_iterator_release(iter);
return true; return ret;
} }
prop_dictionary_t prop_dictionary_t
@ -267,10 +272,9 @@ xbps_show_pkg_info(prop_dictionary_t dict)
sep = " "; sep = " ";
} }
printf("\n\t"); printf("\n\t");
if (!xbps_callback_array_iter_in_dict(dict, xbps_callback_array_iter_in_dict(dict,
prop_dictionary_keysym_cstring_nocopy(obj), prop_dictionary_keysym_cstring_nocopy(obj),
xbps_list_strings_in_array2, (void *)sep)) xbps_list_strings_in_array2, (void *)sep);
return;
printf("\n"); printf("\n");
if (rundeps) if (rundeps)
printf("\n"); printf("\n");
@ -307,6 +311,7 @@ xbps_show_pkg_info_from_repolist(prop_object_t obj, void *arg)
printf("Repository: %s\n", repoloc); printf("Repository: %s\n", repoloc);
xbps_show_pkg_info(pkgdict); xbps_show_pkg_info(pkgdict);
repo_haspkg = true;
return true; return true;
} }