libxbps: add xbps_repository_pool_sync, to sync repoidx from all remotes.
This commit is contained in:
@@ -38,7 +38,6 @@ int repo_genindex(const char *);
|
||||
/* From repository.c */
|
||||
int show_pkg_info_from_repolist(const char *, const char *);
|
||||
int show_pkg_deps_from_repolist(const char *);
|
||||
int repository_sync(void);
|
||||
|
||||
/* From find-files.c */
|
||||
int repo_find_files_in_packages(const char *);
|
||||
|
@@ -266,7 +266,7 @@ main(int argc, char **argv)
|
||||
if (argc != 1)
|
||||
usage(xhp);
|
||||
|
||||
rv = repository_sync();
|
||||
rv = xbps_repository_pool_sync();
|
||||
if (rv == ENOTSUP) {
|
||||
xbps_error_printf("xbps-repo: no repositories "
|
||||
"currently registered!\n");
|
||||
|
@@ -82,41 +82,3 @@ show_pkg_deps_from_repolist(const char *pkgname)
|
||||
prop_object_release(pkgd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
repo_sync_pkg_index_cb(struct repository_pool_index *rpi, void *arg, bool *done)
|
||||
{
|
||||
prop_dictionary_t d;
|
||||
const char *idxver;
|
||||
uint64_t totalpkgs;
|
||||
char *plist;
|
||||
int rv = 0;
|
||||
|
||||
(void)arg;
|
||||
(void)done;
|
||||
|
||||
if ((rv = xbps_repository_sync_pkg_index(rpi->rpi_uri)) == 0) {
|
||||
printf("Package index file is up to date.\n");
|
||||
return 0;
|
||||
} else if (rv == -1)
|
||||
return rv;
|
||||
|
||||
if ((plist = xbps_pkg_index_plist(rpi->rpi_uri)) == NULL)
|
||||
return EINVAL;
|
||||
|
||||
d = prop_dictionary_internalize_from_zfile(plist);
|
||||
prop_dictionary_get_cstring_nocopy(d, "pkgindex-version", &idxver);
|
||||
prop_dictionary_get_uint64(d, "total-pkgs", &totalpkgs);
|
||||
printf("Updated package index at %s (v%s) with %ju packages.\n",
|
||||
rpi->rpi_uri, idxver, totalpkgs);
|
||||
prop_object_release(d);
|
||||
free(plist);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
repository_sync(void)
|
||||
{
|
||||
return xbps_repository_pool_foreach(repo_sync_pkg_index_cb, NULL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user