xbps_init() now sets rootdir, cachedir and flags.

That means that the following functions were removed:
	- xbps_set_{cachedir,flags,rootdir}.
	- xbps_get_{cachedir,flags,rootdir}.

With this change fixed an obvious typo that made -c argument to not work,
and now the cache directory is an absolute path not relative to rootdir.
This commit is contained in:
Juan RP
2011-02-21 17:42:47 +01:00
parent 8d5a1ad0a3
commit 870ad18d58
30 changed files with 195 additions and 227 deletions

View File

@ -43,9 +43,9 @@
* ran successful.
*
* @note
* If the \a XBPS_FLAG_FORCE is set through xbps_set_flags(), the package
* (or packages) will be reconfigured even if its state is
* XBPS_PKG_STATE_INSTALLED.
* If the \a XBPS_FLAG_FORCE is set through xbps_init() in the flags
* member, the package (or packages) will be reconfigured even if its
* state is XBPS_PKG_STATE_INSTALLED.
*/
int
@ -86,14 +86,16 @@ xbps_configure_pkg(const char *pkgname,
bool check_state,
bool update)
{
const struct xbps_handle *xhp;
prop_dictionary_t pkgd;
const char *lver, *rootdir = xbps_get_rootdir();
const char *lver;
char *buf;
int rv = 0, flags = xbps_get_flags();
int rv = 0;
pkg_state_t state = 0;
bool reconfigure = false;
assert(pkgname != NULL);
xhp = xbps_handle_get();
if (check_state) {
rv = xbps_get_pkg_state_installed(pkgname, &state);
@ -101,7 +103,7 @@ xbps_configure_pkg(const char *pkgname,
return EINVAL;
if (state == XBPS_PKG_STATE_INSTALLED) {
if ((flags & XBPS_FLAG_FORCE) == 0)
if ((xhp->flags & XBPS_FLAG_FORCE) == 0)
return 0;
reconfigure = true;
@ -123,9 +125,9 @@ xbps_configure_pkg(const char *pkgname,
if (buf == NULL)
return ENOMEM;
if (chdir(rootdir) == -1) {
if (chdir(xhp->rootdir) == -1) {
xbps_dbg_printf("%s: [configure] chdir to '%s' returned %s\n",
pkgname, rootdir, strerror(errno));
pkgname, xhp->rootdir, strerror(errno));
free(buf);
return EINVAL;
}