add XBPS_SYSLOG environment variable to overwrite configuration

This commit is contained in:
Duncan Overbruck 2021-12-28 15:16:47 +01:00
parent d962eaaf3c
commit a1a0167d80
No known key found for this signature in database
GPG Key ID: 335C1D17EC3D6E35
7 changed files with 74 additions and 12 deletions

4
NEWS
View File

@ -52,6 +52,10 @@ xbps-X.XX.X (2020-XX-XX):
* xbps.d(5): describe ignorepkg more precisely. [chocimier]
* libxbps, xbps-install(1), xbps-remove(1), xbps-reconfigure(1),
xbps-alternatives(1): add `XBPS_SYSLOG` environment variable to overwrite
syslog configuration option. [duncaen]
xbps-0.59.1 (2020-04-01):
* libxbps: fixed a double free with malformed/incomplete

View File

@ -69,6 +69,20 @@ Default package database (0.38 format). Keeps track of installed packages and pr
.It Ar /var/cache/xbps
Default cache directory to store downloaded binary packages.
.El
.Sh ENVIRONMENT
.Bl -tag -width XBPS_TARGET_ARCH
.It Sy XBPS_ARCH
Overrides
.Xr uname 2
machine result with this value.
.It Sy XBPS_TARGET_ARCH
Sets the target architecture to this value.
.It Sy XBPS_SYSLOG
Overrides the
.Xr xbps.d 5
.Sy syslog=true|false
configuration option.
.El
.Sh SEE ALSO
.Xr xbps-checkvers 1 ,
.Xr xbps-create 1 ,

View File

@ -245,6 +245,11 @@ This variable differs from
in that it allows you to install packages partially, because
configuration phase is skipped (the target binaries might not be compatible with
the native architecture).
.It Sy XBPS_SYSLOG
Overrides the
.Xr xbps.d 5
.Sy syslog=true|false
configuration option.
.El
.Sh FILES
.Bl -tag -width /var/db/xbps/.<pkgname>-files.plist

View File

@ -71,6 +71,26 @@ Enables verbose messages.
.It Fl V, Fl -version
Show the version information.
.El
.Sh ENVIRONMENT
.Bl -tag -width XBPS_TARGET_ARCH
.It Sy XBPS_ARCH
Overrides
.Xr uname 2
machine result with this value.
Useful to install packages with a fake architecture
.It Sy XBPS_TARGET_ARCH
Sets the target architecture to this value.
This variable differs from
.Sy XBPS_ARCH
in that it allows you to install packages partially, because
configuration phase is skipped (the target binaries might not be compatible with
the native architecture).
.It Sy XBPS_SYSLOG
Overrides the
.Xr xbps.d 5
.Sy syslog=true|false
configuration option.
.El
.Sh FILES
.Bl -tag -width /var/db/xbps/.<pkgname>-files.plist
.It Ar /etc/xbps.d

View File

@ -97,6 +97,26 @@ Assume yes to all questions and avoid interactive questions.
.It Fl V, Fl -version
Show the version information.
.El
.Sh ENVIRONMENT
.Bl -tag -width XBPS_TARGET_ARCH
.It Sy XBPS_ARCH
Overrides
.Xr uname 2
machine result with this value.
Useful to remove packages with a fake architecture
.It Sy XBPS_TARGET_ARCH
Sets the target architecture to this value.
This variable differs from
.Sy XBPS_ARCH
in that it allows you to remove packages partially, because
configuration phase is skipped (the target binaries might not be compatible with
the native architecture).
.It Sy XBPS_SYSLOG
Overrides the
.Xr xbps.d 5
.Sy syslog=true|false
configuration option.
.El
.Sh FILES
.Bl -tag -width /var/db/xbps/.<pkgname>-files.plist
.It Ar /etc/xbps.d

View File

@ -25,9 +25,10 @@
*/
#include <sys/utsname.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <strings.h>
#include "xbps_api_impl.h"
@ -43,7 +44,7 @@
int
xbps_init(struct xbps_handle *xhp)
{
const char *native_arch = NULL;
const char *native_arch = NULL, *p;
int rv = 0;
assert(xhp != NULL);
@ -154,16 +155,13 @@ xbps_init(struct xbps_handle *xhp)
if (xbps_path_clean(xhp->metadir) == -1)
return ENOTSUP;
xbps_dbg_printf("rootdir=%s\n", xhp->rootdir);
xbps_dbg_printf("metadir=%s\n", xhp->metadir);
xbps_dbg_printf("cachedir=%s\n", xhp->cachedir);
xbps_dbg_printf("confdir=%s\n", xhp->confdir);
xbps_dbg_printf("sysconfdir=%s\n", xhp->sysconfdir);
xbps_dbg_printf("syslog=%s\n", xhp->flags & XBPS_FLAG_DISABLE_SYSLOG ? "false" : "true");
xbps_dbg_printf("bestmatching=%s\n", xhp->flags & XBPS_FLAG_BESTMATCH ? "true" : "false");
xbps_dbg_printf("keepconf=%s\n", xhp->flags & XBPS_FLAG_KEEP_CONFIG ? "true" : "false");
xbps_dbg_printf("Architecture: %s\n", xhp->native_arch);
xbps_dbg_printf("Target Architecture: %s\n", xhp->target_arch ? xhp->target_arch : "(null)");
p = getenv("XBPS_SYSLOG");
if (p) {
if (strcasecmp(p, "true") == 0)
xhp->flags &= ~XBPS_FLAG_DISABLE_SYSLOG;
else if (strcasecmp(p, "false") == 0)
xhp->flags |= XBPS_FLAG_DISABLE_SYSLOG;
}
if (xhp->flags & XBPS_FLAG_DEBUG) {
const char *repodir;

View File

@ -9,6 +9,7 @@ NPROCS=1
if [ -r /proc/cpuinfo ]; then
NPROCS=$(grep ^proc /proc/cpuinfo|wc -l)
fi
export XBPS_SYSLOG=false
LIBRARY_PATH=$PWD/lib LD_LIBRARY_PATH=$PWD/lib ATF_SHELL=/bin/sh kyua --variable parallelism=$NPROCS test -r result.db -k tests/xbps/Kyuafile
rv=$?
kyua report --verbose -r result.db