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

@@ -80,22 +80,23 @@ main(int argc, char **argv)
struct xbps_handle xh;
struct xbps_fetch_progress_data xfpd;
prop_dictionary_t pkgd;
char *root;
const char *rootdir, *cachedir;
int c, rv = 0;
bool with_debug = false;
while ((c = getopt(argc, argv, "Vcdr:")) != -1) {
rootdir = cachedir = NULL;
while ((c = getopt(argc, argv, "Vc:dr:")) != -1) {
switch (c) {
case 'c':
xbps_set_cachedir(optarg);
cachedir = optarg;
break;
case 'd':
with_debug = true;
break;
case 'r':
/* To specify the root directory */
root = optarg;
xbps_set_rootdir(root);
rootdir = optarg;
break;
case 'V':
printf("%s\n", XBPS_RELVER);
@@ -119,6 +120,8 @@ main(int argc, char **argv)
xh.with_debug = with_debug;
xh.xbps_fetch_cb = fetch_file_progress_cb;
xh.xfpd = &xfpd;
xh.rootdir = rootdir;
xh.cachedir = cachedir;
xbps_init(&xh);
if ((rv = xbps_repository_pool_init()) != 0) {

View File

@@ -163,11 +163,13 @@ unregister_repository(const char *uri)
int
register_repository(const char *uri)
{
const struct xbps_handle *xhp;
struct repoinfo *rpi = NULL;
const char *idxstr = NULL;
char *metadir, *plist;
int rv = 0;
xhp = xbps_handle_get();
if ((idxstr = sanitize_url(uri)) == NULL)
return errno;
@@ -189,7 +191,7 @@ register_repository(const char *uri)
/*
* Create metadir if necessary.
*/
metadir = xbps_xasprintf("%s/%s", xbps_get_rootdir(),
metadir = xbps_xasprintf("%s/%s", xhp->rootdir,
XBPS_META_PATH);
if (metadir == NULL)
return errno;

View File

@@ -1,4 +1,4 @@
.TH "XBPS\-REPO" "8" "05/02/2011" "\ \&" "\ \&"
.TH "XBPS\-REPO" "8" "02/21/2011" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -24,14 +24,7 @@ The xbps\-repo(8) command is used to handle local or remote binary package repos
Sets the
\fIcache\fR
directory to store downloaded binary packages from remote repositories\&. By default it\(cqs set to
\fI/var/cache/xbps\fR
and it\(cqs always relative to the
\fIroot\fR
directory\&. So if you use a
\fIrootdir\fR
of
\fI/blah\fR, it will become
\fI/blah/cachedir\fR\&.
\fI/var/cache/xbps\fR\&.
.RE
.PP
\fB\-d\fR