Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/sysklogd/, app-admin/sysklogd/files/
Date: Mon, 18 Nov 2019 11:52:01
Message-Id: 1574077910.1680b7c15e41b99f5282998254a0dc68718dbe57.polynomial-c@gentoo
1 commit: 1680b7c15e41b99f5282998254a0dc68718dbe57
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Mon Nov 18 11:45:06 2019 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Mon Nov 18 11:51:50 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1680b7c1
7
8 app-admin/sysklogd: Bump to version 2.0
9
10 Package-Manager: Portage-2.3.79, Repoman-2.3.18
11 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
12
13 app-admin/sysklogd/Manifest | 1 +
14 .../files/sysklogd-2.0-optional_logger.patch | 101 +++++++++++++++++++++
15 app-admin/sysklogd/files/sysklogd.rc8 | 82 +++++++++++++++++
16 app-admin/sysklogd/metadata.xml | 1 +
17 app-admin/sysklogd/sysklogd-2.0.ebuild | 58 ++++++++++++
18 5 files changed, 243 insertions(+)
19
20 diff --git a/app-admin/sysklogd/Manifest b/app-admin/sysklogd/Manifest
21 index dc3c1683a77..dadb261979f 100644
22 --- a/app-admin/sysklogd/Manifest
23 +++ b/app-admin/sysklogd/Manifest
24 @@ -1,2 +1,3 @@
25 DIST sysklogd-1.5.1.tar.gz 90011 BLAKE2B c40bd8d5769f7d3d4141d602c74ac41e05a140743d18c4923d9368da7ba193ccb89a6837173994f0b7a9c290cc23f64513040434d7ab8df81b5d09b73b0263ad SHA512 a72196a1a172d25be1c4791ef6256fe71fa2ba8c1383d230e646e93f8a65c3a57c535189726325da4c792fdb2e9cb119bba43c878816a8e78e78189fd32b12b7
26 +DIST sysklogd-2.0.tar.gz 465822 BLAKE2B 030ce2e65287d215d376937aec590715abcac06dffef735038c31ee102eb00d5c616bfd2f3d378e53ef6ae4aa062e9802aaaca84a6f5598b43da35ee722d37ac SHA512 25b55b8ea47280c11959e03d5a8c592e1b02764b4aeb722ef9782d84116475f1bbba96d6db8c291b694d99c7970e2e7615e7cd48b8fef6dff4f9ae825e18d030
27 DIST sysklogd_1.5-6.diff.gz 25677 BLAKE2B 3cb1f596490998b6002d4656a2321a500ce9941a37737c0b9d4702bbb87d7bc9ba21b68e06d175e3c1714a701adc6b3312e18a556ebc9ef395d8968762830cb5 SHA512 816961a835a43057569f62fd20d9f7b5e0bfcfcb173b68947457708504db3ce47e635956c8a9564f9bd577d8f3c49dfc725d321dfd3370b2de918363c30f838e
28
29 diff --git a/app-admin/sysklogd/files/sysklogd-2.0-optional_logger.patch b/app-admin/sysklogd/files/sysklogd-2.0-optional_logger.patch
30 new file mode 100644
31 index 00000000000..4e5580b0422
32 --- /dev/null
33 +++ b/app-admin/sysklogd/files/sysklogd-2.0-optional_logger.patch
34 @@ -0,0 +1,101 @@
35 +From 227008ec0f59eecf3a962ebd9fbc27a0e475a4df Mon Sep 17 00:00:00 2001
36 +From: Lars Wendler <polynomial-c@g.o>
37 +Date: Mon, 18 Nov 2019 12:08:26 +0100
38 +Subject: [PATCH] build: make logger and its man page optional
39 +
40 +There are other packages that provide a logger program like util-linux
41 +We should respekt that
42 +
43 +Signed-off-by: Lars Wendler <polynomial-c@g.o>
44 +---
45 + configure.ac | 10 ++++++++++
46 + man/Makefile.am | 6 +++++-
47 + src/Makefile.am | 8 +++++++-
48 + 3 files changed, 22 insertions(+), 2 deletions(-)
49 +
50 +diff --git a/configure.ac b/configure.ac
51 +index 37c0bd4..e7acad7 100644
52 +--- a/configure.ac
53 ++++ b/configure.ac
54 +@@ -65,6 +65,10 @@ AC_ARG_WITH(systemd,
55 + [AS_HELP_STRING([--with-systemd=DIR], [Directory for systemd service files])],,
56 + [with_systemd=auto])
57 +
58 ++AC_ARG_WITH(logger,
59 ++ AS_HELP_STRING([--without-logger], [Do not build/install logger binary and man page, default: enabled]),
60 ++ [logger=$withval], [logger='yes'])
61 ++
62 + AS_IF([test "x$klogd" != "xno"],
63 + with_klogd="yes"
64 + AC_DEFINE(KLOGD, 1, [Build with klogd, default: built-in /dev/kmsg support in syslogd]),
65 +@@ -97,6 +101,12 @@ AS_IF([test "x$with_systemd" != "xno"],
66 + [AC_SUBST([systemddir], [$with_systemd])])
67 + AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemd" != "xno"])
68 +
69 ++AS_IF([test "x$logger" != "xno"], [
70 ++ with_logger="yes"
71 ++ AC_DEFINE(LOGGER, 1, [Build with logger])],
72 ++ with_logger="no")
73 ++AM_CONDITIONAL([ENABLE_LOGGER], [test "x$with_logger" != "xno"])
74 ++
75 + # Expand $sbindir early, into $SBINDIR, for systemd unit file
76 + # NOTE: This does *not* take prefix/exec_prefix override at "make
77 + # install" into account, unfortunately.
78 +diff --git a/man/Makefile.am b/man/Makefile.am
79 +index 8ee7064..8ccad31 100644
80 +--- a/man/Makefile.am
81 ++++ b/man/Makefile.am
82 +@@ -1,4 +1,4 @@
83 +-dist_man1_MANS = logger.1
84 ++dist_man1_MANS =
85 + dist_man3_MANS = syslogp.3
86 + dist_man5_MANS = syslog.conf.5
87 + dist_man8_MANS = syslogd.8
88 +@@ -6,3 +6,7 @@ dist_man8_MANS = syslogd.8
89 + if ENABLE_KLOGD
90 + dist_man8_MANS += klogd.8
91 + endif
92 ++
93 ++if ENABLE_LOGGER
94 ++dist_man1_MANS += logger.1
95 ++endif
96 +diff --git a/src/Makefile.am b/src/Makefile.am
97 +index 85f747b..849e49b 100644
98 +--- a/src/Makefile.am
99 ++++ b/src/Makefile.am
100 +@@ -16,7 +16,7 @@
101 + # with this program; if not, write to the Free Software Foundation, Inc.,
102 + # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
103 +
104 +-bin_PROGRAMS = logger
105 ++bin_PROGRAMS =
106 + sbin_PROGRAMS = syslogd
107 + lib_LTLIBRARIES = libsyslog.la
108 + noinst_LTLIBRARIES = libcompat.la
109 +@@ -25,6 +25,10 @@ if ENABLE_KLOGD
110 + sbin_PROGRAMS += klogd
111 + endif
112 +
113 ++if ENABLE_LOGGER
114 ++bin_PROGRAMS += logger
115 ++endif
116 ++
117 + AM_CFLAGS = -W -Wall -Wextra
118 + AM_CFLAGS += -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing
119 + AM_CPPFLAGS = -DSYSCONFDIR=\"@sysconfdir@\" -DLOCALSTATEDIR=\"@localstatedir@\"
120 +@@ -39,10 +43,12 @@ klogd_CPPFLAGS = $(AM_CPPFLAGS)
121 + klogd_LDADD = $(LIBS) $(LIBOBJS)
122 + klogd_LDADD += libsyslog.la
123 +
124 ++if ENABLE_LOGGER
125 + logger_SOURCES = logger.c syslog.h
126 + logger_CPPFLAGS = $(AM_CPPFLAGS) -D_XOPEN_SOURCE=600
127 + logger_LDADD = $(LIBS) $(LIBOBJS)
128 + logger_LDADD += libsyslog.la
129 ++endif
130 +
131 + # Convenience library for libsyslog instead of linking with $(LTLIBOBJS),
132 + # which would pull in pidfile() and other (strong) symbols as well.
133 +--
134 +2.24.0
135 +
136
137 diff --git a/app-admin/sysklogd/files/sysklogd.rc8 b/app-admin/sysklogd/files/sysklogd.rc8
138 new file mode 100644
139 index 00000000000..6b411d55c98
140 --- /dev/null
141 +++ b/app-admin/sysklogd/files/sysklogd.rc8
142 @@ -0,0 +1,82 @@
143 +#!/sbin/openrc-run
144 +# Copyright 1999-2019 Gentoo Authors
145 +# Distributed under the terms of the GNU General Public License, v2 or later
146 +
147 +extra_started_commands="reload"
148 +
149 +depend() {
150 + need clock hostname
151 + provide logger
152 +}
153 +
154 +has_klogd() {
155 + [ -x "/usr/sbin/klogd" ]
156 +}
157 +
158 +start_daemon() {
159 + local retval=0
160 + local daemon="$1"
161 + local options="$2"
162 +
163 + [ -z "${daemon}" ] && return 1
164 +
165 + ebegin "sysklogd -> start: ${daemon}"
166 + start-stop-daemon --start --exec /usr/sbin/"${daemon}" \
167 + --pidfile /var/run/"${daemon}".pid -- ${options}
168 + retval=$?
169 + eend ${retval} "Failed to start ${daemon}"
170 +
171 + return ${retval}
172 +}
173 +
174 +stop_daemon() {
175 + local retval=0
176 + local daemon="$1"
177 +
178 + [ -z "${daemon}" ] && return 1
179 +
180 + ebegin "sysklogd -> stop: ${daemon}"
181 + # syslogd can be stubborn some times (--retry 15)...
182 + start-stop-daemon --stop --retry 15 --quiet --pidfile /var/run/"${daemon}".pid
183 + retval=$?
184 + eend ${retval} "Failed to stop ${daemon}"
185 +
186 + return ${retval}
187 +}
188 +
189 +start() {
190 + start_daemon "syslogd" "${SYSLOGD}" || return 1
191 +
192 + # klogd do not always start proper if started too early
193 + sleep 1
194 +
195 + if has_klogd && ! start_daemon "klogd" "${KLOGD}" ; then
196 + stop_daemon "syslogd"
197 + return 1
198 + fi
199 +
200 + return 0
201 +}
202 +
203 +stop() {
204 + if has_klogd ; then
205 + stop_daemon "klogd" || return 1
206 + fi
207 + stop_daemon "syslogd" || return 1
208 + return 0
209 +}
210 +
211 +reload() {
212 + local ret=0
213 +
214 + ebegin "Reloading configuration"
215 +
216 + start-stop-daemon --signal HUP --pidfile /var/run/syslogd.pid
217 + ret=$((${ret} + $?))
218 + if has_klogd ; then
219 + start-stop-daemon --signal USR1 --pidfile /var/run/klogd.pid
220 + ret=$((${ret} + $?))
221 + fi
222 +
223 + eend ${ret}
224 +}
225
226 diff --git a/app-admin/sysklogd/metadata.xml b/app-admin/sysklogd/metadata.xml
227 index 094ccd37b3f..868e8ae726d 100644
228 --- a/app-admin/sysklogd/metadata.xml
229 +++ b/app-admin/sysklogd/metadata.xml
230 @@ -6,6 +6,7 @@
231 <name>Gentoo Base System</name>
232 </maintainer>
233 <use>
234 + <flag name="klogd">Build and install (deprecated) kernel logging daemon</flag>
235 <flag name="logrotate">use app-admin/logrotate for rotating logs rather than custom cron scripts</flag>
236 </use>
237 </pkgmetadata>
238
239 diff --git a/app-admin/sysklogd/sysklogd-2.0.ebuild b/app-admin/sysklogd/sysklogd-2.0.ebuild
240 new file mode 100644
241 index 00000000000..e3fa8796ba4
242 --- /dev/null
243 +++ b/app-admin/sysklogd/sysklogd-2.0.ebuild
244 @@ -0,0 +1,58 @@
245 +# Copyright 1999-2019 Gentoo Authors
246 +# Distributed under the terms of the GNU General Public License v2
247 +
248 +EAPI=7
249 +
250 +inherit autotools flag-o-matic systemd toolchain-funcs
251 +
252 +DESCRIPTION="Standard log daemons"
253 +HOMEPAGE="https://github.com/troglobit/sysklogd"
254 +SRC_URI="https://github.com/troglobit/sysklogd/releases/download/v$(ver_cut 1-2)/${P}.tar.gz"
255 +
256 +LICENSE="BSD"
257 +SLOT="0"
258 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
259 +IUSE="klogd logrotate systemd"
260 +RESTRICT="test"
261 +
262 +DEPEND=""
263 +RDEPEND=""
264 +
265 +DOCS=( ChangeLog.md README.md )
266 +
267 +PATCHES=(
268 + ${FILESDIR}/${PN}-2.0-optional_logger.patch
269 +)
270 +
271 +pkg_setup() {
272 + append-lfs-flags
273 + tc-export CC
274 +}
275 +
276 +src_prepare() {
277 + default
278 + eautoreconf
279 +}
280 +
281 +src_configure() {
282 + local myeconfargs=(
283 + # we have logger from sys-apps/util-linux
284 + #--without-logger
285 + $(use_with klogd)
286 + $(use_with systemd systemd $(systemd_get_systemunitdir))
287 + )
288 + econf "${myeconfargs[@]}"
289 +}
290 +
291 +src_install() {
292 + default
293 +
294 + insinto /etc
295 + doins syslog.conf
296 + keepdir /etc/syslog.d
297 +
298 + find "${ED}" -type f \( -name "*.a" -o -name "*.la" \) -delete || die
299 +
300 + newinitd "${FILESDIR}"/sysklogd.rc8 sysklogd
301 + newconfd "${FILESDIR}"/sysklogd.confd sysklogd
302 +}