New configuration scheme changes, round 1.
- Configuration file 'xbps-conf.plist' has been splitted off into
two files: conf.plist and repositories.plist. By default they
are stored in etc/xbps.
- Changed some members in xbps_handle struct, mostly to make it easy
to change its value in {cache,root}dir and conffile.
- Made xbps_init() release proplib objects as soon as we don't need
them, that way it uses 35% less of memory or in some cases even more.
There will be another commit that will implement to read new virtualpkg
settings by the user, as specified in:
http://code.google.com/p/xbps/issues/detail?id=12
This commit is contained in:
@@ -155,7 +155,8 @@ check_pkg_integrity(const char *pkgname)
|
||||
"empty target object!\n", pkgname, file);
|
||||
continue;
|
||||
}
|
||||
path = xbps_xasprintf("%s/%s", xhp->rootdir, file);
|
||||
path = xbps_xasprintf("%s/%s",
|
||||
prop_string_cstring_nocopy(xhp->rootdir), file);
|
||||
if (path == NULL)
|
||||
abort();
|
||||
|
||||
@@ -168,8 +169,9 @@ check_pkg_integrity(const char *pkgname)
|
||||
}
|
||||
|
||||
free(path);
|
||||
if (strcmp(xhp->rootdir, "/") && strstr(buf, xhp->rootdir))
|
||||
path = buf + strlen(xhp->rootdir);
|
||||
if (!prop_string_equals_cstring(xhp->rootdir, "/") &&
|
||||
strstr(buf, prop_string_cstring_nocopy(xhp->rootdir)))
|
||||
path = buf + prop_string_size(xhp->rootdir);
|
||||
else
|
||||
path = buf;
|
||||
|
||||
@@ -201,7 +203,8 @@ 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", xhp->rootdir, file);
|
||||
path = xbps_xasprintf("%s/%s",
|
||||
prop_string_cstring_nocopy(xhp->rootdir), file);
|
||||
if (path == NULL) {
|
||||
prop_object_iterator_release(iter);
|
||||
abort();
|
||||
@@ -250,7 +253,8 @@ 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", xhp->rootdir, file);
|
||||
path = xbps_xasprintf("%s/%s",
|
||||
prop_string_cstring_nocopy(xhp->rootdir), file);
|
||||
if (path == NULL) {
|
||||
prop_object_iterator_release(iter);
|
||||
abort();
|
||||
|
||||
@@ -81,8 +81,8 @@ find_files_in_packages(const char *pattern)
|
||||
unsigned int i, count;
|
||||
|
||||
xhp = xbps_handle_get();
|
||||
path = xbps_xasprintf("%s/%s/metadata", xhp->rootdir,
|
||||
XBPS_META_PATH);
|
||||
path = xbps_xasprintf("%s/%s/metadata",
|
||||
prop_string_cstring_nocopy(xhp->rootdir), XBPS_META_PATH);
|
||||
if (path == NULL)
|
||||
return -1;
|
||||
|
||||
|
||||
@@ -285,10 +285,15 @@ main(int argc, char **argv)
|
||||
xhp->xbps_unpack_cb = unpack_progress_cb_verbose;
|
||||
else
|
||||
xhp->xbps_unpack_cb = unpack_progress_cb;
|
||||
xhp->rootdir = rootdir;
|
||||
xhp->cachedir = cachedir;
|
||||
|
||||
if (rootdir)
|
||||
xhp->rootdir = prop_string_create_cstring(rootdir);
|
||||
if (cachedir)
|
||||
xhp->cachedir = prop_string_create_cstring(cachedir);
|
||||
if (conffile)
|
||||
xhp->conffile = prop_string_create_cstring(conffile);
|
||||
|
||||
xhp->flags = flags;
|
||||
xhp->conffile = conffile;
|
||||
xhp->install_reason_manual = install_manual;
|
||||
xhp->install_reason_auto = install_auto;
|
||||
|
||||
|
||||
@@ -442,7 +442,7 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
prop_dictionary_t plistd, confd = NULL;
|
||||
struct xbps_handle xh;
|
||||
struct xbps_handle *xhp;
|
||||
FILE *f = NULL;
|
||||
char *outfile = NULL;
|
||||
const char *conf_file = NULL, *rootdir = NULL;
|
||||
@@ -484,9 +484,13 @@ main(int argc, char **argv)
|
||||
usage();
|
||||
|
||||
/* Initialize libxbps */
|
||||
memset(&xh, 0, sizeof(xh));
|
||||
xh.rootdir = rootdir;
|
||||
xbps_init(&xh);
|
||||
xhp = xbps_handle_alloc();
|
||||
if (xhp == NULL)
|
||||
die("failed to allocate resources");
|
||||
if (rootdir)
|
||||
xhp->rootdir = prop_string_create_cstring(rootdir);
|
||||
if (xbps_init(xhp))
|
||||
die("failed to initialize libxbps");
|
||||
|
||||
/*
|
||||
* Output file will be <pkgname>.dot if not specified.
|
||||
|
||||
@@ -139,9 +139,12 @@ main(int argc, char **argv)
|
||||
xhp->xbps_transaction_err_cb = transaction_err_cb;
|
||||
xhp->xbps_fetch_cb = fetch_file_progress_cb;
|
||||
xhp->xfcd->cookie = &xfer;
|
||||
xhp->rootdir = rootdir;
|
||||
xhp->cachedir = cachedir;
|
||||
xhp->conffile = conffile;
|
||||
if (rootdir)
|
||||
xhp->rootdir = prop_string_create_cstring(rootdir);
|
||||
if (cachedir)
|
||||
xhp->cachedir = prop_string_create_cstring(cachedir);
|
||||
if (conffile)
|
||||
xhp->conffile = prop_string_create_cstring(conffile);
|
||||
|
||||
if ((rv = xbps_init(xhp)) != 0) {
|
||||
xbps_error_printf("xbps-repo: couldn't initialize library: %s\n",
|
||||
|
||||
@@ -156,8 +156,10 @@ main(int argc, char **argv)
|
||||
xhp->debug = debug;
|
||||
xhp->xbps_fetch_cb = fetch_file_progress_cb;
|
||||
xhp->xfcd->cookie = &xfer;
|
||||
xhp->rootdir = rootdir;
|
||||
xhp->conffile = conffile;
|
||||
if (rootdir)
|
||||
xhp->rootdir = prop_string_create_cstring(rootdir);
|
||||
if (conffile)
|
||||
xhp->conffile = prop_string_create_cstring(conffile);
|
||||
|
||||
if ((rv = xbps_init(xhp)) != 0) {
|
||||
xbps_error_printf("xbps-uhelper: failed to "
|
||||
|
||||
Reference in New Issue
Block a user