xbps-query(8): --search --property now works with <number> objects.
For example to find a package where its binpkg file is bigger than 1GB: $ xbps-query --regex -s [0-9][0-9][0-9][0-9]MB -p filename-size
This commit is contained in:
parent
766cbcf683
commit
0b116a0f3f
4
NEWS
4
NEWS
@ -1,5 +1,9 @@
|
||||
xbps-0.38 (???):
|
||||
|
||||
* xbps-query(8): --search --property now works with <number> objects, i.e:
|
||||
|
||||
$ xbps-query -s '' -p filename-size
|
||||
|
||||
* xbps-remove(8): -O/--clean-cache no longer triggers an assertion when the
|
||||
cache directory is empty.
|
||||
|
||||
|
@ -162,6 +162,26 @@ search_array_cb(struct xbps_handle *xhp _unused,
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (xbps_object_type(obj2) == XBPS_TYPE_NUMBER) {
|
||||
/* property is a number */
|
||||
char size[8];
|
||||
|
||||
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||
if (xbps_humanize_number(size, xbps_number_integer_value(obj2)) == -1)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
if (sd->regex) {
|
||||
if (regcomp(®ex, sd->pat, REG_EXTENDED|REG_NOSUB) != 0)
|
||||
return errno;
|
||||
if (regexec(®ex, size, 0, 0, 0) == 0) {
|
||||
printf("%s: %s (%s)\n", pkgver, size, sd->repourl);
|
||||
}
|
||||
regfree(®ex);
|
||||
} else {
|
||||
if (strcasestr(size, sd->pat)) {
|
||||
printf("%s: %s (%s)\n", pkgver, size, sd->repourl);
|
||||
}
|
||||
}
|
||||
} else if (xbps_object_type(obj2) == XBPS_TYPE_BOOL) {
|
||||
/* property is a bool */
|
||||
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||
|
Loading…
Reference in New Issue
Block a user