Skip to content

Commit

Permalink
add XBPS_SYSLOG environment variable to overwrite configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Duncaen committed Dec 24, 2022
1 parent d962eaa commit a1a0167
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 12 deletions.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions bin/xbps-alternatives/xbps-alternatives.1
Original file line number Diff line number Diff line change
Expand Up @@ -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 ,
Expand Down
5 changes: 5 additions & 0 deletions bin/xbps-install/xbps-install.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions bin/xbps-reconfigure/xbps-reconfigure.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions bin/xbps-remove/xbps-remove.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 10 additions & 12 deletions lib/initend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a1a0167

Please sign in to comment.