diff --git a/NEWS b/NEWS index cf0fa65f..45c5e845 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,10 @@ xbps-0.9.1 (???): + * libxbps: xbps_repository_pool no longer loops forever if a package + index plist file cannot be fetched due to network problems, or + if the file is not available anymore; the repository will be + ignored. + * xbps-repo(8): the 'genindex' failed to register in pkg-index packages less than on equal than any other package providing the same package name. Ignore packages providing virtual packages. diff --git a/include/xbps_api.h b/include/xbps_api.h index 65f138c5..664bc8de 100644 --- a/include/xbps_api.h +++ b/include/xbps_api.h @@ -59,7 +59,7 @@ * @def XBPS_RELVER * Current library release date. */ -#define XBPS_RELVER "API: 20110622 INDEX: " XBPS_PKGINDEX_VERSION +#define XBPS_RELVER "API: 20110714 INDEX: " XBPS_PKGINDEX_VERSION /** * @def XBPS_META_PATH diff --git a/lib/repository_pool.c b/lib/repository_pool.c index a9c4186b..cf14855c 100644 --- a/lib/repository_pool.c +++ b/lib/repository_pool.c @@ -47,6 +47,12 @@ static SIMPLEQ_HEAD(rpool_head, repository_pool) rpool_queue = static bool repolist_initialized; +#define FETCH_ERROR(x) ((x == FETCH_UNAVAIL) || \ + (x == FETCH_NETWORK) || \ + (x == FETCH_ABORT) || \ + (x == FETCH_TIMEOUT) || \ + (x == FETCH_DOWN)) + int HIDDEN xbps_repository_pool_init(void) { @@ -112,10 +118,25 @@ xbps_repository_pool_init(void) "`%s'...\n", repouri); rv = xbps_repository_sync_pkg_index(repouri); if (rv == -1) { - xbps_error_printf("failed to sync `%s'" - ": %s %s\n", - repouri, strerror(errno), - xbps_fetch_error_string()); + const char *fetcherr = + xbps_fetch_error_string(); + + xbps_error_printf("failed to sync " + "repository `%s': %s%s\n", + repouri, + errno ? strerror(errno) : "", + fetchLastErrCode ? fetcherr : ""); + + /* + * Ignore if the file cannot be + * fetched due to network, missing + * file, moved, etc. + */ + if (FETCH_ERROR(fetchLastErrCode)) { + rv = 0; + free(plist); + continue; + } rv = errno; free(plist); goto out;