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:
		@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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",
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user