Use xbps_get_root() directly where appropiate.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091027111547-tb38qz51ejakn3jc
This commit is contained in:
Juan RP
2009-10-27 12:15:47 +01:00
parent ac897c8383
commit dc258f4e20
11 changed files with 31 additions and 61 deletions

View File

@@ -84,14 +84,13 @@ xbps_check_pkg_integrity(const char *pkgname)
prop_array_t array;
prop_object_t obj;
prop_object_iterator_t iter;
const char *rootdir, *file, *sha256, *reqpkg;
const char *file, *sha256, *reqpkg;
char *path;
int rv = 0;
bool broken = false, files_broken = false;
assert(pkgname != NULL);
rootdir = xbps_get_rootdir();
pkgd = xbps_find_pkg_installed_from_plist(pkgname);
if (pkgd == NULL) {
printf("Package %s is not installed.\n", pkgname);
@@ -101,7 +100,7 @@ xbps_check_pkg_integrity(const char *pkgname)
/*
* Check for props.plist metadata file.
*/
path = xbps_xasprintf("%s/%s/metadata/%s/%s", rootdir,
path = xbps_xasprintf("%s/%s/metadata/%s/%s", xbps_get_rootdir(),
XBPS_META_PATH, pkgname, XBPS_PKGPROPS);
if (path == NULL) {
rv = errno;
@@ -130,7 +129,7 @@ xbps_check_pkg_integrity(const char *pkgname)
/*
* Check for files.plist metadata file.
*/
path = xbps_xasprintf("%s/%s/metadata/%s/%s", rootdir,
path = xbps_xasprintf("%s/%s/metadata/%s/%s", xbps_get_rootdir(),
XBPS_META_PATH, pkgname, XBPS_PKGFILES);
if (path == NULL) {
rv = errno;
@@ -176,7 +175,8 @@ xbps_check_pkg_integrity(const char *pkgname)
}
while ((obj = prop_object_iterator_next(iter))) {
prop_dictionary_get_cstring_nocopy(obj, "file", &file);
path = xbps_xasprintf("%s/%s", rootdir, file);
path = xbps_xasprintf("%s/%s",
xbps_get_rootdir(), file);
if (path == NULL) {
prop_object_iterator_release(iter);
rv = errno;
@@ -225,7 +225,8 @@ xbps_check_pkg_integrity(const char *pkgname)
}
while ((obj = prop_object_iterator_next(iter))) {
prop_dictionary_get_cstring_nocopy(obj, "file", &file);
path = xbps_xasprintf("%s/%s", rootdir, file);
path = xbps_xasprintf("%s/%s",
xbps_get_rootdir(), file);
if (path == NULL) {
prop_object_iterator_release(iter);
rv = ENOMEM;

View File

@@ -60,13 +60,11 @@ int
xbps_show_pkg_deps(const char *pkgname)
{
prop_dictionary_t pkgd, propsd;
const char *rootdir;
char *path;
int rv = 0;
assert(pkgname != NULL);
rootdir = xbps_get_rootdir();
pkgd = xbps_find_pkg_installed_from_plist(pkgname);
if (pkgd == NULL) {
printf("Package %s is not installed.\n", pkgname);
@@ -76,7 +74,7 @@ xbps_show_pkg_deps(const char *pkgname)
/*
* Check for props.plist metadata file.
*/
path = xbps_xasprintf("%s/%s/metadata/%s/%s", rootdir,
path = xbps_xasprintf("%s/%s/metadata/%s/%s", xbps_get_rootdir(),
XBPS_META_PATH, pkgname, XBPS_PKGPROPS);
if (path == NULL)
return errno;

View File

@@ -155,11 +155,9 @@ int
show_pkg_info_from_metadir(const char *pkgname)
{
prop_dictionary_t pkgd;
const char *rootdir;
char *plist;
rootdir = xbps_get_rootdir();
plist = xbps_xasprintf("%s/%s/metadata/%s/%s", rootdir,
plist = xbps_xasprintf("%s/%s/metadata/%s/%s", xbps_get_rootdir(),
XBPS_META_PATH, pkgname, XBPS_PKGPROPS);
if (plist == NULL)
return EINVAL;
@@ -184,12 +182,11 @@ show_pkg_files_from_metadir(const char *pkgname)
prop_array_t array;
prop_object_iterator_t iter = NULL;
prop_object_t obj;
const char *destdir, *file;
const char *file;
char *plist, *array_str = "files";
int i, rv = 0;
destdir = xbps_get_rootdir();
plist = xbps_xasprintf("%s/%s/metadata/%s/%s", destdir,
plist = xbps_xasprintf("%s/%s/metadata/%s/%s", xbps_get_rootdir(),
XBPS_META_PATH, pkgname, XBPS_PKGFILES);
if (plist == NULL)
return EINVAL;