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:
@@ -62,12 +62,8 @@ int
|
||||
show_pkg_files_from_metadir(const char *pkgname)
|
||||
{
|
||||
prop_dictionary_t pkgd;
|
||||
prop_array_t array;
|
||||
prop_object_iterator_t iter = NULL;
|
||||
prop_object_t obj;
|
||||
const char *file;
|
||||
char *plist, *array_str = "files";
|
||||
int i, rv = 0;
|
||||
char *plist;
|
||||
int rv = 0;
|
||||
|
||||
plist = xbps_xasprintf("%s/%s/metadata/%s/%s", xbps_get_rootdir(),
|
||||
XBPS_META_PATH, pkgname, XBPS_PKGFILES);
|
||||
@@ -81,54 +77,7 @@ show_pkg_files_from_metadir(const char *pkgname)
|
||||
}
|
||||
free(plist);
|
||||
|
||||
/* Links. */
|
||||
array = prop_dictionary_get(pkgd, "links");
|
||||
if (array && prop_array_count(array) > 0) {
|
||||
iter = xbps_get_array_iter_from_dict(pkgd, "links");
|
||||
if (iter == NULL) {
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
while ((obj = prop_object_iterator_next(iter))) {
|
||||
if (!prop_dictionary_get_cstring_nocopy(obj,
|
||||
"file", &file)) {
|
||||
prop_object_iterator_release(iter);
|
||||
rv = errno;
|
||||
goto out;
|
||||
}
|
||||
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(pkgd, array_str);
|
||||
if (array == NULL || prop_array_count(array) == 0)
|
||||
continue;
|
||||
|
||||
iter = xbps_get_array_iter_from_dict(pkgd, array_str);
|
||||
if (iter == NULL) {
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
while ((obj = prop_object_iterator_next(iter))) {
|
||||
if (!prop_dictionary_get_cstring_nocopy(obj,
|
||||
"file", &file)) {
|
||||
prop_object_iterator_release(iter);
|
||||
rv = errno;
|
||||
goto out;
|
||||
}
|
||||
printf("%s\n", file);
|
||||
}
|
||||
prop_object_iterator_release(iter);
|
||||
}
|
||||
out:
|
||||
rv = show_pkg_files(pkgd);
|
||||
prop_object_release(pkgd);
|
||||
|
||||
return rv;
|
||||
|
Reference in New Issue
Block a user