API/ABI break for June 2011.

Rename some functions to reflect its description a bit better.

--HG--
rename : lib/repository_plist.c => lib/plist_fetch.c
This commit is contained in:
Juan RP
2011-06-01 09:37:32 +02:00
parent c9a673cc11
commit 841c9e2d51
34 changed files with 219 additions and 217 deletions

View File

@@ -64,7 +64,7 @@ xbps_check_pkg_integrity_all(void)
if (d == NULL)
return ENODEV;
iter = xbps_get_array_iter_from_dict(d, "packages");
iter = xbps_array_iter_from_dict(d, "packages");
if (iter == NULL) {
rv = ENOENT;
goto out;
@@ -117,7 +117,7 @@ xbps_check_pkg_integrity(const char *pkgname)
/*
* Check for props.plist metadata file.
*/
propsd = xbps_get_pkg_dict_from_metadata_plist(pkgname, XBPS_PKGPROPS);
propsd = xbps_dictionary_from_metadata_plist(pkgname, XBPS_PKGPROPS);
if (prop_object_type(propsd) != PROP_TYPE_DICTIONARY) {
fprintf(stderr,
"E: %s: unexistent %s or invalid metadata file.\n", pkgname,
@@ -135,7 +135,7 @@ xbps_check_pkg_integrity(const char *pkgname)
/*
* Check for files.plist metadata file.
*/
filesd = xbps_get_pkg_dict_from_metadata_plist(pkgname, XBPS_PKGFILES);
filesd = xbps_dictionary_from_metadata_plist(pkgname, XBPS_PKGFILES);
if (prop_object_type(filesd) != PROP_TYPE_DICTIONARY) {
fprintf(stderr,
"E: %s: unexistent %s or invalid metadata file.\n", pkgname,
@@ -156,7 +156,7 @@ xbps_check_pkg_integrity(const char *pkgname)
array = prop_dictionary_get(filesd, "links");
if ((prop_object_type(array) == PROP_TYPE_ARRAY) &&
prop_array_count(array) > 0) {
iter = xbps_get_array_iter_from_dict(filesd, "links");
iter = xbps_array_iter_from_dict(filesd, "links");
if (iter == NULL) {
rv = ENOMEM;
goto out;
@@ -186,7 +186,7 @@ xbps_check_pkg_integrity(const char *pkgname)
array = prop_dictionary_get(filesd, "files");
if ((prop_object_type(array) == PROP_TYPE_ARRAY) &&
prop_array_count(array) > 0) {
iter = xbps_get_array_iter_from_dict(filesd, "files");
iter = xbps_array_iter_from_dict(filesd, "files");
if (iter == NULL) {
rv = ENOMEM;
goto out;
@@ -201,7 +201,7 @@ xbps_check_pkg_integrity(const char *pkgname)
}
prop_dictionary_get_cstring_nocopy(obj,
"sha256", &sha256);
rv = xbps_check_file_hash(path, sha256);
rv = xbps_file_hash_check(path, sha256);
switch (rv) {
case 0:
break;
@@ -236,7 +236,7 @@ xbps_check_pkg_integrity(const char *pkgname)
array = prop_dictionary_get(filesd, "conf_files");
if (array && prop_object_type(array) == PROP_TYPE_ARRAY &&
prop_array_count(array) > 0) {
iter = xbps_get_array_iter_from_dict(filesd, "conf_files");
iter = xbps_array_iter_from_dict(filesd, "conf_files");
if (iter == NULL) {
rv = ENOMEM;
goto out;
@@ -273,7 +273,7 @@ xbps_check_pkg_integrity(const char *pkgname)
* Check for missing run time dependencies.
*/
if (xbps_pkg_has_rundeps(propsd)) {
iter = xbps_get_array_iter_from_dict(propsd, "run_depends");
iter = xbps_array_iter_from_dict(propsd, "run_depends");
if (iter == NULL) {
rv = ENOMEM;
goto out;

View File

@@ -96,7 +96,7 @@ find_files_in_packages(const char *pattern)
(strcmp(dp->d_name, "..") == 0))
continue;
pkg_filesd = xbps_get_pkg_dict_from_metadata_plist(dp->d_name,
pkg_filesd = xbps_dictionary_from_metadata_plist(dp->d_name,
XBPS_PKGFILES);
if (pkg_filesd == NULL) {
if (errno == ENOENT)

View File

@@ -73,7 +73,7 @@ check_binpkg_hash(const char *path,
int rv;
printf("Checking %s integrity... ", filename);
rv = xbps_check_file_hash(path, sha256);
rv = xbps_file_hash_check(path, sha256);
if (rv != 0 && rv != ERANGE) {
xbps_error_printf("\nxbps-bin: unexpected error: %s\n",
strerror(rv));
@@ -121,7 +121,7 @@ again:
prop_dictionary_get_cstring_nocopy(obj,
"filename-sha256", &sha256);
binfile = xbps_get_binpkg_repo_uri(obj, repoloc);
binfile = xbps_path_from_repository_uri(obj, repoloc);
if (binfile == NULL)
return errno;
/*
@@ -159,7 +159,7 @@ again:
return -1;
}
free(binfile);
binfile = xbps_get_binpkg_repo_uri(obj, repoloc);
binfile = xbps_path_from_repository_uri(obj, repoloc);
if (binfile == NULL)
return errno;
@@ -285,7 +285,7 @@ xbps_autoupdate_pkgs(bool yes, bool show_download_pkglist_url)
* "xbps-bin autoupdate".
*/
printf("Finding new packages...\n");
if ((rv = xbps_repository_update_allpkgs()) != 0) {
if ((rv = xbps_repository_update_packages()) != 0) {
if (rv == ENOENT) {
printf("No packages currently registered.\n");
return 0;
@@ -311,7 +311,7 @@ xbps_install_new_pkg(const char *pkg)
bool pkgmatch = false;
pkg_state_t state;
if (xbps_get_pkgpattern_version(pkg)) {
if (xbps_pkgpattern_version(pkg)) {
pkgpatt = __UNCONST(pkg);
} else {
/*
@@ -323,14 +323,14 @@ xbps_install_new_pkg(const char *pkg)
if (pkgpatt == NULL)
return -1;
}
pkgname = xbps_get_pkgpattern_name(pkgpatt);
pkgname = xbps_pkgpattern_name(pkgpatt);
if (pkgname == NULL)
return -1;
/*
* Find a package in a repository and prepare for installation.
*/
if ((pkgd = xbps_find_pkg_dict_installed(pkgname, false))) {
if ((rv = xbps_get_pkg_state_dictionary(pkgd, &state)) != 0) {
if ((rv = xbps_pkg_state_dictionary(pkgd, &state)) != 0) {
prop_object_release(pkgd);
goto out;
}
@@ -494,7 +494,7 @@ exec_transaction(struct transaction *trans)
* If dependency is already unpacked skip this phase.
*/
state = 0;
if (xbps_get_pkg_state_dictionary(obj, &state) != 0)
if (xbps_pkg_state_dictionary(obj, &state) != 0)
return EINVAL;
if (state == XBPS_PKG_STATE_UNPACKED)
continue;
@@ -603,7 +603,7 @@ xbps_exec_transaction(bool yes, bool show_download_pkglist_url)
/*
* It's time to run the transaction!
*/
trans->iter = xbps_get_array_iter_from_dict(trans->dict, "packages");
trans->iter = xbps_array_iter_from_dict(trans->dict, "packages");
if (trans->iter == NULL) {
rv = errno;
xbps_error_printf("xbps-bin: error allocating array mem! (%s)\n",

View File

@@ -64,7 +64,7 @@ list_pkgs_in_dict(prop_object_t obj, void *arg, bool *loop_done)
(void)loop_done;
if (xbps_get_pkg_state_dictionary(obj, &curstate))
if (xbps_pkg_state_dictionary(obj, &curstate))
return EINVAL;
if (lpc->state == 0) {
@@ -439,7 +439,7 @@ main(int argc, char **argv)
usage();
if (strcasecmp(argv[1], "all") == 0)
rv = xbps_purge_all_pkgs();
rv = xbps_purge_packages();
else
rv = xbps_purge_pkg(argv[1], true);
@@ -451,7 +451,7 @@ main(int argc, char **argv)
usage();
if (strcasecmp(argv[1], "all") == 0)
rv = xbps_configure_all_pkgs();
rv = xbps_configure_packages();
else
rv = xbps_configure_pkg(argv[1], NULL, true, false);

View File

@@ -52,7 +52,7 @@ xbps_show_pkg_deps(const char *pkgname)
/*
* Check for props.plist metadata file.
*/
propsd = xbps_get_pkg_dict_from_metadata_plist(pkgname, XBPS_PKGPROPS);
propsd = xbps_dictionary_from_metadata_plist(pkgname, XBPS_PKGPROPS);
if (propsd == NULL) {
fprintf(stderr,
"%s: unexistent %s metadata file.\n", pkgname,

View File

@@ -39,7 +39,7 @@ show_pkg_info_from_metadir(const char *pkgname)
{
prop_dictionary_t d, regpkgd, pkgpropsd;
d = xbps_get_pkg_dict_from_metadata_plist(pkgname, XBPS_PKGPROPS);
d = xbps_dictionary_from_metadata_plist(pkgname, XBPS_PKGPROPS);
if (d == NULL)
return EINVAL;
@@ -71,7 +71,7 @@ show_pkg_files_from_metadir(const char *pkgname)
prop_dictionary_t d;
int rv = 0;
d = xbps_get_pkg_dict_from_metadata_plist(pkgname, XBPS_PKGFILES);
d = xbps_dictionary_from_metadata_plist(pkgname, XBPS_PKGFILES);
if (d == NULL)
return EINVAL;

View File

@@ -203,7 +203,7 @@ show_pkg_files(prop_dictionary_t filesd)
if (array == NULL || prop_array_count(array) == 0)
continue;
iter = xbps_get_array_iter_from_dict(filesd, array_str);
iter = xbps_array_iter_from_dict(filesd, array_str);
if (iter == NULL)
return EINVAL;

View File

@@ -513,7 +513,7 @@ main(int argc, char **argv)
/*
* Internalize the plist file of the target installed package.
*/
plistd = xbps_get_pkg_dict_from_metadata_plist(argv[0], XBPS_PKGPROPS);
plistd = xbps_dictionary_from_metadata_plist(argv[0], XBPS_PKGPROPS);
if (plistd == NULL)
die("cannot internalize %s from %s", XBPS_PKGPROPS, argv[0]);

View File

@@ -81,20 +81,20 @@ find_files_in_package(struct repository_pool_index *rpi, void *arg, bool *done)
(void)done;
iter = xbps_get_array_iter_from_dict(rpi->rpi_repod, "packages");
iter = xbps_array_iter_from_dict(rpi->rpi_repod, "packages");
if (iter == NULL)
return -1;
printf("Looking in repository '%s', please wait...\n", rpi->rpi_uri);
while ((obj = prop_object_iterator_next(iter))) {
url = xbps_get_binpkg_repo_uri(obj, rpi->rpi_uri);
url = xbps_path_from_repository_uri(obj, rpi->rpi_uri);
if (url == NULL) {
rv = -1;
break;
}
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname);
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
pkg_filesd = xbps_repository_plist_find_pkg_dict_from_url(url,
pkg_filesd = xbps_dictionary_metadata_plist_by_url(url,
XBPS_PKGFILES);
free(url);
if (pkg_filesd == NULL) {

View File

@@ -46,7 +46,7 @@ repoidx_getdict(const char *pkgdir)
prop_array_t array;
char *plist;
plist = xbps_get_pkg_index_plist(pkgdir);
plist = xbps_pkg_index_plist(pkgdir);
if (plist == NULL)
return NULL;
@@ -104,8 +104,7 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *filedir,
goto out;
}
newpkgd = xbps_repository_plist_find_pkg_dict_from_url(file,
XBPS_PKGPROPS);
newpkgd = xbps_dictionary_metadata_plist_by_url(file, XBPS_PKGPROPS);
if (newpkgd == NULL) {
xbps_error_printf("xbps-repo: can't read %s %s metadata "
"file, skipping!\n", file, XBPS_PKGPROPS);
@@ -186,7 +185,7 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *filedir,
rv = errno;
goto out;
}
sha256 = xbps_get_file_hash(file);
sha256 = xbps_file_hash(file);
if (sha256 == NULL) {
prop_object_release(newpkgd);
rv = errno;
@@ -262,7 +261,7 @@ xbps_repo_genindex(const char *pkgdir)
if (idxdict == NULL)
return errno;
plist = xbps_get_pkg_index_plist(pkgdir);
plist = xbps_pkg_index_plist(pkgdir);
if (plist == NULL) {
prop_object_release(idxdict);
return errno;

View File

@@ -201,7 +201,7 @@ main(int argc, char **argv)
if (argc != 2)
usage();
pkgd = xbps_repository_plist_find_pkg_dict(argv[1],
pkgd = xbps_repository_pool_dictionary_metadata_plist(argv[1],
XBPS_PKGFILES);
if (pkgd == NULL) {
if (errno != ENOENT) {

View File

@@ -186,7 +186,7 @@ register_repository(const char *uri)
return 0;
}
plist = xbps_get_pkg_index_plist(idxstr);
plist = xbps_pkg_index_plist(idxstr);
} else {
/*
* Create metadir if necessary.
@@ -203,7 +203,7 @@ register_repository(const char *uri)
return EXIT_FAILURE;
}
free(metadir);
plist = xbps_get_pkg_index_plist(idxstr);
plist = xbps_pkg_index_plist(idxstr);
}
if (plist == NULL)
@@ -296,7 +296,7 @@ repo_sync_pkg_index_cb(struct repository_pool_index *rpi, void *arg, bool *done)
printf("Package index file is already up to date.\n");
return 0;
}
if ((plist = xbps_get_pkg_index_plist(rpi->rpi_uri)) == NULL)
if ((plist = xbps_pkg_index_plist(rpi->rpi_uri)) == NULL)
return EINVAL;
if ((rp = pkgindex_verify(plist, rpi->rpi_uri)) == NULL)

View File

@@ -288,7 +288,7 @@ main(int argc, char **argv)
if (argc != 2)
usage();
version = xbps_get_pkg_version(argv[1]);
version = xbps_pkg_version(argv[1]);
if (version == NULL) {
fprintf(stderr,
"Invalid string, expected <string>-<version>\n");
@@ -301,7 +301,7 @@ main(int argc, char **argv)
if (argc != 2)
usage();
pkgname = xbps_get_pkg_name(argv[1]);
pkgname = xbps_pkg_name(argv[1]);
if (pkgname == NULL) {
fprintf(stderr,
"Invalid string, expected <string>-<version>\n");
@@ -315,7 +315,7 @@ main(int argc, char **argv)
if (argc != 2)
usage();
version = xbps_get_pkg_revision(argv[1]);
version = xbps_pkg_revision(argv[1]);
if (version == NULL)
exit(EXIT_SUCCESS);
@@ -326,7 +326,7 @@ main(int argc, char **argv)
if (argc != 2)
usage();
pkgname = xbps_get_pkgpattern_name(argv[1]);
pkgname = xbps_pkgpattern_name(argv[1]);
if (pkgname == NULL)
exit(EXIT_FAILURE);
@@ -337,7 +337,7 @@ main(int argc, char **argv)
if (argc != 2)
usage();
version = xbps_get_pkgpattern_version(argv[1]);
version = xbps_pkgpattern_version(argv[1]);
if (version == NULL)
exit(EXIT_FAILURE);
@@ -363,7 +363,7 @@ main(int argc, char **argv)
usage();
for (i = 1; i < argc; i++) {
hash = xbps_get_file_hash(argv[i]);
hash = xbps_file_hash(argv[i]);
if (hash == NULL) {
fprintf(stderr,
"E: couldn't get hash for %s (%s)\n",