Replaced config/system {repo,preserve,virtualpkg}.d with a single directory.

See the NEWS file for more information.
This commit is contained in:
Juan RP
2014-11-06 09:58:04 +01:00
parent 578c3add0c
commit 5b522109f7
38 changed files with 278 additions and 277 deletions

View File

@@ -211,12 +211,10 @@ rcv_init(rcv_t *rcv, const char *prog)
rcv->have_vars = 0;
rcv->ptr = rcv->input = NULL;
if (rcv->xbps_conf != NULL) {
strncpy(rcv->xhp.conffile, rcv->xbps_conf, sizeof(rcv->xhp.conffile)-1);
rcv->xhp.conffile[sizeof(rcv->xhp.conffile)-1] = '\0';
xbps_strlcpy(rcv->xhp.confdir, rcv->xbps_conf, sizeof(rcv->xhp.confdir));
}
if (rcv->rootdir != NULL) {
strncpy(rcv->xhp.rootdir, rcv->rootdir, sizeof(rcv->xhp.rootdir)-1);
rcv->xhp.rootdir[sizeof(rcv->xhp.rootdir)-1] = '\0';
xbps_strlcpy(rcv->xhp.rootdir, rcv->rootdir, sizeof(rcv->xhp.rootdir));
}
if (xbps_init(&rcv->xhp) != 0)
abort();
@@ -507,11 +505,12 @@ rcv_find_conf(rcv_t *rcv)
}
static bool
check_reverts(const char *repover, const map_item_t reverts) {
check_reverts(const char *repover, const map_item_t reverts)
{
bool rv = false;
char *sreverts, *p;
if(reverts.v.len == 0)
if (reverts.v.len == 0)
return rv;
sreverts = calloc(reverts.v.len+1, sizeof(char));
@@ -523,14 +522,14 @@ check_reverts(const char *repover, const map_item_t reverts) {
* Check if it's the first character or the previous character is a
* whitespace.
*/
if(p > sreverts && !isspace(p[-1]))
if (p > sreverts && !isspace(p[-1]))
continue;
p += strlen(repover);
/*
* Check if it's the last character or if the next character is a
* whitespace
*/
if(isspace(*p) || *p == '\0') {
if (isspace(*p) || *p == '\0') {
rv = true;
break;
}

View File

@@ -1,4 +1,4 @@
.Dd September 30, 2014
.Dd November 5, 2014
.Dt XBPS-CHECKVERS 8
.Sh NAME
.Nm xbps-checkvers
@@ -24,8 +24,10 @@ tree. The
argument sets extra packages to process with the outdated ones (only processed if missing).
.Sh OPTIONS
.Bl -tag -width -x
.It Fl C, Fl -config Ar file
Specifies a full path to the XBPS configuration file.
.It Fl C, Fl -config Ar dir
Specifies a path to the XBPS configuration directory.
If the first character is not '\/' then it's a relative path of
.Ar rootdir .
.It Fl D, Fl -distdir Ar dir
Specifies a full path to the void-packages repository. By default set to
.Nm ~/void-packages .

View File

@@ -480,7 +480,7 @@ main(int argc, char **argv)
/* Initialize libxbps */
memset(&xh, 0, sizeof(xh));
if (rootdir != NULL)
strncpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
xbps_strlcpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
if ((rv = xbps_init(&xh)) != 0)
die("failed to initialize libxbps: %s", strerror(rv));

View File

@@ -44,8 +44,8 @@ usage(bool fail)
"Usage: xbps-install [OPTIONS] [PKGNAME...]\n\n"
"OPTIONS\n"
" -A --automatic Set automatic installation mode\n"
" -C --config <file> Full path to configuration file\n"
" -c --cachedir <dir> Full path to cachedir\n"
" -C --config <dir> Path to confdir (xbps.d)\n"
" -c --cachedir <dir> Path to cachedir\n"
" -d --debug Debug mode shown to stderr\n"
" -f --force Force package re-installation\n"
" If specified twice, all files will be\n"
@@ -110,12 +110,12 @@ main(int argc, char **argv)
};
struct xbps_handle xh;
struct xferstat xfer;
const char *rootdir, *cachedir, *conffile;
const char *rootdir, *cachedir, *confdir;
int i, c, flags, rv, fflag = 0;
bool syncf, yes, reinstall, drun, update;
int maxcols;
rootdir = cachedir = conffile = NULL;
rootdir = cachedir = confdir = NULL;
flags = rv = 0;
syncf = yes = reinstall = drun = update = false;
@@ -127,7 +127,7 @@ main(int argc, char **argv)
flags |= XBPS_FLAG_INSTALL_AUTO;
break;
case 'C':
conffile = optarg;
confdir = optarg;
break;
case 'c':
cachedir = optarg;
@@ -187,11 +187,11 @@ main(int argc, char **argv)
xh.fetch_cb = fetch_file_progress_cb;
xh.fetch_cb_data = &xfer;
if (rootdir)
strncpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
xbps_strlcpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
if (cachedir)
strncpy(xh.cachedir, cachedir, sizeof(xh.cachedir));
if (conffile)
strncpy(xh.conffile, conffile, sizeof(xh.conffile));
xbps_strlcpy(xh.cachedir, cachedir, sizeof(xh.cachedir));
if (confdir)
xbps_strlcpy(xh.confdir, confdir, sizeof(xh.confdir));
xh.flags = flags;
if (flags & XBPS_FLAG_VERBOSE)
xh.unpack_cb = unpack_progress_cb;

View File

@@ -1,4 +1,4 @@
.Dd September 30, 2014
.Dd November 5, 2014
.Dt XBPS-INSTALL 8
.Sh NAME
.Nm xbps-install
@@ -59,10 +59,14 @@ The first repository matching the package expression wins.
.It Fl A, Fl -automatic
Enables automatic installation mode, i.e. package will be treated as orphan
if no package is depending on it directly.
.It Fl C, Fl -config Ar file
Specifies a full path to the XBPS configuration file.
.It Fl C, Fl -config Ar dir
Specifies a path to the XBPS configuration directory.
If the first character is not '\/' then it's a relative path of
.Ar rootdir .
.It Fl c, Fl -cachedir Ar dir
Specifies a full path to the cache directory, where binary packages are stored.
Specifies a path to the cache directory, where binary packages are stored.
If the first character is not '\/' then it's a relative path of
.Ar rootdir .
.It Fl d, Fl -debug
Enables extra debugging shown to stderr.
.It Fl f, Fl -force
@@ -111,8 +115,8 @@ the native architecture).
.El
.Sh FILES
.Bl -tag -width /var/db/xbps/.<pkgname>-files.plist
.It Ar /etc/xbps/xbps.conf
Default configuration file.
.It Ar /etc/xbps.d
Default configuration directory.
.It Ar /var/db/xbps/.<pkgname>-files.plist
Package files metadata.
.It Ar /var/db/xbps/pkgdb-0.38.plist

View File

@@ -41,7 +41,7 @@ usage(bool fail)
"Usage: xbps-pkgdb [OPTIONS] [PKGNAME...]\n\n"
"OPTIONS\n"
" -a --all Process all packages\n"
" -C --config <file> Full path to configuration file\n"
" -C --config <dir> Path to confdir (xbps.d)\n"
" -d --debug Debug mode shown to stderr\n"
" -h --help Print usage help\n"
" -m --mode <auto|manual|hold|unhold> Change PKGNAME to this mode\n"
@@ -92,7 +92,7 @@ main(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
struct xbps_handle xh;
const char *conffile = NULL, *rootdir = NULL, *instmode = NULL;
const char *confdir = NULL, *rootdir = NULL, *instmode = NULL;
int c, i, rv, flags = 0;
bool update_format = false, all = false;
@@ -102,7 +102,7 @@ main(int argc, char **argv)
all = true;
break;
case 'C':
conffile = optarg;
confdir = optarg;
break;
case 'd':
flags |= XBPS_FLAG_DEBUG;
@@ -136,9 +136,9 @@ main(int argc, char **argv)
memset(&xh, 0, sizeof(xh));
if (rootdir)
strncpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
if (conffile)
strncpy(xh.conffile, conffile, sizeof(xh.conffile));
xbps_strlcpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
if (confdir)
xbps_strlcpy(xh.confdir, confdir, sizeof(xh.confdir));
xh.flags = flags;
if ((rv = xbps_init(&xh)) != 0) {

View File

@@ -1,4 +1,4 @@
.Dd September 30, 2014
.Dd November 5, 2014
.Dt XBPS-PKGDB 8
.Sh NAME
.Nm xbps-pkgdb
@@ -36,8 +36,10 @@ Updates the pkgdb format to the latest version.
.Bl -tag -width -x
.It Fl a, Fl -all
Process all registered packages, regardless of its state.
.It Fl C, Fl -config Ar file
Specifies a full path to the XBPS configuration file.
.It Fl C, Fl -config Ar dir
Specifies a path to the XBPS configuration directory.
If the first character is not '\/' then it's a relative path of
.Ar rootdir .
.It Fl d, Fl -debug
Enables extra debugging shown to stderr.
.It Fl h, Fl -help
@@ -67,8 +69,8 @@ Shows the XBPS version.
.El
.Sh FILES
.Bl -tag -width /var/db/xbps/.<pkgname>-files.plist
.It Ar /etc/xbps/xbps.conf
Default configuration file.
.It Ar /etc/xbps.d
Default configuration directory.
.It Ar /var/db/xbps/.<pkgname>-files.plist
Package files metadata.
.It Ar /var/db/xbps/pkgdb-0.38.plist

View File

@@ -77,7 +77,7 @@ list_pkgs_in_dict(struct xbps_handle *xhp _unused,
assert(out);
snprintf(out, lpc->maxcols - 3,
"%s %s", tmp, short_desc);
strncat(out, "...\n", lpc->maxcols);
xbps_strlcat(out, "...\n", sizeof(*out));
printf("%s", out);
free(out);
} else {

View File

@@ -38,8 +38,8 @@ usage(bool fail)
fprintf(stdout,
"Usage: xbps-query [OPTIONS] MODE [ARGUMENTS]\n"
"\nOPTIONS\n"
" -C --config <file> Full path to configuration file\n"
" -c --cachedir <dir> Full path to cachedir\n"
" -C --config <dir> Path to confdir (xbps.d)\n"
" -c --cachedir <dir> Path to cachedir\n"
" -d --debug Debug mode shown to stderr\n"
" -h --help Print help usage\n"
" -p --property PROP[,...] Show properties for PKGNAME\n"
@@ -99,13 +99,13 @@ main(int argc, char **argv)
{ NULL, 0, NULL, 0 },
};
struct xbps_handle xh;
const char *pkg, *rootdir, *cachedir, *conffile, *props;
const char *pkg, *rootdir, *cachedir, *confdir, *props;
int c, flags, rv;
bool list_pkgs, list_repos, orphans, own;
bool list_manual, list_hold, show_prop, show_files, show_deps, show_rdeps;
bool show, pkg_search, regex, repo_mode, opmode, fulldeptree;
rootdir = cachedir = conffile = props = pkg = NULL;
rootdir = cachedir = confdir = props = pkg = NULL;
flags = rv = c = 0;
list_pkgs = list_repos = list_hold = orphans = pkg_search = own = false;
list_manual = show_prop = show_files = false;
@@ -117,7 +117,7 @@ main(int argc, char **argv)
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
switch (c) {
case 'C':
conffile = optarg;
confdir = optarg;
break;
case 'c':
cachedir = optarg;
@@ -214,11 +214,11 @@ main(int argc, char **argv)
* Initialize libxbps.
*/
if (rootdir)
strncpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
xbps_strlcpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
if (cachedir)
strncpy(xh.cachedir, cachedir, sizeof(xh.cachedir));
if (conffile)
strncpy(xh.conffile, conffile, sizeof(xh.conffile));
xbps_strlcpy(xh.cachedir, cachedir, sizeof(xh.cachedir));
if (confdir)
xbps_strlcpy(xh.confdir, confdir, sizeof(xh.confdir));
xh.flags = flags;

View File

@@ -68,7 +68,7 @@ print_results(struct xbps_handle *xhp, struct search_data *sd)
for (unsigned int i = 0; i < xbps_array_count(sd->results); i++) {
xbps_array_get_cstring_nocopy(sd->results, i, &pkgver);
xbps_array_get_cstring_nocopy(sd->results, i+1, &desc);
strncpy(tmp, pkgver, sizeof(tmp));
xbps_strlcpy(tmp, pkgver, sizeof(tmp));
for (j = strlen(tmp); j < tlen; j++)
tmp[j] = ' ';
@@ -84,7 +84,7 @@ print_results(struct xbps_handle *xhp, struct search_data *sd)
assert(out);
snprintf(out, sd->maxcols-3, "%s %s %s",
inststr, tmp, desc);
strncat(out, "...\n", sd->maxcols);
xbps_strlcat(out, "...\n", sizeof(*out));
printf("%s", out);
free(out);
} else {

View File

@@ -1,4 +1,4 @@
.Dd September 30, 2014
.Dd November 5, 2014
.Dt XBPS-QUERY 8
.Sh NAME
.Nm xbps-query
@@ -53,10 +53,14 @@ Example:
The first repository matching the package expression wins.
.Sh OPTIONS
.Bl -tag -width -x
.It Fl C, Fl -config Ar file
Specifies a full path to the XBPS configuration file.
.It Fl C, Fl -config Ar dir
Specifies a path to the XBPS configuration directory.
If the first character is not '\/' then it's a relative path of
.Ar rootdir .
.It Fl c, Fl -cachedir Ar dir
Specifies a full path to the cache directory, where binary packages are stored.
Specifies a path to the cache directory, where binary packages are stored.
If the first character is not '\/' then it's a relative path of
.Ar rootdir .
.It Fl d, Fl -debug
Enables extra debugging shown to stderr.
.It Fl h, Fl -help
@@ -224,8 +228,8 @@ the native architecture).
.El
.Sh FILES
.Bl -tag -width /var/db/xbps/.<pkgname>-files.plist
.It Ar /etc/xbps/xbps.conf
Default configuration file.
.It Ar /etc/xbps.d
Default configuration directory.
.It Ar /var/db/xbps/.<pkgname>-files.plist
Package files metadata.
.It Ar /var/db/xbps/pkgdb-0.38.plist

View File

@@ -40,7 +40,7 @@ usage(bool fail)
"Usage: xbps-reconfigure [OPTIONS] [PKGNAME...]\n\n"
"OPTIONS\n"
" -a --all Process all packages\n"
" -C --config <file> Full path to configuration file\n"
" -C --config <dir> Path to confdir (xbps.d)\n"
" -d --debug Debug mode shown to stderr\n"
" -f --force Force reconfiguration\n"
" -h --help Print usage help\n"
@@ -104,7 +104,7 @@ main(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
struct xbps_handle xh;
const char *conffile = NULL, *rootdir = NULL;
const char *confdir = NULL, *rootdir = NULL;
int c, i, rv, flags = 0;
bool all = false;
@@ -114,7 +114,7 @@ main(int argc, char **argv)
all = true;
break;
case 'C':
conffile = optarg;
confdir = optarg;
break;
case 'd':
flags |= XBPS_FLAG_DEBUG;
@@ -146,9 +146,9 @@ main(int argc, char **argv)
memset(&xh, 0, sizeof(xh));
xh.state_cb = state_cb;
if (rootdir)
strncpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
if (conffile)
strncpy(xh.conffile, conffile, sizeof(xh.conffile));
xbps_strlcpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
if (confdir)
xbps_strlcpy(xh.confdir, confdir, sizeof(xh.confdir));
xh.flags = flags;

View File

@@ -1,4 +1,4 @@
.Dd September 30, 2014
.Dd November 5, 2014
.Dt XBPS-RECONFIGURE 8
.Sh NAME
.Nm xbps-reconfigure
@@ -35,8 +35,10 @@ option is specified.
.Bl -tag -width -x
.It Fl a, Fl -all
Configures all packages.
.It Fl C, Fl -config Ar file
Specifies a full path to the XBPS configuration file.
.It Fl C, Fl -config Ar dir
Specifies a path to the XBPS configuration directory.
If the first character is not '\/' then it's a relative path of
.Ar rootdir .
.It Fl d, Fl -debug
Enables extra debugging shown to stderr.
.It Fl f, Fl -force
@@ -44,7 +46,7 @@ Forcefully reconfigure package even if it was configured previously.
.It Fl h, Fl -help
Show the help usage.
.It Fl r, Fl -rootdir Ar dir
Specifies a full path for the target root directory.
Specifies a path for the target root directory.
.It Fl v, Fl -verbose
Enables verbose messages.
.It Fl V, Fl -version
@@ -52,8 +54,8 @@ Shows the XBPS version.
.El
.Sh FILES
.Bl -tag -width /var/db/xbps/.<pkgname>-files.plist
.It Ar /etc/xbps/xbps.conf
Default configuration file.
.It Ar /etc/xbps.d
Default configuration directory.
.It Ar /var/db/xbps/.<pkgname>.plist
Package files metadata.
.It Ar /var/db/xbps/pkgdb-0.38.plist

View File

@@ -45,8 +45,8 @@ usage(bool fail)
fprintf(stdout,
"Usage: xbps-remove [OPTIONS] [PKGNAME...]\n\n"
"OPTIONS\n"
" -C --config <file> Full path to configuration file\n"
" -c --cachedir <dir> Full path to cachedir\n"
" -C --config <dir> Path to confdir (xbps.d)\n"
" -c --cachedir <dir> Path to cachedir\n"
" -d --debug Debug mode shown to stderr\n"
" -F --force-revdeps Force package removal even with revdeps\n"
" -f --force Force package files removal\n"
@@ -181,13 +181,13 @@ main(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
struct xbps_handle xh;
const char *rootdir, *cachedir, *conffile;
const char *rootdir, *cachedir, *confdir;
int c, flags, rv;
bool yes, drun, recursive, ignore_revdeps, clean_cache;
bool orphans, reqby_force;
int maxcols;
rootdir = cachedir = conffile = NULL;
rootdir = cachedir = confdir = NULL;
flags = rv = 0;
drun = recursive = ignore_revdeps = clean_cache = false;
reqby_force = yes = orphans = false;
@@ -195,7 +195,7 @@ main(int argc, char **argv)
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
switch (c) {
case 'C':
conffile = optarg;
confdir = optarg;
break;
case 'c':
cachedir = optarg;
@@ -251,11 +251,11 @@ main(int argc, char **argv)
memset(&xh, 0, sizeof(xh));
xh.state_cb = state_cb_rm;
if (rootdir)
strncpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
xbps_strlcpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
if (cachedir)
strncpy(xh.cachedir, cachedir, sizeof(xh.cachedir));
if (conffile)
strncpy(xh.conffile, conffile, sizeof(xh.conffile));
xbps_strlcpy(xh.cachedir, cachedir, sizeof(xh.cachedir));
if (confdir)
xbps_strlcpy(xh.confdir, confdir, sizeof(xh.confdir));
xh.flags = flags;

View File

@@ -1,4 +1,4 @@
.Dd September 30, 2014
.Dd November 5, 2014
.Dt XBPS-REMOVE 8
.Sh NAME
.Nm xbps-remove
@@ -58,10 +58,14 @@ Package metadata file is removed.
Package is unregistered from package database.
.Sh OPTIONS
.Bl -tag -width -x
.It Fl C, Fl -config Ar file
Specifies a full path to the XBPS configuration file.
.It Fl C, Fl -config Ar dir
Specifies a path to the XBPS configuration directory.
If the first character is not '\/' then it's a relative path of
.Ar rootdir .
.It Fl c, Fl -cachedir Ar dir
Specifies a full path to the cache directory, where binary packages are stored.
Specifies a path to the cache directory, where binary packages are stored.
If the first character is not '\/' then it's a relative path of
.Ar rootdir .
.It Fl d, Fl -debug
Enables extra debugging shown to stderr.
.It Fl F, Fl -force-revdeps
@@ -92,8 +96,8 @@ Shows the XBPS version.
.El
.Sh FILES
.Bl -tag -width /var/db/xbps/.<pkgname>-files.plist
.It Ar /etc/xbps/xbps.conf
Default configuration file.
.It Ar /etc/xbps.d
Default configuration directory.
.It Ar /var/db/xbps/.<pkgname>-files.plist
Package files metadata.
.It Ar /var/db/xbps/pkgdb-0.38.plist

View File

@@ -103,14 +103,14 @@ main(int argc, char **argv)
xbps_dictionary_t dict;
struct xbps_handle xh;
struct xferstat xfer;
const char *version, *rootdir = NULL, *conffile = NULL;
const char *version, *rootdir = NULL, *confdir = NULL;
char *pkgname, *hash, *filename;
int flags = 0, c, rv = 0;
while ((c = getopt(argc, argv, "C:dr:V")) != -1) {
switch (c) {
case 'C':
conffile = optarg;
confdir = optarg;
break;
case 'r':
/* To specify the root directory */
@@ -146,9 +146,9 @@ main(int argc, char **argv)
xh.fetch_cb = fetch_file_progress_cb;
xh.fetch_cb_data = &xfer;
if (rootdir)
strncpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
if (conffile)
strncpy(xh.conffile, conffile, sizeof(xh.conffile));
xbps_strlcpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
if (confdir)
xbps_strlcpy(xh.confdir, confdir, sizeof(xh.confdir));
if ((rv = xbps_init(&xh)) != 0) {
xbps_error_printf("xbps-uhelper: failed to "
"initialize libxbps: %s.\n", strerror(rv));