xbps-bin(8): the 'find-files' target now accepts multiple patterns.
This commit is contained in:
parent
13331f801c
commit
d4278be914
7
NEWS
7
NEWS
@ -1,11 +1,14 @@
|
||||
xbps-0.11.1 (???):
|
||||
|
||||
* libxbps: more paranoid type checking and allocation results, to make
|
||||
sure that out of memory conditions are handled gracefully.
|
||||
* xbps-bin(8): the 'find-files' target accepts multiple patterns, such as:
|
||||
$ xbps-bin find-files /bin/cat '/bin/f*' ...
|
||||
|
||||
* xbps-repo(8): the 'search' target accepts multiple patterns, such as:
|
||||
$ xbps-repo search 'foo-[0-9]*' '*blah*' ...
|
||||
|
||||
* libxbps: more paranoid type checking and allocation results, to make
|
||||
sure that out of memory conditions are handled gracefully.
|
||||
|
||||
xbps-0.11.0 (2011-12-20):
|
||||
|
||||
* xbps-bin(8): it is possible now to reinstall a package even if it's
|
||||
|
@ -80,7 +80,7 @@ int show_pkg_files_from_metadir(const char *);
|
||||
int show_orphans(void);
|
||||
|
||||
/* from find-files.c */
|
||||
int find_files_in_packages(const char *);
|
||||
int find_files_in_packages(int, char **);
|
||||
|
||||
/* from question.c */
|
||||
bool yesno(const char *, ...);
|
||||
|
@ -36,13 +36,17 @@
|
||||
#include "defs.h"
|
||||
|
||||
static int
|
||||
match_files_by_pattern(prop_dictionary_t pkg_filesd, prop_dictionary_keysym_t key,
|
||||
const char *pattern, const char *pkgname)
|
||||
match_files_by_pattern(prop_dictionary_t pkg_filesd,
|
||||
prop_dictionary_keysym_t key,
|
||||
int npatterns,
|
||||
char **patterns,
|
||||
const char *pkgname)
|
||||
{
|
||||
prop_object_iterator_t iter;
|
||||
prop_array_t array;
|
||||
prop_object_t obj;
|
||||
const char *keyname, *filestr, *typestr;
|
||||
int i;
|
||||
|
||||
keyname = prop_dictionary_keysym_cstring_nocopy(key);
|
||||
array = prop_dictionary_get_keysym(pkg_filesd, key);
|
||||
@ -59,9 +63,11 @@ match_files_by_pattern(prop_dictionary_t pkg_filesd, prop_dictionary_keysym_t ke
|
||||
iter = prop_array_iterator(array);
|
||||
while ((obj = prop_object_iterator_next(iter))) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "file", &filestr);
|
||||
if ((strcmp(filestr, pattern) == 0) ||
|
||||
(xbps_pkgpattern_match(filestr, pattern) == 1))
|
||||
printf("%s: %s (%s)\n", pkgname, filestr, typestr);
|
||||
for (i = 1; i < npatterns; i++) {
|
||||
if ((strcmp(filestr, patterns[i]) == 0) ||
|
||||
(xbps_pkgpattern_match(filestr, patterns[i]) == 1))
|
||||
printf("%s: %s (%s)\n", pkgname, filestr, typestr);
|
||||
}
|
||||
}
|
||||
prop_object_iterator_release(iter);
|
||||
|
||||
@ -69,7 +75,7 @@ match_files_by_pattern(prop_dictionary_t pkg_filesd, prop_dictionary_keysym_t ke
|
||||
}
|
||||
|
||||
int
|
||||
find_files_in_packages(const char *pattern)
|
||||
find_files_in_packages(int npatterns, char **patterns)
|
||||
{
|
||||
struct xbps_handle *xhp;
|
||||
prop_dictionary_t pkg_filesd;
|
||||
@ -107,7 +113,8 @@ find_files_in_packages(const char *pattern)
|
||||
count = prop_array_count(files_keys);
|
||||
for (i = 0; i < count; i++) {
|
||||
rv = match_files_by_pattern(pkg_filesd,
|
||||
prop_array_get(files_keys, i), pattern, dp->d_name);
|
||||
prop_array_get(files_keys, i),
|
||||
npatterns, patterns, dp->d_name);
|
||||
if (rv == -1)
|
||||
break;
|
||||
}
|
||||
|
@ -385,10 +385,10 @@ main(int argc, char **argv)
|
||||
* Find files matched by a pattern from installed
|
||||
* packages.
|
||||
*/
|
||||
if (argc != 2)
|
||||
if (argc < 2)
|
||||
usage(xhp);
|
||||
|
||||
rv = find_files_in_packages(argv[1]);
|
||||
rv = find_files_in_packages(argc, argv);
|
||||
|
||||
} else {
|
||||
usage(xhp);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.Dd December 20, 2011
|
||||
.Dd December 22, 2011
|
||||
.Os Void GNU/Linux
|
||||
.Dt xbps-bin 8
|
||||
.Sh NAME
|
||||
@ -144,10 +144,11 @@ Checks for integrity errors in installed packages. The checks are to found
|
||||
missing run-time dependencies, missing and modified package files and
|
||||
metadata files. If the all keyword is used, all packages currently installed
|
||||
will be checked, otherwise just pkgname.
|
||||
.It Sy find-files Ar pattern
|
||||
.It Sy find-files Ar pattern Ar [patterns ...]
|
||||
Prints the name of the installed
|
||||
.Em package(s)
|
||||
matching the pattern on its file list.
|
||||
matching the pattern on its file list. Multiple patterns can be specified
|
||||
as arguments.
|
||||
.It Sy install Ar pkgname(s) | Ar pkgpattern(s)
|
||||
Install binary package(s) from repository pool by specifying
|
||||
.Em pkgname(s)
|
||||
|
Loading…
Reference in New Issue
Block a user