New function: xbps_get_pkg_dict_from_metadata_plist.

This function returns and internalized dictionary from a package's metadata
plist file as specified by its arguments.

Update all code to use it where appropiate.
This commit is contained in:
Juan RP
2010-11-08 03:14:41 +01:00
parent 25ebcd53f8
commit c3afb4f4fb
9 changed files with 56 additions and 96 deletions

View File

@@ -192,7 +192,7 @@ int
xbps_remove_pkg(const char *pkgname, const char *version, bool update)
{
prop_dictionary_t dict;
char *path, *buf;
char *buf;
int rv = 0;
assert(pkgname != NULL);
@@ -240,19 +240,11 @@ xbps_remove_pkg(const char *pkgname, const char *version, bool update)
/*
* Remove links, files and dirs.
*/
path = xbps_xasprintf(".%s/metadata/%s/%s",
XBPS_META_PATH, pkgname, XBPS_PKGFILES);
if (path == NULL) {
free(buf);
return errno;
}
dict = prop_dictionary_internalize_from_zfile(path);
dict = xbps_get_pkg_dict_from_metadata_plist(pkgname, XBPS_PKGFILES);
if (dict == NULL) {
free(path);
free(buf);
return errno;
}
free(path);
/* Remove links */
if ((rv = xbps_remove_pkg_files(dict, "links")) != 0) {