libxbps: do not loop forever on errors while syncing a remote repo.
This commit is contained in:
parent
12ac81e00e
commit
f6476e210c
5
NEWS
5
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.
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user