xbps-repo(8): added 'show-files' target.

It will search for 'pkgname' and will print its list of files, by
searching it in repository pool. The first repo wins.

Bump XBPS_RELVER to 20091125.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091125021556-n8p6atfbkuvb4doi
This commit is contained in:
Juan RP
2009-11-25 02:15:56 +00:00
parent c11094d5dd
commit 3117c8b4ee
6 changed files with 85 additions and 56 deletions

View File

@ -112,6 +112,63 @@ show_pkg_info(prop_dictionary_t dict)
printf(" %s\n", prop_string_cstring_nocopy(obj));
}
int
show_pkg_files(prop_dictionary_t filesd)
{
prop_array_t array;
prop_object_iterator_t iter = NULL;
prop_object_t obj;
const char *file;
char *array_str = "files";
int i = 0;
/* Links. */
array = prop_dictionary_get(filesd, "links");
if (array && prop_array_count(array) > 0) {
iter = xbps_get_array_iter_from_dict(filesd, "links");
if (iter == NULL)
return EINVAL;
while ((obj = prop_object_iterator_next(iter))) {
if (!prop_dictionary_get_cstring_nocopy(obj,
"file", &file)) {
prop_object_iterator_release(iter);
return errno;
}
printf("%s\n", file);
}
prop_object_iterator_release(iter);
}
/* Files and configuration files. */
for (i = 0; i < 2; i++) {
if (i == 0)
array_str = "conf_files";
else
array_str = "files";
array = prop_dictionary_get(filesd, array_str);
if (array == NULL || prop_array_count(array) == 0)
continue;
iter = xbps_get_array_iter_from_dict(filesd, array_str);
if (iter == NULL)
return EINVAL;
while ((obj = prop_object_iterator_next(iter))) {
if (!prop_dictionary_get_cstring_nocopy(obj,
"file", &file)) {
prop_object_iterator_release(iter);
return errno;
}
printf("%s\n", file);
}
prop_object_iterator_release(iter);
}
return 0;
}
int
show_pkg_namedesc(prop_object_t obj, void *arg, bool *loop_done)
{