xbps_rpool_sync: new arg to specify the file; bump XBPS_API_VERSION.

This commit is contained in:
Juan RP 2012-11-07 10:37:58 +01:00
parent e01b9a8756
commit 05984a31b1
2 changed files with 11 additions and 22 deletions

View File

@ -56,7 +56,7 @@
*/ */
#define XBPS_PKGINDEX_VERSION "1.5" #define XBPS_PKGINDEX_VERSION "1.5"
#define XBPS_API_VERSION "20121107" #define XBPS_API_VERSION "20121107-1"
#ifndef XBPS_VERSION #ifndef XBPS_VERSION
#define XBPS_VERSION "UNSET" #define XBPS_VERSION "UNSET"
@ -1575,17 +1575,18 @@ struct xbps_rpool_index {
}; };
/** /**
* Synchronizes the package index file for all remote repositories * Synchronizes \a file for all remote repositories
* as specified in the configuration file or if \a uri argument is * as specified in the configuration file or if \a uri argument is
* set, just sync the index file for that repository. * set, just sync \a file for that repository.
* *
* @param[in] xhp Pointer to the xbps_handle struct. * @param[in] xhp Pointer to the xbps_handle struct.
* @param[in] file File to synchronize.
* @param[in] uri Repository URI to match for sync (optional). * @param[in] uri Repository URI to match for sync (optional).
* *
* @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_rpool_sync(struct xbps_handle *xhp, const char *uri); int xbps_rpool_sync(struct xbps_handle *xhp, const char *file, const char *uri);
/** /**
* Iterates over the repository pool and executes the \a fn function * Iterates over the repository pool and executes the \a fn function

View File

@ -147,7 +147,7 @@ xbps_rpool_release(struct xbps_handle *xhp)
} }
int int
xbps_rpool_sync(struct xbps_handle *xhp, const char *uri) xbps_rpool_sync(struct xbps_handle *xhp, const char *file, const char *uri)
{ {
const char *repouri; const char *repouri;
size_t i; size_t i;
@ -160,24 +160,12 @@ xbps_rpool_sync(struct xbps_handle *xhp, const char *uri)
/* If argument was set just process that repository */ /* If argument was set just process that repository */
if (uri && strcmp(repouri, uri)) if (uri && strcmp(repouri, uri))
continue; continue;
/*
* Fetch repository index. if (xbps_repository_sync_pkg_index(xhp, repouri, file) == -1) {
*/
if (xbps_repository_sync_pkg_index(xhp, repouri, XBPS_PKGINDEX) == -1) {
xbps_dbg_printf(xhp, xbps_dbg_printf(xhp,
"[rpool] `%s' failed to fetch: %s\n", "[rpool] `%s' failed to fetch `%s': %s\n",
repouri, fetchLastErrCode == 0 ? strerror(errno) : repouri, file,
xbps_fetch_error_string()); fetchLastErrCode == 0 ? strerror(errno) :
continue;
}
/*
* Fetch repository files index.
*/
if (xbps_repository_sync_pkg_index(xhp, repouri,
XBPS_PKGINDEX_FILES) == -1) {
xbps_dbg_printf(xhp,
"[rpool] `%s' failed to fetch: %s\n",
repouri, fetchLastErrCode == 0 ? strerror(errno) :
xbps_fetch_error_string()); xbps_fetch_error_string());
continue; continue;
} }