Fixed issue 21 "xbps-repo find-files is awfully slow" reported by ojab.
This commit is contained in:
@@ -196,9 +196,20 @@ xbps_repository_pool_sync(const struct xbps_handle *xhp)
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* Fetch repository index file.
|
||||
* Fetch repository index.plist.
|
||||
*/
|
||||
rv = xbps_repository_sync_pkg_index(repouri);
|
||||
rv = xbps_repository_sync_pkg_index(repouri, XBPS_PKGINDEX);
|
||||
if (rv == -1) {
|
||||
xbps_dbg_printf("[rpool] `%s' failed to fetch: %s\n",
|
||||
repouri, fetchLastErrCode == 0 ?
|
||||
strerror(errno) : xbps_fetch_error_string());
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* Fetch repository index-files.plist.
|
||||
*/
|
||||
rv = xbps_repository_sync_pkg_index(repouri,
|
||||
XBPS_PKGINDEX_FILES);
|
||||
if (rv == -1) {
|
||||
xbps_dbg_printf("[rpool] `%s' failed to fetch: %s\n",
|
||||
repouri, fetchLastErrCode == 0 ?
|
||||
|
||||
@@ -86,7 +86,7 @@ xbps_get_remote_repo_string(const char *uri)
|
||||
* size and/or mtime match) and 1 if downloaded successfully.
|
||||
*/
|
||||
int
|
||||
xbps_repository_sync_pkg_index(const char *uri)
|
||||
xbps_repository_sync_pkg_index(const char *uri, const char *plistf)
|
||||
{
|
||||
prop_dictionary_t tmpd;
|
||||
struct xbps_handle *xhp;
|
||||
@@ -132,7 +132,7 @@ xbps_repository_sync_pkg_index(const char *uri)
|
||||
/*
|
||||
* Remote repository index.plist full URL.
|
||||
*/
|
||||
rpidx = xbps_xasprintf("%s/%s", uri, XBPS_PKGINDEX);
|
||||
rpidx = xbps_xasprintf("%s/%s", uri, plistf);
|
||||
if (rpidx == NULL) {
|
||||
rv = -1;
|
||||
goto out;
|
||||
@@ -141,7 +141,7 @@ xbps_repository_sync_pkg_index(const char *uri)
|
||||
* Save temporary file in XBPS_META_PATH, and rename if it
|
||||
* was downloaded successfully.
|
||||
*/
|
||||
tmp_metafile = xbps_xasprintf("%s/%s", metadir, XBPS_PKGINDEX);
|
||||
tmp_metafile = xbps_xasprintf("%s/%s", metadir, plistf);
|
||||
if (tmp_metafile == NULL) {
|
||||
rv = -1;
|
||||
goto out;
|
||||
@@ -200,7 +200,7 @@ xbps_repository_sync_pkg_index(const char *uri)
|
||||
}
|
||||
prop_object_release(tmpd);
|
||||
|
||||
lrepofile = xbps_xasprintf("%s/%s", lrepodir, XBPS_PKGINDEX);
|
||||
lrepofile = xbps_xasprintf("%s/%s", lrepodir, plistf);
|
||||
if (lrepofile == NULL) {
|
||||
rv = -1;
|
||||
goto out;
|
||||
|
||||
20
lib/util.c
20
lib/util.c
@@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2008-2011 Juan Romero Pardines.
|
||||
* Copyright (c) 2008-2012 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -201,7 +201,7 @@ xbps_pkgpattern_version(const char *pkg)
|
||||
}
|
||||
|
||||
static char *
|
||||
get_pkg_index_remote_plist(const char *uri)
|
||||
get_pkg_index_remote_plist(const char *uri, const char *plistf)
|
||||
{
|
||||
struct xbps_handle *xhp;
|
||||
char *uri_fixed, *repodir;
|
||||
@@ -215,11 +215,11 @@ get_pkg_index_remote_plist(const char *uri)
|
||||
|
||||
if (strcmp(xhp->rootdir, "/") == 0) {
|
||||
repodir = xbps_xasprintf("/%s/%s/%s",
|
||||
XBPS_META_PATH, uri_fixed, XBPS_PKGINDEX);
|
||||
XBPS_META_PATH, uri_fixed, plistf);
|
||||
} else {
|
||||
repodir = xbps_xasprintf("%s/%s/%s/%s",
|
||||
xhp->rootdir,
|
||||
XBPS_META_PATH, uri_fixed, XBPS_PKGINDEX);
|
||||
XBPS_META_PATH, uri_fixed, plistf);
|
||||
}
|
||||
free(uri_fixed);
|
||||
return repodir;
|
||||
@@ -231,11 +231,21 @@ xbps_pkg_index_plist(const char *uri)
|
||||
assert(uri != NULL);
|
||||
|
||||
if (xbps_check_is_repository_uri_remote(uri))
|
||||
return get_pkg_index_remote_plist(uri);
|
||||
return get_pkg_index_remote_plist(uri, XBPS_PKGINDEX);
|
||||
|
||||
return xbps_xasprintf("%s/%s", uri, XBPS_PKGINDEX);
|
||||
}
|
||||
|
||||
char *
|
||||
xbps_pkg_index_files_plist(const char *uri)
|
||||
{
|
||||
assert(uri != NULL);
|
||||
if (xbps_check_is_repository_uri_remote(uri))
|
||||
return get_pkg_index_remote_plist(uri, XBPS_PKGINDEX_FILES);
|
||||
|
||||
return xbps_xasprintf("%s/%s", uri, XBPS_PKGINDEX_FILES);
|
||||
}
|
||||
|
||||
char *
|
||||
xbps_path_from_repository_uri(prop_dictionary_t pkg_repod, const char *repoloc)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user