libxbps: rename xbps_repository_pool_xxx to xbps_rpool_xxx.

This commit is contained in:
Juan RP 2012-05-30 10:56:32 +02:00
parent da4b8b7427
commit 922ee1f1b6
11 changed files with 47 additions and 54 deletions

View File

@ -78,7 +78,7 @@ cachedir_clean(void)
* Remove binary pkg if it's not registered in any repository * Remove binary pkg if it's not registered in any repository
* or if hash doesn't match. * or if hash doesn't match.
*/ */
repo_pkgd = xbps_repository_pool_find_pkg_exact(pkgver); repo_pkgd = xbps_rpool_find_pkg_exact(pkgver);
if (repo_pkgd) { if (repo_pkgd) {
prop_dictionary_get_cstring_nocopy(repo_pkgd, prop_dictionary_get_cstring_nocopy(repo_pkgd,
"filename-sha256", &rsha256); "filename-sha256", &rsha256);

View File

@ -124,7 +124,7 @@ repo_find_files_in_packages(int npatterns, char **patterns)
ffd->npatterns = npatterns; ffd->npatterns = npatterns;
ffd->patterns = patterns; ffd->patterns = patterns;
rv = xbps_repository_pool_foreach(find_files_in_package, ffd); rv = xbps_rpool_foreach(find_files_in_package, ffd);
free(ffd); free(ffd);
return rv; return rv;
} }

View File

@ -150,7 +150,7 @@ main(int argc, char **argv)
if (argc != 1) if (argc != 1)
usage(true); usage(true);
rv = xbps_repository_pool_foreach(repo_list_uri_cb, NULL); rv = xbps_rpool_foreach(repo_list_uri_cb, NULL);
if (rv == ENOTSUP) if (rv == ENOTSUP)
xbps_error_printf("xbps-repo: no repositories " xbps_error_printf("xbps-repo: no repositories "
"currently registered!\n"); "currently registered!\n");
@ -164,7 +164,7 @@ main(int argc, char **argv)
if (argc < 1 || argc > 2) if (argc < 1 || argc > 2)
usage(true); usage(true);
rv = xbps_repository_pool_foreach(repo_pkg_list_cb, argv[1]); rv = xbps_rpool_foreach(repo_pkg_list_cb, argv[1]);
if (rv == ENOTSUP) if (rv == ENOTSUP)
xbps_error_printf("xbps-repo: no repositories " xbps_error_printf("xbps-repo: no repositories "
"currently registered!\n"); "currently registered!\n");
@ -186,7 +186,7 @@ main(int argc, char **argv)
} }
rsd->npatterns = argc; rsd->npatterns = argc;
rsd->patterns = argv; rsd->patterns = argv;
rv = xbps_repository_pool_foreach(repo_search_pkgs_cb, rsd); rv = xbps_rpool_foreach(repo_search_pkgs_cb, rsd);
free(rsd); free(rsd);
if (rv == ENOTSUP) if (rv == ENOTSUP)
xbps_error_printf("xbps-repo: no repositories " xbps_error_printf("xbps-repo: no repositories "
@ -231,8 +231,7 @@ main(int argc, char **argv)
if (argc != 2) if (argc != 2)
usage(true); usage(true);
pkgd = xbps_repository_pool_dictionary_metadata_plist(argv[1], pkgd = xbps_rpool_dictionary_metadata_plist(argv[1], XBPS_PKGFILES);
XBPS_PKGFILES);
if (pkgd == NULL) { if (pkgd == NULL) {
if (errno == ENOTSUP) { if (errno == ENOTSUP) {
xbps_error_printf("xbps-repo: no repositories " xbps_error_printf("xbps-repo: no repositories "
@ -274,7 +273,7 @@ main(int argc, char **argv)
if (argc != 1) if (argc != 1)
usage(true); usage(true);
rv = xbps_repository_pool_sync(); rv = xbps_rpool_sync();
if (rv == ENOTSUP) { if (rv == ENOTSUP) {
xbps_error_printf("xbps-repo: no repositories " xbps_error_printf("xbps-repo: no repositories "
"currently registered!\n"); "currently registered!\n");

View File

@ -49,9 +49,9 @@ show_pkg_info_from_repolist(const char *pattern, const char *option)
prop_dictionary_t pkgd; prop_dictionary_t pkgd;
if (xbps_pkgpattern_version(pattern)) if (xbps_pkgpattern_version(pattern))
pkgd = xbps_repository_pool_find_pkg(pattern, true, false); pkgd = xbps_rpool_find_pkg(pattern, true, false);
else else
pkgd = xbps_repository_pool_find_pkg(pattern, false, true); pkgd = xbps_rpool_find_pkg(pattern, false, true);
if (pkgd == NULL) if (pkgd == NULL)
return errno; return errno;
@ -73,9 +73,9 @@ show_pkg_deps_from_repolist(const char *pattern)
const char *ver, *repoloc; const char *ver, *repoloc;
if (xbps_pkgpattern_version(pattern)) if (xbps_pkgpattern_version(pattern))
pkgd = xbps_repository_pool_find_pkg(pattern, true, false); pkgd = xbps_rpool_find_pkg(pattern, true, false);
else else
pkgd = xbps_repository_pool_find_pkg(pattern, false, true); pkgd = xbps_rpool_find_pkg(pattern, false, true);
if (pkgd == NULL) if (pkgd == NULL)
return errno; return errno;

View File

@ -56,7 +56,7 @@
*/ */
#define XBPS_PKGINDEX_VERSION "1.4" #define XBPS_PKGINDEX_VERSION "1.4"
#define XBPS_API_VERSION "20120530" #define XBPS_API_VERSION "20120530-1"
#define XBPS_VERSION "0.16" #define XBPS_VERSION "0.16"
/** /**
@ -1514,7 +1514,7 @@ struct repository_pool_index {
* @return 0 on success, ENOTSUP if no repositories were found in * @return 0 on success, ENOTSUP if no repositories were found in
* the configuration file. * the configuration file.
*/ */
int xbps_repository_pool_sync(void); int xbps_rpool_sync(void);
/** /**
* Iterates over the repository pool and executes the \a fn function * Iterates over the repository pool and executes the \a fn function
@ -1530,7 +1530,7 @@ int xbps_repository_pool_sync(void);
* *
* @return 0 on success, otherwise an errno value. * @return 0 on success, otherwise an errno value.
*/ */
int xbps_repository_pool_foreach( int xbps_rpool_foreach(
int (*fn)(struct repository_pool_index *, void *, bool *), int (*fn)(struct repository_pool_index *, void *, bool *),
void *arg); void *arg);
@ -1549,8 +1549,7 @@ int xbps_repository_pool_foreach(
* @note When returned dictionary is no longer needed, you must release it * @note When returned dictionary is no longer needed, you must release it
* with prop_object_release(3). * with prop_object_release(3).
*/ */
prop_dictionary_t prop_dictionary_t xbps_rpool_find_pkg(const char *pkg, bool bypattern, bool best);
xbps_repository_pool_find_pkg(const char *pkg, bool bypattern, bool best);
/** /**
* Finds a package dictionary in repository pool by matching its \a pkgver * Finds a package dictionary in repository pool by matching its \a pkgver
@ -1562,7 +1561,7 @@ prop_dictionary_t
* @note When returned dictionary is no longer needed, you must release it * @note When returned dictionary is no longer needed, you must release it
* with prop_object_release(3). * with prop_object_release(3).
*/ */
prop_dictionary_t xbps_repository_pool_find_pkg_exact(const char *pkgver); prop_dictionary_t xbps_rpool_find_pkg_exact(const char *pkgver);
/** /**
* Finds a package dictionary in repository pool by specifying a * Finds a package dictionary in repository pool by specifying a
@ -1576,8 +1575,7 @@ prop_dictionary_t xbps_repository_pool_find_pkg_exact(const char *pkgver);
* @note When returned dictionary is no longer needed, you must release it * @note When returned dictionary is no longer needed, you must release it
* with prop_object_release(3). * with prop_object_release(3).
*/ */
prop_dictionary_t prop_dictionary_t xbps_rpool_find_virtualpkg(const char *pkg, bool bypattern);
xbps_repository_pool_find_virtualpkg(const char *pkg, bool bypattern);
/** /**
* Finds a package dictionary in repository pool by specifying a * Finds a package dictionary in repository pool by specifying a
@ -1592,8 +1590,7 @@ prop_dictionary_t
* @note When returned dictionary is no longer needed, you must release it * @note When returned dictionary is no longer needed, you must release it
* with prop_object_release(3). * with prop_object_release(3).
*/ */
prop_dictionary_t prop_dictionary_t xbps_rpool_find_virtualpkg_conf(const char *pkg, bool bypattern);
xbps_repository_pool_find_virtualpkg_conf(const char *pkg, bool bypattern);
/** /**
* Iterate over the the repository pool and search for a metadata plist * Iterate over the the repository pool and search for a metadata plist
@ -1613,8 +1610,7 @@ prop_dictionary_t
* binary package file has been found but the plist file could not * binary package file has been found but the plist file could not
* be found. * be found.
*/ */
prop_dictionary_t prop_dictionary_t xbps_rpool_dictionary_metadata_plist(const char *pattern,
xbps_repository_pool_dictionary_metadata_plist(const char *pattern,
const char *plistf); const char *plistf);
/*@}*/ /*@}*/

View File

@ -75,8 +75,8 @@ void HIDDEN xbps_pkgdb_release(struct xbps_handle *);
* @private * @private
* From lib/repository_pool.c * From lib/repository_pool.c
*/ */
int HIDDEN xbps_repository_pool_init(struct xbps_handle *); int HIDDEN xbps_rpool_init(struct xbps_handle *);
void HIDDEN xbps_repository_pool_release(struct xbps_handle *); void HIDDEN xbps_rpool_release(struct xbps_handle *);
/** /**
* @private * @private

View File

@ -218,7 +218,7 @@ xbps_end(void)
return; return;
xbps_pkgdb_release(xhp); xbps_pkgdb_release(xhp);
xbps_repository_pool_release(xhp); xbps_rpool_release(xhp);
xbps_fetch_unset_cache_connection(); xbps_fetch_unset_cache_connection();
if (xhp->cfg != NULL) if (xhp->cfg != NULL)

View File

@ -386,9 +386,9 @@ find_repo_deps(prop_dictionary_t transd, /* transaction dictionary */
* If dependency does not match add pkg into the missing * If dependency does not match add pkg into the missing
* deps array and pass to next one. * deps array and pass to next one.
*/ */
if (((curpkgd = xbps_repository_pool_find_virtualpkg_conf(reqpkg, true)) == NULL) && if (((curpkgd = xbps_rpool_find_virtualpkg_conf(reqpkg, true)) == NULL) &&
((curpkgd = xbps_repository_pool_find_pkg(reqpkg, true, true)) == NULL) && ((curpkgd = xbps_rpool_find_pkg(reqpkg, true, true)) == NULL) &&
((curpkgd = xbps_repository_pool_find_virtualpkg(reqpkg, true)) == NULL)) { ((curpkgd = xbps_rpool_find_virtualpkg(reqpkg, true)) == NULL)) {
/* pkg not found, there was some error */ /* pkg not found, there was some error */
if (errno && errno != ENOENT) { if (errno && errno != ENOENT) {
xbps_dbg_printf("failed to find pkg " xbps_dbg_printf("failed to find pkg "

View File

@ -63,7 +63,7 @@ check_repo_arch(const char *uri)
} }
int HIDDEN int HIDDEN
xbps_repository_pool_init(struct xbps_handle *xhp) xbps_rpool_init(struct xbps_handle *xhp)
{ {
prop_dictionary_t d = NULL; prop_dictionary_t d = NULL;
prop_array_t array; prop_array_t array;
@ -146,14 +146,14 @@ xbps_repository_pool_init(struct xbps_handle *xhp)
xbps_dbg_printf("[rpool] initialized ok.\n"); xbps_dbg_printf("[rpool] initialized ok.\n");
out: out:
if (rv != 0) if (rv != 0)
xbps_repository_pool_release(xhp); xbps_rpool_release(xhp);
return rv; return rv;
} }
void HIDDEN void HIDDEN
xbps_repository_pool_release(struct xbps_handle *xhp) xbps_rpool_release(struct xbps_handle *xhp)
{ {
prop_array_t idx; prop_array_t idx;
prop_dictionary_t d; prop_dictionary_t d;
@ -176,7 +176,7 @@ xbps_repository_pool_release(struct xbps_handle *xhp)
} }
int int
xbps_repository_pool_sync(void) xbps_rpool_sync(void)
{ {
const struct xbps_handle *xhp = xbps_handle_get(); const struct xbps_handle *xhp = xbps_handle_get();
const char *repouri; const char *repouri;
@ -222,8 +222,7 @@ xbps_repository_pool_sync(void)
} }
int int
xbps_repository_pool_foreach( xbps_rpool_foreach(int (*fn)(struct repository_pool_index *, void *, bool *),
int (*fn)(struct repository_pool_index *, void *, bool *),
void *arg) void *arg)
{ {
prop_dictionary_t d; prop_dictionary_t d;
@ -235,7 +234,7 @@ xbps_repository_pool_foreach(
assert(fn != NULL); assert(fn != NULL);
/* Initialize repository pool */ /* Initialize repository pool */
if ((rv = xbps_repository_pool_init(xhp)) != 0) { if ((rv = xbps_rpool_init(xhp)) != 0) {
if (rv == ENOTSUP) { if (rv == ENOTSUP) {
xbps_dbg_printf("[rpool] empty repository list.\n"); xbps_dbg_printf("[rpool] empty repository list.\n");
} else if (rv != ENOENT && rv != ENOTSUP) { } else if (rv != ENOENT && rv != ENOTSUP) {

View File

@ -215,31 +215,31 @@ repo_find_pkg(const char *pkg, bool bypattern, pkg_repo_type_t type)
* Find exact pkg version. * Find exact pkg version.
*/ */
rpf->exact = true; rpf->exact = true;
rv = xbps_repository_pool_foreach(repo_find_pkg_cb, rpf); rv = xbps_rpool_foreach(repo_find_pkg_cb, rpf);
break; break;
case BEST_PKG: case BEST_PKG:
/* /*
* Find best pkg version. * Find best pkg version.
*/ */
rv = xbps_repository_pool_foreach(repo_find_best_pkg_cb, rpf); rv = xbps_rpool_foreach(repo_find_best_pkg_cb, rpf);
break; break;
case VIRTUAL_PKG: case VIRTUAL_PKG:
/* /*
* Find virtual pkg. * Find virtual pkg.
*/ */
rv = xbps_repository_pool_foreach(repo_find_virtualpkg_cb, rpf); rv = xbps_rpool_foreach(repo_find_virtualpkg_cb, rpf);
break; break;
case VIRTUAL_CONF_PKG: case VIRTUAL_CONF_PKG:
/* /*
* Find virtual pkg as specified in configuration file. * Find virtual pkg as specified in configuration file.
*/ */
rv = xbps_repository_pool_foreach(repo_find_virtualpkg_conf_cb, rpf); rv = xbps_rpool_foreach(repo_find_virtualpkg_conf_cb, rpf);
break; break;
case REAL_PKG: case REAL_PKG:
/* /*
* Find real pkg. * Find real pkg.
*/ */
rv = xbps_repository_pool_foreach(repo_find_pkg_cb, rpf); rv = xbps_rpool_foreach(repo_find_pkg_cb, rpf);
break; break;
} }
if (rv != 0) if (rv != 0)
@ -249,7 +249,7 @@ repo_find_pkg(const char *pkg, bool bypattern, pkg_repo_type_t type)
} }
prop_dictionary_t prop_dictionary_t
xbps_repository_pool_find_virtualpkg(const char *pkg, bool bypattern) xbps_rpool_find_virtualpkg(const char *pkg, bool bypattern)
{ {
struct repo_pool_fpkg *rpf; struct repo_pool_fpkg *rpf;
prop_dictionary_t pkgd = NULL; prop_dictionary_t pkgd = NULL;
@ -265,7 +265,7 @@ xbps_repository_pool_find_virtualpkg(const char *pkg, bool bypattern)
} }
prop_dictionary_t prop_dictionary_t
xbps_repository_pool_find_virtualpkg_conf(const char *pkg, bool bypattern) xbps_rpool_find_virtualpkg_conf(const char *pkg, bool bypattern)
{ {
struct repo_pool_fpkg *rpf; struct repo_pool_fpkg *rpf;
prop_dictionary_t pkgd = NULL; prop_dictionary_t pkgd = NULL;
@ -281,7 +281,7 @@ xbps_repository_pool_find_virtualpkg_conf(const char *pkg, bool bypattern)
} }
prop_dictionary_t prop_dictionary_t
xbps_repository_pool_find_pkg(const char *pkg, bool bypattern, bool best) xbps_rpool_find_pkg(const char *pkg, bool bypattern, bool best)
{ {
struct repo_pool_fpkg *rpf; struct repo_pool_fpkg *rpf;
prop_dictionary_t pkgd = NULL; prop_dictionary_t pkgd = NULL;
@ -301,7 +301,7 @@ xbps_repository_pool_find_pkg(const char *pkg, bool bypattern, bool best)
} }
prop_dictionary_t prop_dictionary_t
xbps_repository_pool_find_pkg_exact(const char *pkgver) xbps_rpool_find_pkg_exact(const char *pkgver)
{ {
struct repo_pool_fpkg *rpf; struct repo_pool_fpkg *rpf;
prop_dictionary_t pkgd = NULL; prop_dictionary_t pkgd = NULL;
@ -317,8 +317,7 @@ xbps_repository_pool_find_pkg_exact(const char *pkgver)
} }
prop_dictionary_t prop_dictionary_t
xbps_repository_pool_dictionary_metadata_plist(const char *pattern, xbps_rpool_dictionary_metadata_plist(const char *pattern, const char *plistf)
const char *plistf)
{ {
prop_dictionary_t pkgd = NULL, plistd = NULL; prop_dictionary_t pkgd = NULL, plistd = NULL;
const char *repoloc; const char *repoloc;
@ -336,9 +335,9 @@ xbps_repository_pool_dictionary_metadata_plist(const char *pattern,
* libfetch! * libfetch!
*/ */
if (xbps_pkgpattern_version(pattern)) if (xbps_pkgpattern_version(pattern))
pkgd = xbps_repository_pool_find_pkg(pattern, true, false); pkgd = xbps_rpool_find_pkg(pattern, true, false);
else else
pkgd = xbps_repository_pool_find_pkg(pattern, false, true); pkgd = xbps_rpool_find_pkg(pattern, false, true);
if (pkgd == NULL) if (pkgd == NULL)
goto out; goto out;

View File

@ -84,9 +84,9 @@ transaction_find_pkg(const char *pkg, bool bypattern, bool bestpkg, int action)
/* /*
* Find out if the pkg has been found in repository pool. * Find out if the pkg has been found in repository pool.
*/ */
if (((pkg_repod = xbps_repository_pool_find_virtualpkg_conf(pkg, bypattern)) == NULL) && if (((pkg_repod = xbps_rpool_find_virtualpkg_conf(pkg, bypattern)) == NULL) &&
((pkg_repod = xbps_repository_pool_find_pkg(pkg, bypattern, bestpkg)) == NULL) && ((pkg_repod = xbps_rpool_find_pkg(pkg, bypattern, bestpkg)) == NULL) &&
((pkg_repod = xbps_repository_pool_find_virtualpkg(pkg, bypattern)) == NULL)) { ((pkg_repod = xbps_rpool_find_virtualpkg(pkg, bypattern)) == NULL)) {
/* not found */ /* not found */
rv = errno; rv = errno;
errno = 0; errno = 0;