xbps-repo: 'sync' and 'pkg-list' target now accept a repository URI argument.
If set, only the matching repository will be used for the task.
This commit is contained in:
@@ -80,6 +80,11 @@ find_files_in_package(struct xbps_rpool_index *rpi, void *arg, bool *done)
|
||||
|
||||
if ((idxfiles = prop_array_internalize_from_zfile(plist)) == NULL) {
|
||||
free(plist);
|
||||
if (errno == ENOENT) {
|
||||
fprintf(stderr, "%s: index-files missing! "
|
||||
"ignoring...\n", rpi->uri);
|
||||
return 0;
|
||||
}
|
||||
return errno;
|
||||
}
|
||||
free(plist);
|
||||
|
@@ -38,15 +38,12 @@ int
|
||||
repo_pkg_list_cb(struct xbps_rpool_index *rpi, void *arg, bool *done)
|
||||
{
|
||||
struct list_pkgver_cb lpc;
|
||||
uint16_t idx;
|
||||
char *cp;
|
||||
const char *repo = arg;
|
||||
|
||||
(void)done;
|
||||
if (arg != NULL) {
|
||||
idx = (uint16_t)strtoul(arg, &cp, 0);
|
||||
if (rpi->index != idx)
|
||||
return 0;
|
||||
}
|
||||
if (repo && strcmp(rpi->uri, repo))
|
||||
return 0;
|
||||
|
||||
lpc.check_state = false;
|
||||
lpc.state = 0;
|
||||
lpc.pkgver_len = find_longest_pkgver(rpi->repo);
|
||||
@@ -64,8 +61,8 @@ repo_list_uri_cb(struct xbps_rpool_index *rpi, void *arg, bool *done)
|
||||
(void)arg;
|
||||
(void)done;
|
||||
|
||||
printf("[%u] %s (%zu packages)\n",
|
||||
rpi->index, rpi->uri, (size_t)prop_array_count(rpi->repo));
|
||||
printf("%s (%zu packages)\n", rpi->uri,
|
||||
(size_t)prop_array_count(rpi->repo));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -61,9 +61,9 @@ usage(bool fail)
|
||||
" Generate a local repository in `directory'.\n"
|
||||
" list\n"
|
||||
" List registered repositories.\n"
|
||||
" pkg-list [index]\n"
|
||||
" Print packages in repository matching `index' number.\n"
|
||||
" If `index' not specified, all registered repositories will be used.\n"
|
||||
" pkg-list [repo]\n"
|
||||
" Print packages in repository matching `repo' URI.\n"
|
||||
" If `repo' not specified, all registered repositories will be used.\n"
|
||||
" search <pattern> [patterns]\n"
|
||||
" Search for packages in repositories matching the patterns.\n"
|
||||
" show <pkgname|pkgpattern>\n"
|
||||
@@ -72,8 +72,9 @@ usage(bool fail)
|
||||
" Print package's required dependencies for `pkgname' or `pkgpattern'.\n"
|
||||
" show-files <pkgname|pkgpattern>\n"
|
||||
" Print package's files list for `pkgname' or `pkgpattern'.\n"
|
||||
" sync\n"
|
||||
" Synchronize package index files for all registered repositories.\n\n"
|
||||
" sync [repo]\n"
|
||||
" Synchronize package index file for `repo'.\n"
|
||||
" If `repo' not specified, all remote repositories will be used. \n\n"
|
||||
"Refer to xbps-repo(8) for a more detailed description.\n");
|
||||
|
||||
exit(fail ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
@@ -266,14 +267,14 @@ main(int argc, char **argv)
|
||||
|
||||
rv = repo_genindex(argv[1]);
|
||||
if (rv == 0)
|
||||
rv = repo_genindex_files(argv[1]);
|
||||
rv = repo_genindex_files(argv[1])
|
||||
|
||||
} else if (strcasecmp(argv[0], "sync") == 0) {
|
||||
/* Syncs the pkg index for all registered remote repos */
|
||||
if (argc != 1)
|
||||
if (argc < 1 || argc > 2)
|
||||
usage(true);
|
||||
|
||||
rv = xbps_rpool_sync();
|
||||
rv = xbps_rpool_sync(argv[1]);
|
||||
if (rv == ENOTSUP) {
|
||||
xbps_error_printf("xbps-repo: no repositories "
|
||||
"currently registered!\n");
|
||||
|
@@ -73,12 +73,11 @@ available in the index. If a newer package is available, the old package file
|
||||
will be removed automatically.
|
||||
.It Sy list
|
||||
Lists all working repositories in repository pool.
|
||||
.It Sy pkg-list Op index
|
||||
Lists all currently registered packages in repository index as specified
|
||||
in the
|
||||
.Ar index
|
||||
argument. If argument is not specified, any package contained in all repositories
|
||||
will be shown. The argument expects a decimal number starting from 0,
|
||||
.It Sy pkg-list Op repository
|
||||
Lists all currently registered packages from all repositories, or just from
|
||||
.Ar repository .
|
||||
If argument is not specified, any package contained in all repositories
|
||||
will be shown. The argument expects the repository URI.
|
||||
matching the output of the
|
||||
.Ar list
|
||||
target.
|
||||
@@ -124,8 +123,9 @@ if a remote repository is the winner and binary package is not available in
|
||||
it will fetch remotely and
|
||||
.Em on the fly
|
||||
the info from target repository.
|
||||
.It Sy sync
|
||||
Syncs the package index file for all registered remote repositories.
|
||||
.It Sy sync Op repository
|
||||
Syncs the package index file for all remote repositories or just for
|
||||
.Ar repository .
|
||||
The index file will be fetched if local and remote size/mtime do not match.
|
||||
.Sh FILES
|
||||
.Bl -tag -width /var/db/xbps/<repodir>/index-files.plist -compact
|
||||
|
Reference in New Issue
Block a user