Skip to content

Commit 760753b

Browse files
committed
add XBPS_SYSLOG environment variable to overwrite configuration
1 parent 4beb068 commit 760753b

File tree

7 files changed

+74
-12
lines changed

7 files changed

+74
-12
lines changed

NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ xbps-X.XX.X (2020-XX-XX):
5252

5353
* xbps.d(5): describe ignorepkg more precisely. [chocimier]
5454

55+
* libxbps, xbps-install(1), xbps-remove(1), xbps-reconfigure(1),
56+
xbps-alternatives(1): add `XBPS_SYSLOG` environment variable to overwrite
57+
syslog configuration option. [duncaen]
58+
5559
xbps-0.59.1 (2020-04-01):
5660

5761
* libxbps: fixed a double free with malformed/incomplete

bin/xbps-alternatives/xbps-alternatives.1

+14
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,20 @@ Default package database (0.38 format). Keeps track of installed packages and pr
6969
.It Ar /var/cache/xbps
7070
Default cache directory to store downloaded binary packages.
7171
.El
72+
.Sh ENVIRONMENT
73+
.Bl -tag -width XBPS_TARGET_ARCH
74+
.It Sy XBPS_ARCH
75+
Overrides
76+
.Xr uname 2
77+
machine result with this value.
78+
.It Sy XBPS_TARGET_ARCH
79+
Sets the target architecture to this value.
80+
.It Sy XBPS_SYSLOG
81+
Overrides the
82+
.Xr xbps.d 5
83+
.Sy syslog=true|false
84+
configuration option.
85+
.El
7286
.Sh SEE ALSO
7387
.Xr xbps-checkvers 1 ,
7488
.Xr xbps-create 1 ,

bin/xbps-install/xbps-install.1

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

bin/xbps-reconfigure/xbps-reconfigure.1

+20
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,26 @@ Enables verbose messages.
7171
.It Fl V, Fl -version
7272
Show the version information.
7373
.El
74+
.Sh ENVIRONMENT
75+
.Bl -tag -width XBPS_TARGET_ARCH
76+
.It Sy XBPS_ARCH
77+
Overrides
78+
.Xr uname 2
79+
machine result with this value.
80+
Useful to install packages with a fake architecture
81+
.It Sy XBPS_TARGET_ARCH
82+
Sets the target architecture to this value.
83+
This variable differs from
84+
.Sy XBPS_ARCH
85+
in that it allows you to install packages partially, because
86+
configuration phase is skipped (the target binaries might not be compatible with
87+
the native architecture).
88+
.It Sy XBPS_SYSLOG
89+
Overrides the
90+
.Xr xbps.d 5
91+
.Sy syslog=true|false
92+
configuration option.
93+
.El
7494
.Sh FILES
7595
.Bl -tag -width /var/db/xbps/.<pkgname>-files.plist
7696
.It Ar /etc/xbps.d

bin/xbps-remove/xbps-remove.1

+20
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,26 @@ Assume yes to all questions and avoid interactive questions.
9797
.It Fl V, Fl -version
9898
Show the version information.
9999
.El
100+
.Sh ENVIRONMENT
101+
.Bl -tag -width XBPS_TARGET_ARCH
102+
.It Sy XBPS_ARCH
103+
Overrides
104+
.Xr uname 2
105+
machine result with this value.
106+
Useful to remove packages with a fake architecture
107+
.It Sy XBPS_TARGET_ARCH
108+
Sets the target architecture to this value.
109+
This variable differs from
110+
.Sy XBPS_ARCH
111+
in that it allows you to remove packages partially, because
112+
configuration phase is skipped (the target binaries might not be compatible with
113+
the native architecture).
114+
.It Sy XBPS_SYSLOG
115+
Overrides the
116+
.Xr xbps.d 5
117+
.Sy syslog=true|false
118+
configuration option.
119+
.El
100120
.Sh FILES
101121
.Bl -tag -width /var/db/xbps/.<pkgname>-files.plist
102122
.It Ar /etc/xbps.d

lib/initend.c

+10-12
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
*/
2626

2727
#include <sys/utsname.h>
28+
#include <errno.h>
2829
#include <stdlib.h>
2930
#include <string.h>
30-
#include <errno.h>
31+
#include <strings.h>
3132

3233
#include "xbps_api_impl.h"
3334

@@ -43,7 +44,7 @@
4344
int
4445
xbps_init(struct xbps_handle *xhp)
4546
{
46-
const char *native_arch = NULL;
47+
const char *native_arch = NULL, *p;
4748
int rv = 0;
4849

4950
assert(xhp != NULL);
@@ -151,16 +152,13 @@ xbps_init(struct xbps_handle *xhp)
151152
if (xbps_path_clean(xhp->metadir) == -1)
152153
return ENOTSUP;
153154

154-
xbps_dbg_printf("rootdir=%s\n", xhp->rootdir);
155-
xbps_dbg_printf("metadir=%s\n", xhp->metadir);
156-
xbps_dbg_printf("cachedir=%s\n", xhp->cachedir);
157-
xbps_dbg_printf("confdir=%s\n", xhp->confdir);
158-
xbps_dbg_printf("sysconfdir=%s\n", xhp->sysconfdir);
159-
xbps_dbg_printf("syslog=%s\n", xhp->flags & XBPS_FLAG_DISABLE_SYSLOG ? "false" : "true");
160-
xbps_dbg_printf("bestmatching=%s\n", xhp->flags & XBPS_FLAG_BESTMATCH ? "true" : "false");
161-
xbps_dbg_printf("keepconf=%s\n", xhp->flags & XBPS_FLAG_KEEP_CONFIG ? "true" : "false");
162-
xbps_dbg_printf("Architecture: %s\n", xhp->native_arch);
163-
xbps_dbg_printf("Target Architecture: %s\n", xhp->target_arch ? xhp->target_arch : "(null)");
155+
p = getenv("XBPS_SYSLOG");
156+
if (p) {
157+
if (strcasecmp(p, "true") == 0)
158+
xhp->flags &= ~XBPS_FLAG_DISABLE_SYSLOG;
159+
else if (strcasecmp(p, "false") == 0)
160+
xhp->flags |= XBPS_FLAG_DISABLE_SYSLOG;
161+
}
164162

165163
if (xhp->flags & XBPS_FLAG_DEBUG) {
166164
const char *repodir;

run-tests

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ NPROCS=1
99
if [ -r /proc/cpuinfo ]; then
1010
NPROCS=$(grep ^proc /proc/cpuinfo|wc -l)
1111
fi
12+
export XBPS_SYSLOG=false
1213
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
1314
rv=$?
1415
kyua report --verbose -r result.db

0 commit comments

Comments
 (0)