xbps-query: fallback to repos on ENOENT for show modes.
This commit is contained in:
parent
2e649f9315
commit
ef6ed7d8c7
@ -27,6 +27,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <xbps_api.h>
|
#include <xbps_api.h>
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
@ -220,23 +221,33 @@ main(int argc, char **argv)
|
|||||||
/* show mode */
|
/* show mode */
|
||||||
if (repo_mode)
|
if (repo_mode)
|
||||||
rv = repo_show_pkg_info(&xh, argv[optind], props);
|
rv = repo_show_pkg_info(&xh, argv[optind], props);
|
||||||
else
|
else {
|
||||||
rv = show_pkg_info_from_metadir(&xh,
|
rv = show_pkg_info_from_metadir(&xh,
|
||||||
argv[optind], props);
|
argv[optind], props);
|
||||||
|
if (rv == ENOENT)
|
||||||
|
rv = repo_show_pkg_info(&xh,
|
||||||
|
argv[optind], props);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (show_files) {
|
} else if (show_files) {
|
||||||
/* show-files mode */
|
/* show-files mode */
|
||||||
if (repo_mode)
|
if (repo_mode)
|
||||||
rv = repo_show_pkg_files(&xh, argv[optind]);
|
rv = repo_show_pkg_files(&xh, argv[optind]);
|
||||||
else
|
else {
|
||||||
rv = show_pkg_files_from_metadir(&xh, argv[optind]);
|
rv = show_pkg_files_from_metadir(&xh, argv[optind]);
|
||||||
|
if (rv == ENOENT)
|
||||||
|
rv = repo_show_pkg_files(&xh, argv[optind]);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (show_deps) {
|
} else if (show_deps) {
|
||||||
/* show-deps mode */
|
/* show-deps mode */
|
||||||
if (repo_mode)
|
if (repo_mode)
|
||||||
rv = repo_show_pkg_deps(&xh, argv[optind]);
|
rv = repo_show_pkg_deps(&xh, argv[optind]);
|
||||||
else
|
else {
|
||||||
rv = show_pkg_deps(&xh, argv[optind]);
|
rv = show_pkg_deps(&xh, argv[optind]);
|
||||||
|
if (rv == ENOENT)
|
||||||
|
rv = repo_show_pkg_deps(&xh, argv[optind]);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (show_rdeps) {
|
} else if (show_rdeps) {
|
||||||
/* show-rdeps mode */
|
/* show-rdeps mode */
|
||||||
|
@ -47,7 +47,7 @@ show_pkg_deps(struct xbps_handle *xhp, const char *pkgname)
|
|||||||
propsd = xbps_dictionary_from_metadata_plist(xhp,
|
propsd = xbps_dictionary_from_metadata_plist(xhp,
|
||||||
pkgname, XBPS_PKGPROPS);
|
pkgname, XBPS_PKGPROPS);
|
||||||
if (propsd == NULL)
|
if (propsd == NULL)
|
||||||
return errno;
|
return ENOENT;
|
||||||
|
|
||||||
rv = xbps_callback_array_iter_in_dict(xhp, propsd, "run_depends",
|
rv = xbps_callback_array_iter_in_dict(xhp, propsd, "run_depends",
|
||||||
list_strings_sep_in_array, NULL);
|
list_strings_sep_in_array, NULL);
|
||||||
@ -66,7 +66,7 @@ show_pkg_revdeps(struct xbps_handle *xhp, const char *pkgname)
|
|||||||
if (pkgd == NULL) {
|
if (pkgd == NULL) {
|
||||||
pkgd = xbps_find_pkg_dict_installed(xhp, pkgname, false);
|
pkgd = xbps_find_pkg_dict_installed(xhp, pkgname, false);
|
||||||
if (pkgd == NULL)
|
if (pkgd == NULL)
|
||||||
return 0;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
rv = xbps_callback_array_iter_in_dict(xhp, pkgd, "requiredby",
|
rv = xbps_callback_array_iter_in_dict(xhp, pkgd, "requiredby",
|
||||||
list_strings_sep_in_array, NULL);
|
list_strings_sep_in_array, NULL);
|
||||||
|
@ -176,7 +176,7 @@ show_pkg_info_from_metadir(struct xbps_handle *xhp,
|
|||||||
|
|
||||||
d = xbps_dictionary_from_metadata_plist(xhp, pkgname, XBPS_PKGPROPS);
|
d = xbps_dictionary_from_metadata_plist(xhp, pkgname, XBPS_PKGPROPS);
|
||||||
if (d == NULL)
|
if (d == NULL)
|
||||||
return EINVAL;
|
return ENOENT;
|
||||||
|
|
||||||
prop_dictionary_get_cstring_nocopy(d, "pkgname", &pname);
|
prop_dictionary_get_cstring_nocopy(d, "pkgname", &pname);
|
||||||
pkgdb_d = xbps_pkgdb_get_pkgd(xhp, pname, false);
|
pkgdb_d = xbps_pkgdb_get_pkgd(xhp, pname, false);
|
||||||
@ -209,7 +209,7 @@ show_pkg_files_from_metadir(struct xbps_handle *xhp, const char *pkgname)
|
|||||||
|
|
||||||
d = xbps_dictionary_from_metadata_plist(xhp, pkgname, XBPS_PKGFILES);
|
d = xbps_dictionary_from_metadata_plist(xhp, pkgname, XBPS_PKGFILES);
|
||||||
if (d == NULL)
|
if (d == NULL)
|
||||||
return EINVAL;
|
return ENOENT;
|
||||||
|
|
||||||
rv = show_pkg_files(d);
|
rv = show_pkg_files(d);
|
||||||
prop_object_release(d);
|
prop_object_release(d);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user