Repository index 1.4 -- see NEWS file for info.

This commit is contained in:
Juan RP
2012-01-19 12:26:40 +01:00
parent 9147488b19
commit 9a088937b5
13 changed files with 118 additions and 156 deletions

View File

@@ -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
@@ -211,6 +211,18 @@ find_virtualpkg_user_in_array(prop_array_t array,
return find_pkg_in_array(array, vpkgname, false, false);
}
prop_dictionary_t HIDDEN
xbps_find_virtualpkg_conf_in_array_by_name(prop_array_t array, const char *name)
{
return find_virtualpkg_user_in_array(array, name, false);
}
prop_dictionary_t HIDDEN
xbps_find_virtualpkg_conf_in_array_by_pattern(prop_array_t array, const char *p)
{
return find_virtualpkg_user_in_array(array, p, true);
}
static prop_dictionary_t
find_virtualpkg_user_in_dict(prop_dictionary_t d,
const char *key,

View File

@@ -1,5 +1,5 @@
/*-
* Copyright (c) 2009-2011 Juan Romero Pardines.
* Copyright (c) 2009-2012 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -122,7 +122,7 @@ xbps_repository_pool_init(struct xbps_handle *xhp)
goto out;
}
if (!xbps_add_obj_to_dict(d,
prop_dictionary_internalize_from_zfile(plist),
prop_array_internalize_from_zfile(plist),
"index")) {
rv = EINVAL;
prop_object_release(d);
@@ -194,7 +194,7 @@ xbps_repository_pool_sync(const struct xbps_handle *xhp)
continue;
}
/*
* Fetch repository index.plist.
* Fetch repository plist index.
*/
rv = xbps_repository_sync_pkg_index(repouri, XBPS_PKGINDEX);
if (rv == -1) {
@@ -204,7 +204,7 @@ xbps_repository_pool_sync(const struct xbps_handle *xhp)
continue;
}
/*
* Fetch repository index-files.plist.
* Fetch repository plist files index.
*/
rv = xbps_repository_sync_pkg_index(repouri,
XBPS_PKGINDEX_FILES);
@@ -249,7 +249,7 @@ xbps_repository_pool_foreach(
d = prop_array_get(xhp->repo_pool, i);
prop_dictionary_get_cstring_nocopy(d, "uri", &rpi->rpi_uri);
rpi->rpi_repod = prop_dictionary_get(d, "index");
rpi->rpi_repo = prop_dictionary_get(d, "index");
rpi->rpi_index = i;
rv = (*fn)(rpi, arg, &done);

View File

@@ -54,12 +54,12 @@ repo_find_virtualpkg_cb(struct repository_pool_index *rpi, void *arg, bool *done
if (rpf->bypattern) {
rpf->pkgd =
xbps_find_virtualpkg_conf_in_dict_by_pattern(rpi->rpi_repod,
"packages", rpf->pattern);
xbps_find_virtualpkg_conf_in_array_by_pattern(rpi->rpi_repo,
rpf->pattern);
} else {
rpf->pkgd =
xbps_find_virtualpkg_conf_in_dict_by_name(rpi->rpi_repod,
"packages", rpf->pattern);
xbps_find_virtualpkg_conf_in_array_by_name(rpi->rpi_repo,
rpf->pattern);
}
if (rpf->pkgd) {
#ifdef DEBUG
@@ -88,25 +88,25 @@ repo_find_pkg_cb(struct repository_pool_index *rpi, void *arg, bool *done)
return 0;
}
/* exact match by pkgver */
rpf->pkgd = xbps_find_pkg_in_dict_by_pkgver(rpi->rpi_repod,
"packages", rpf->pattern);
rpf->pkgd = xbps_find_pkg_in_array_by_pkgver(rpi->rpi_repo,
rpf->pattern);
} else if (rpf->bypattern) {
/* match by pkgpattern in pkgver*/
rpf->pkgd = xbps_find_pkg_in_dict_by_pattern(rpi->rpi_repod,
"packages", rpf->pattern);
rpf->pkgd = xbps_find_pkg_in_array_by_pattern(rpi->rpi_repo,
rpf->pattern);
/* If no pkg exists matching pattern, look for virtual packages */
if (rpf->pkgd == NULL) {
rpf->pkgd = xbps_find_virtualpkg_in_dict_by_pattern(
rpi->rpi_repod, "packages", rpf->pattern);
rpf->pkgd = xbps_find_virtualpkg_in_array_by_pattern(
rpi->rpi_repo, rpf->pattern);
}
} else {
/* match by pkgname */
rpf->pkgd = xbps_find_pkg_in_dict_by_name(rpi->rpi_repod,
"packages", rpf->pattern);
rpf->pkgd = xbps_find_pkg_in_array_by_name(rpi->rpi_repo,
rpf->pattern);
/* If no pkg exists matching pattern, look for virtual packages */
if (rpf->pkgd == NULL) {
rpf->pkgd = xbps_find_virtualpkg_in_dict_by_name(
rpi->rpi_repod, "packages", rpf->pattern);
rpf->pkgd = xbps_find_virtualpkg_in_array_by_name(
rpi->rpi_repo, rpf->pattern);
}
}
if (rpf->pkgd) {
@@ -136,11 +136,11 @@ repo_find_best_pkg_cb(struct repository_pool_index *rpi,
(void)done;
if (rpf->bypattern) {
rpf->pkgd = xbps_find_pkg_in_dict_by_pattern(rpi->rpi_repod,
"packages", rpf->pattern);
rpf->pkgd = xbps_find_pkg_in_array_by_pattern(rpi->rpi_repo,
rpf->pattern);
} else {
rpf->pkgd = xbps_find_pkg_in_dict_by_name(rpi->rpi_repod,
"packages", rpf->pattern);
rpf->pkgd = xbps_find_pkg_in_array_by_name(rpi->rpi_repo,
rpf->pattern);
}
if (rpf->pkgd == NULL) {
if (errno && errno != ENOENT)

View File

@@ -1,5 +1,5 @@
/*-
* Copyright (c) 2009-2011 Juan Romero Pardines.
* Copyright (c) 2009-2012 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -130,7 +130,7 @@ xbps_repository_sync_pkg_index(const char *uri, const char *plistf)
goto out;
}
/*
* Remote repository index.plist full URL.
* Remote repository plist index full URL.
*/
rpidx = xbps_xasprintf("%s/%s", uri, plistf);
if (rpidx == NULL) {
@@ -147,7 +147,8 @@ xbps_repository_sync_pkg_index(const char *uri, const char *plistf)
goto out;
}
/*
* Full path to repository directory to store the index.plist file.
* Full path to repository directory to store the plist
* index file.
*/
lrepodir = xbps_xasprintf("%s/%s/%s",
xhp->rootdir, XBPS_META_PATH, uri_fixedp);
@@ -156,7 +157,7 @@ xbps_repository_sync_pkg_index(const char *uri, const char *plistf)
goto out;
}
/*
* If directory exists probably the index.plist file
* If directory exists probably the plist index file
* was downloaded previously...
*/
rv = stat(lrepodir, &st);
@@ -170,7 +171,7 @@ xbps_repository_sync_pkg_index(const char *uri, const char *plistf)
xbps_set_cb_state(XBPS_STATE_REPOSYNC, 0, NULL, NULL,
"Synchronizing index for `%s'...", uri);
/*
* Download index.plist file from repository.
* Download plist index file from repository.
*/
if (xbps_fetch_file(rpidx, fetch_outputdir, true, NULL) == -1) {
/* reposync error cb */
@@ -206,7 +207,7 @@ xbps_repository_sync_pkg_index(const char *uri, const char *plistf)
goto out;
}
/*
* Create local repodir to store index.plist file.
* Create local repodir to store plist index file.
*/
if ((rv = xbps_mkpath(lrepodir, 0755)) == -1) {
xbps_set_cb_state(XBPS_STATE_REPOSYNC_FAIL, errno, NULL, NULL,