Fix binpkg installation with multiple repositories.

New changes include a modified algorithm of the previous one, which
finally does not fail even with multiple repos, YAY!

Fixed some leaks as well, thanks to valgrind.

--HG--
extra : convert_revision : 3cffe1e9e9e9f7abf225ca3c6643377fc12a94bd
This commit is contained in:
Juan RP
2009-02-14 01:37:12 +01:00
parent 6afd85a491
commit 3c7b8186e6
9 changed files with 527 additions and 328 deletions

View File

@@ -170,7 +170,7 @@ main(int argc, char **argv)
prop_dictionary_t dict;
repo_info_t *rinfo = NULL;
char dpkgidx[PATH_MAX], *root = NULL;
int c;
int c, rv = 0;
while ((c = getopt(argc, argv, "r:")) != -1) {
switch (c) {
@@ -291,17 +291,17 @@ main(int argc, char **argv)
usage();
dict = getrepolist_dict(root);
if (xbps_callback_array_iter_in_dict(dict, "repository-list",
show_pkg_info_from_repolist, argv[1]) != 0) {
prop_object_release(dict);
free(plist);
printf("ERROR: unable to locate package '%s'.\n",
argv[1]);
exit(EXIT_FAILURE);
}
rv = xbps_callback_array_iter_in_dict(dict, "repository-list",
show_pkg_info_from_repolist, argv[1]);
prop_object_release(dict);
free(plist);
if (rv == 0 && errno == ENOENT) {
printf("Unable to locate package '%s' from "
"repository pool.\n", argv[1]);
exit(EXIT_FAILURE);
}
} else {
usage();
}

View File

@@ -180,7 +180,8 @@ show_pkg_info_from_repolist(prop_object_t obj, void *arg, bool *loop_done)
if (pkgdict == NULL) {
prop_object_release(dict);
free(plist);
return XBPS_PKG_ENOTINREPO;
errno = ENOENT;
return 0;
}
oloc = prop_dictionary_get(dict, "location-remote");