Rename struct repository_data to repository_pool.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091130112404-mlrt6x08thdvmrsn
This commit is contained in:
Juan RP
2009-11-30 12:24:04 +01:00
parent 91aeac4dad
commit d90a248244
7 changed files with 66 additions and 66 deletions

View File

@@ -240,7 +240,7 @@ int SYMEXPORT
xbps_repository_find_pkg_deps(prop_dictionary_t master, prop_dictionary_t pkg)
{
prop_array_t pkg_rdeps, missing_rdeps;
struct repository_data *rdata;
struct repository_pool *rpool;
const char *pkgname;
int rv = 0;
@@ -262,14 +262,14 @@ xbps_repository_find_pkg_deps(prop_dictionary_t master, prop_dictionary_t pkg)
* Iterate over the repository pool and find out if we have
* all available binary packages.
*/
SIMPLEQ_FOREACH(rdata, &repodata_queue, chain) {
SIMPLEQ_FOREACH(rpool, &repopool_queue, chain) {
/*
* This will find direct and indirect deps,
* if any of them is not there it will be added
* into the missing_deps array.
*/
if ((rv = find_repo_deps(master, rdata->rd_repod,
rdata->rd_uri, pkg_rdeps)) != 0) {
if ((rv = find_repo_deps(master, rpool->rp_repod,
rpool->rp_uri, pkg_rdeps)) != 0) {
DPRINTF(("Error '%s' while checking rundeps!\n",
strerror(rv)));
goto out;
@@ -288,9 +288,9 @@ xbps_repository_find_pkg_deps(prop_dictionary_t master, prop_dictionary_t pkg)
* that were found in previous pass.
*/
DPRINTF(("Checking for missing deps in %s.\n", pkgname));
SIMPLEQ_FOREACH(rdata, &repodata_queue, chain) {
if ((rv = find_repo_deps(master, rdata->rd_repod,
rdata->rd_uri, missing_rdeps)) != 0) {
SIMPLEQ_FOREACH(rpool, &repopool_queue, chain) {
if ((rv = find_repo_deps(master, rpool->rp_repod,
rpool->rp_uri, missing_rdeps)) != 0) {
DPRINTF(("Error '%s' while checking for "
"missing rundeps!\n", strerror(rv)));
goto out;

View File

@@ -159,7 +159,7 @@ xbps_repository_update_pkg(const char *pkgname, prop_dictionary_t instpkg)
{
prop_dictionary_t pkgrd = NULL;
prop_array_t unsorted;
struct repository_data *rdata;
struct repository_pool *rpool;
const char *repover, *instver;
int rv = 0;
bool newpkg_found = false;
@@ -173,12 +173,12 @@ xbps_repository_update_pkg(const char *pkgname, prop_dictionary_t instpkg)
if ((rv = xbps_repository_pool_init()) != 0)
return rv;
SIMPLEQ_FOREACH(rdata, &repodata_queue, chain) {
SIMPLEQ_FOREACH(rpool, &repopool_queue, chain) {
/*
* Get the package dictionary from current repository.
* If it's not there, pass to the next repository.
*/
pkgrd = xbps_find_pkg_in_dict(rdata->rd_repod,
pkgrd = xbps_find_pkg_in_dict(rpool->rp_repod,
"packages", pkgname);
if (pkgrd == NULL) {
if (errno && errno != ENOENT) {
@@ -186,7 +186,7 @@ xbps_repository_update_pkg(const char *pkgname, prop_dictionary_t instpkg)
break;
}
DPRINTF(("Package %s not found in repo %s.\n",
pkgname, rdata->rd_uri));
pkgname, rpool->rp_uri));
} else if (pkgrd != NULL) {
/*
* Check if version in repository is greater than
@@ -204,12 +204,12 @@ xbps_repository_update_pkg(const char *pkgname, prop_dictionary_t instpkg)
}
if (xbps_cmpver(repover, instver) > 0) {
DPRINTF(("Found %s-%s in repo %s.\n",
pkgname, repover, rdata->rd_uri));
pkgname, repover, rpool->rp_uri));
newpkg_found = true;
break;
}
DPRINTF(("Skipping %s-%s in repo %s.\n",
pkgname, repover, rdata->rd_uri));
pkgname, repover, rpool->rp_uri));
continue;
}
}
@@ -231,7 +231,7 @@ xbps_repository_update_pkg(const char *pkgname, prop_dictionary_t instpkg)
/*
* Set repository in pkg dictionary.
*/
if (!prop_dictionary_set_cstring(pkgrd, "repository", rdata->rd_uri)) {
if (!prop_dictionary_set_cstring(pkgrd, "repository", rpool->rp_uri)) {
rv = errno;
goto out;
}
@@ -302,7 +302,7 @@ xbps_repository_install_pkg(const char *pkgname)
{
prop_dictionary_t origin_pkgrd = NULL, pkgrd = NULL;
prop_array_t pkgs_array;
struct repository_data *rdata;
struct repository_pool *rpool;
int rv = 0;
assert(pkgname != NULL);
@@ -310,12 +310,12 @@ xbps_repository_install_pkg(const char *pkgname)
if ((rv = xbps_repository_pool_init()) != 0)
return rv;
SIMPLEQ_FOREACH(rdata, &repodata_queue, chain) {
SIMPLEQ_FOREACH(rpool, &repopool_queue, chain) {
/*
* Get the package dictionary from current repository.
* If it's not there, pass to the next repository.
*/
pkgrd = xbps_find_pkg_in_dict(rdata->rd_repod,
pkgrd = xbps_find_pkg_in_dict(rpool->rp_repod,
"packages", pkgname);
if (pkgrd == NULL) {
if (errno && errno != ENOENT) {
@@ -339,7 +339,7 @@ xbps_repository_install_pkg(const char *pkgname)
/*
* Set repository in pkg dictionary.
*/
if (!prop_dictionary_set_cstring(pkgrd, "repository", rdata->rd_uri)) {
if (!prop_dictionary_set_cstring(pkgrd, "repository", rpool->rp_uri)) {
rv = errno;
goto out;
}

View File

@@ -220,7 +220,7 @@ prop_dictionary_t SYMEXPORT
xbps_get_pkg_plist_dict_from_repo(const char *pkgname, const char *plistf)
{
prop_dictionary_t plistd = NULL, pkgd;
struct repository_data *rdata;
struct repository_pool *rpool;
char *url = NULL;
int rv = 0;
@@ -238,15 +238,15 @@ xbps_get_pkg_plist_dict_from_repo(const char *pkgname, const char *plistf)
* This will work locally and remotely, thanks to libarchive and
* libfetch!
*/
SIMPLEQ_FOREACH(rdata, &repodata_queue, chain) {
pkgd = xbps_find_pkg_in_dict(rdata->rd_repod,
SIMPLEQ_FOREACH(rpool, &repopool_queue, chain) {
pkgd = xbps_find_pkg_in_dict(rpool->rp_repod,
"packages", pkgname);
if (pkgd == NULL) {
if (errno != ENOENT)
break;
continue;
}
url = xbps_get_path_from_pkg_dict_repo(pkgd, rdata->rd_uri);
url = xbps_get_path_from_pkg_dict_repo(pkgd, rpool->rp_uri);
if (url == NULL)
break;
plistd = xbps_get_pkg_plist_dict_from_url(url, plistf);

View File

@@ -41,7 +41,7 @@ xbps_repository_pool_init(void)
prop_array_t array;
prop_object_t obj;
prop_object_iterator_t iter = NULL;
struct repository_data *rdata;
struct repository_pool *rpool;
size_t ntotal = 0, nmissing = 0;
char *plist;
int rv = 0;
@@ -51,7 +51,7 @@ xbps_repository_pool_init(void)
return 0;
}
SIMPLEQ_INIT(&repodata_queue);
SIMPLEQ_INIT(&repopool_queue);
plist = xbps_xasprintf("%s/%s/%s", xbps_get_rootdir(),
XBPS_META_PATH, XBPS_REPOLIST);
@@ -93,24 +93,24 @@ xbps_repository_pool_init(void)
goto out;
}
rdata = malloc(sizeof(struct repository_data));
if (rdata == NULL) {
rpool = malloc(sizeof(struct repository_pool));
if (rpool == NULL) {
rv = errno;
goto out;
}
rdata->rd_uri = prop_string_cstring(obj);
if (rdata->rd_uri == NULL) {
rpool->rp_uri = prop_string_cstring(obj);
if (rpool->rp_uri == NULL) {
free(plist);
rv = errno;
goto out;
}
rdata->rd_repod = prop_dictionary_internalize_from_file(plist);
if (rdata->rd_repod == NULL) {
rpool->rp_repod = prop_dictionary_internalize_from_file(plist);
if (rpool->rp_repod == NULL) {
free(plist);
if (errno == ENOENT) {
free(rdata->rd_uri);
free(rdata);
free(rpool->rp_uri);
free(rpool);
errno = 0;
nmissing++;
continue;
@@ -119,7 +119,7 @@ xbps_repository_pool_init(void)
goto out;
}
free(plist);
SIMPLEQ_INSERT_TAIL(&repodata_queue, rdata, chain);
SIMPLEQ_INSERT_TAIL(&repopool_queue, rpool, chain);
}
if (ntotal - nmissing == 0)
@@ -143,16 +143,16 @@ out:
void SYMEXPORT
xbps_repository_pool_release(void)
{
struct repository_data *rdata;
struct repository_pool *rpool;
if (--repolist_refcnt > 0)
return;
while ((rdata = SIMPLEQ_FIRST(&repodata_queue)) != NULL) {
SIMPLEQ_REMOVE(&repodata_queue, rdata, repository_data, chain);
prop_object_release(rdata->rd_repod);
free(rdata->rd_uri);
free(rdata);
while ((rpool = SIMPLEQ_FIRST(&repopool_queue)) != NULL) {
SIMPLEQ_REMOVE(&repopool_queue, rpool, repository_pool, chain);
prop_object_release(rpool->rp_repod);
free(rpool->rp_uri);
free(rpool);
}
repolist_refcnt = 0;
repolist_initialized = false;