xbps-repo: implement new target 'pkg-list' to list pkgs from target repo.
This commit is contained in:
@@ -41,6 +41,7 @@ struct xferstat {
|
||||
struct list_pkgver_cb {
|
||||
pkg_state_t state;
|
||||
size_t pkgver_len;
|
||||
bool check_state;
|
||||
};
|
||||
|
||||
/* from transaction.c */
|
||||
|
||||
@@ -43,17 +43,18 @@ list_pkgs_in_dict(prop_object_t obj, void *arg, bool *loop_done)
|
||||
|
||||
(void)loop_done;
|
||||
|
||||
if (xbps_pkg_state_dictionary(obj, &curstate))
|
||||
return EINVAL;
|
||||
|
||||
if (lpc->state == 0) {
|
||||
/* Only list packages that are fully installed */
|
||||
if (curstate != XBPS_PKG_STATE_INSTALLED)
|
||||
return 0;
|
||||
} else {
|
||||
/* Only list packages with specified state */
|
||||
if (curstate != lpc->state)
|
||||
return 0;
|
||||
if (lpc->check_state) {
|
||||
if (xbps_pkg_state_dictionary(obj, &curstate))
|
||||
return EINVAL;
|
||||
if (lpc->state == 0) {
|
||||
/* Only list packages that are fully installed */
|
||||
if (curstate != XBPS_PKG_STATE_INSTALLED)
|
||||
return 0;
|
||||
} else {
|
||||
/* Only list packages with specified state */
|
||||
if (curstate != lpc->state)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||
|
||||
@@ -198,6 +198,7 @@ main(int argc, char **argv)
|
||||
goto out;
|
||||
}
|
||||
|
||||
lpc.check_state = true;
|
||||
lpc.state = 0;
|
||||
if (argv[1]) {
|
||||
if (strcmp(argv[1], "installed") == 0)
|
||||
|
||||
Reference in New Issue
Block a user