Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-process/acct/, sys-process/acct/files/
Date: Thu, 27 Jul 2017 14:04:18
Message-Id: 1501164244.ce3320b8f7c1530d7438cd4774a72a75266e1c0b.whissi@gentoo
1 commit: ce3320b8f7c1530d7438cd4774a72a75266e1c0b
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jul 27 14:03:48 2017 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 27 14:04:04 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ce3320b8
7
8 sys-process/acct: Bump to v6.6.4
9
10 Ebuild changes:
11 ===============
12 - Migrated to EAPI=6
13
14 - Dropped usage of base eclass which is no longer needed
15
16 - *-no-gets.patch dropped which is no longer necessary since upstream
17 updated gnulib in v6.6.1
18
19 - Runscript improved
20
21 - A running instance will now remember the accounting file
22
23 - Make use of start_pre() function
24
25 - Logrotate script will now work for systemd users as well (bug #508512)
26
27 Gentoo-Bug: https://bugs.gentoo.org/508512
28 Package-Manager: Portage-2.3.5, Repoman-2.3.2
29
30 sys-process/acct/Manifest | 1 +
31 sys-process/acct/acct-6.6.4.ebuild | 44 +++++
32 .../acct/files/acct-6.6.4-cross-compile.patch | 220 +++++++++++++++++++++
33 sys-process/acct/files/acct.confd-r1 | 11 ++
34 sys-process/acct/files/acct.initd-r2 | 65 ++++++
35 sys-process/acct/files/acct.logrotate-r1 | 18 ++
36 6 files changed, 359 insertions(+)
37
38 diff --git a/sys-process/acct/Manifest b/sys-process/acct/Manifest
39 index 81a3d0153a7..1b984e9bdce 100644
40 --- a/sys-process/acct/Manifest
41 +++ b/sys-process/acct/Manifest
42 @@ -1,3 +1,4 @@
43 DIST acct-6.5.5.tar.gz 747225 SHA256 4163c87b9e92a73a65eaeadc6c41caa4626da782ff26d6e7a945edcc140a6fd5 SHA512 6a36548cfe0e68829c94780aac4053f8a5840c5a704b88a9562758408dc64b4e26965743aec51ef02f7780efcfbf42d20805fecb12a68e7e1f279a1259151fb0 WHIRLPOOL 30c431dfe3af181770e261470090528fd21d41b45a234181ef0f1a62226979d4de38f851b1d5e200feba5b08acf30d2fe18a517f6096f3fcbc8e32dca9630be4
44 DIST acct-6.6.1.tar.gz 2869677 SHA256 554515611ef9299012b7510050868a48fc178ce1544947123ab46ec50230ffcb SHA512 4bc3d6b41aeafcf8acfdd020057f1b6f15eea3589981387bca7e57aa8fe71d058e8def97f139dd2c11a1ac39f2d8b95bd103d31caff042cf716dd961b9588f5d WHIRLPOOL 097b7c5f55aac40dd5d63b6ce80a1c2809241f3999c15d5c2c3d8f418f1e51b90ed3c5937655dafd9d702fc72b1d1a6faae870e0c2722c3716e097d5d3b98cd1
45 DIST acct-6.6.2.tar.gz 852375 SHA256 8ed47b2f893b08f0d67720880adbb48b835a826c314fa52fd52af1cee6870101 SHA512 5942aa3d1faebb29bd6d6ff97c2ba8525dc5a9c85522c3f549ce0772042d3736e19126ddd7e10fe0681a6ac496b8d3aafda0894577a3b64c59f3b78fc222d2b3 WHIRLPOOL 135be28fb3b99ae5c4fb03d21d73a2bb2659d4e209a1444bb4741ae95761191ac74874f0476d3413c4221e2b321de2adf45240b2335b5cac92083d32ab547ebe
46 +DIST acct-6.6.4.tar.gz 853273 SHA256 4c15bf2b58b16378bcc83f70e77d4d40ab0b194acf2ebeefdb507f151faa663f SHA512 413aa446caece8fd773c92e2995bbaa034f63dd0ced521815a676c49f118e02982862b9c0ab7e60be5212c87d1e82ba6325bda212cf4857392a068d359a1e2c2 WHIRLPOOL 28c5405da1e19aa0690fef35e11bbae906e1b9f66724584edbc0b444fb138c71a1d0c9cc5738c249061e32ff0c84053168a0ffe743a0bf583395d4b47b4ae89f
47
48 diff --git a/sys-process/acct/acct-6.6.4.ebuild b/sys-process/acct/acct-6.6.4.ebuild
49 new file mode 100644
50 index 00000000000..46888474a25
51 --- /dev/null
52 +++ b/sys-process/acct/acct-6.6.4.ebuild
53 @@ -0,0 +1,44 @@
54 +# Copyright 1999-2017 Gentoo Foundation
55 +# Distributed under the terms of the GNU General Public License v2
56 +
57 +EAPI=6
58 +inherit autotools systemd
59 +
60 +DESCRIPTION="GNU system accounting utilities"
61 +HOMEPAGE="https://savannah.gnu.org/projects/acct/"
62 +SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
63 +
64 +LICENSE="GPL-3"
65 +SLOT="0"
66 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
67 +IUSE=""
68 +
69 +PATCHES=(
70 + "${FILESDIR}"/${PN}-6.6.4-cross-compile.patch
71 +)
72 +
73 +src_prepare() {
74 + default
75 + eautoreconf
76 +}
77 +
78 +src_configure() {
79 + econf --enable-linux-multiformat
80 +}
81 +
82 +src_install() {
83 + default
84 + keepdir /var/account
85 + newinitd "${FILESDIR}"/acct.initd-r2 acct
86 + newconfd "${FILESDIR}"/acct.confd-r1 acct
87 + systemd_dounit "${FILESDIR}"/acct.service
88 + insinto /etc/logrotate.d
89 + newins "${FILESDIR}"/acct.logrotate-r1 acct
90 +
91 + # sys-apps/sysvinit already provides this
92 + rm "${ED}"/usr/bin/last "${ED}"/usr/share/man/man1/last.1 || die
93 +
94 + # accton in / is only a temp workaround for #239748
95 + dodir /sbin
96 + mv "${ED}"/usr/sbin/accton "${ED}"/sbin/ || die
97 +}
98
99 diff --git a/sys-process/acct/files/acct-6.6.4-cross-compile.patch b/sys-process/acct/files/acct-6.6.4-cross-compile.patch
100 new file mode 100644
101 index 00000000000..c4938d956dd
102 --- /dev/null
103 +++ b/sys-process/acct/files/acct-6.6.4-cross-compile.patch
104 @@ -0,0 +1,220 @@
105 +Don't generate files.h at build-time using an execution test.
106 +
107 +The *_LOC variables are never used in the build itself, but only in the
108 +built code; this means that they don't need to be known to ./configure at
109 +all.
110 +
111 +Since the previous method made acct not cross-compilable at all, this is
112 +much preferred.
113 +
114 +Author: Diego Elio Pettenò <flameeyes@×××××.com>
115 +Upstream: https://savannah.gnu.org/patch/?7473
116 +
117 +--- a/Makefile.am
118 ++++ b/Makefile.am
119 +@@ -69,11 +69,6 @@ SYS_LASTCOMM = @SYS_LASTCOMM@
120 + SYS_AC = @SYS_AC@
121 + SYS_SA = @SYS_SA@
122 +
123 +-WTMP_FILE_LOC = @WTMP_FILE_LOC@
124 +-ACCT_FILE_LOC = @ACCT_FILE_LOC@
125 +-SAVACCT_FILE_LOC = @SAVACCT_FILE_LOC@
126 +-USRACCT_FILE_LOC = @USRACCT_FILE_LOC@
127 +-
128 + compare-ac: ac
129 + @echo
130 + @echo "Running tests for ac"
131 +--- a/configure.ac
132 ++++ b/configure.ac
133 +@@ -229,97 +229,6 @@ AC_CHECK_HEADER(sys/acct.h,
134 + AC_EGREP_HEADER([comp_t],[sys/acct.h],[AC_DEFINE(HAVE_COMP_T, 1, Define if <sys/acct.h> uses the COMP_T type.)])
135 + ) ]
136 + )
137 +-dnl
138 +-dnl find out where utmp/pacct are stored
139 +-dnl
140 +-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
141 +-#include <stdio.h>
142 +-#include <stdlib.h>
143 +-#include <sys/types.h>
144 +-#include <stdint.h> /* GNU/kFreeBSD */
145 +-#include <sys/acct.h>
146 +-#include <utmp.h>
147 +-
148 +-#ifndef WTMP_FILE
149 +-# if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__linux__) \
150 +- || defined(__FreeBSD_kernel__) || defined(__GLIBC__)
151 +-# define WTMP_FILE "/var/log/account/wtmp"
152 +-# else
153 +-# if defined(sun) || defined(AMIX)
154 +-# define WTMP_FILE "/var/adm/wtmp"
155 +-# else
156 +-# if defined(sgi) || defined(SVR4)
157 +-# define WTMP_FILE "/usr/adm/wtmp"
158 +-# else
159 +-# define WTMP_FILE "/usr/adm/wtmp"
160 +-# endif
161 +-# endif
162 +-# endif
163 +-#endif
164 +-
165 +-#ifndef ACCT_FILE
166 +-# if defined(__FreeBSD__) || defined(__linux__) \
167 +- || defined(__FreeBSD_kernel__) || defined(__GLIBC__)
168 +-# define ACCT_FILE "/var/log/account/pacct"
169 +-# else
170 +-# if defined(__NetBSD__)
171 +-# define ACCT_FILE "/var/log/account/acct"
172 +-# else
173 +-# if defined(sun) || defined(AMIX)
174 +-# define ACCT_FILE "/var/adm/pacct"
175 +-# else
176 +-# if defined(sgi) || defined(SVR4) || defined(M_XENIX)
177 +-# define ACCT_FILE "/usr/adm/pacct"
178 +-# else
179 +-# define ACCT_FILE "/usr/adm/acct"
180 +-# endif
181 +-# endif
182 +-# endif
183 +-# endif
184 +-#endif
185 +-
186 +-#ifndef SAVACCT_FILE
187 +-# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__) \
188 +- || defined(__FreeBSD_kernel__) || defined(__GLIBC__)
189 +-# define SAVACCT_FILE "/var/log/account/savacct"
190 +-# else
191 +-# if defined(sun) || defined(AMIX)
192 +-# define SAVACCT_FILE "/var/adm/savacct"
193 +-# else
194 +-# if defined(sgi) || defined(SVR4)
195 +-# define SAVACCT_FILE "/usr/adm/savacct"
196 +-# else
197 +-# define SAVACCT_FILE "/usr/adm/savacct"
198 +-# endif
199 +-# endif
200 +-# endif
201 +-#endif
202 +-
203 +-#ifndef USRACCT_FILE
204 +-# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__) \
205 +- || defined(__FreeBSD_kernel__) || defined(__GLIBC__)
206 +-# define USRACCT_FILE "/var/log/account/usracct"
207 +-# else
208 +-# if defined(sun) || defined(AMIX)
209 +-# define USRACCT_FILE "/var/adm/usracct"
210 +-# else
211 +-# if defined(sgi) || defined(SVR4)
212 +-# define USRACCT_FILE "/usr/adm/usracct"
213 +-# else
214 +-# define USRACCT_FILE "/usr/adm/usracct"
215 +-# endif
216 +-# endif
217 +-# endif
218 +-#endif
219 +-]], [[
220 +- FILE *fp;
221 +- fp = fopen ("locs", "w");
222 +- fprintf (fp, "WTMP_FILE_LOC=%s\n", WTMP_FILE);
223 +- fprintf (fp, "ACCT_FILE_LOC=%s\n", ACCT_FILE);
224 +- fprintf (fp, "SAVACCT_FILE_LOC=%s\n", SAVACCT_FILE);
225 +- fprintf (fp, "USRACCT_FILE_LOC=%s\n", USRACCT_FILE);
226 +- fclose (fp);
227 +-]])],[. ./locs; rm locs],[echo "Error -- could not locate your wtmp and acct files."; exit 1],[echo "Sorry -- you cannot cross-compile this package (FIXME)."; exit 1 ])
228 +
229 + dnl types
230 + AC_TYPE_PID_T dnl for sys/acct.h
231 +@@ -363,12 +272,6 @@ AC_SUBST(ACCTON_MAN)
232 + AC_SUBST(LASTCOMM_MAN)
233 + AC_SUBST(SA_MAN)
234 +
235 +-dnl Substitutions for file locations
236 +-AC_SUBST(WTMP_FILE_LOC)
237 +-AC_SUBST(ACCT_FILE_LOC)
238 +-AC_SUBST(SAVACCT_FILE_LOC)
239 +-AC_SUBST(USRACCT_FILE_LOC)
240 +-
241 + dnl Dump the makefiles and etc.
242 + AC_CONFIG_FILES([Makefile lib/Makefile files.h version.h])
243 + AC_OUTPUT
244 +--- a/files.h.in
245 ++++ b/files.h.in
246 +@@ -30,6 +30,78 @@
247 +
248 + #include <utmp.h>
249 +
250 ++#ifndef WTMP_FILE
251 ++# if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__linux__) \
252 ++ || defined(__FreeBSD_kernel__) || defined(__GLIBC__)
253 ++# define WTMP_FILE "/var/log/account/wtmp"
254 ++# else
255 ++# if defined(sun) || defined(AMIX)
256 ++# define WTMP_FILE "/var/adm/wtmp"
257 ++# else
258 ++# if defined(sgi) || defined(SVR4)
259 ++# define WTMP_FILE "/usr/adm/wtmp"
260 ++# else
261 ++# define WTMP_FILE "/usr/adm/wtmp"
262 ++# endif
263 ++# endif
264 ++# endif
265 ++#endif
266 ++
267 ++#ifndef ACCT_FILE
268 ++# if defined(__FreeBSD__) || defined(__linux__) \
269 ++ || defined(__FreeBSD_kernel__) || defined(__GLIBC__)
270 ++# define ACCT_FILE "/var/log/account/pacct"
271 ++# else
272 ++# if defined(__NetBSD__)
273 ++# define ACCT_FILE "/var/log/account/acct"
274 ++# else
275 ++# if defined(sun) || defined(AMIX)
276 ++# define ACCT_FILE "/var/adm/pacct"
277 ++# else
278 ++# if defined(sgi) || defined(SVR4) || defined(M_XENIX)
279 ++# define ACCT_FILE "/usr/adm/pacct"
280 ++# else
281 ++# define ACCT_FILE "/usr/adm/acct"
282 ++# endif
283 ++# endif
284 ++# endif
285 ++# endif
286 ++#endif
287 ++
288 ++#ifndef SAVACCT_FILE
289 ++# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__) \
290 ++ || defined(__FreeBSD_kernel__) || defined(__GLIBC__)
291 ++# define SAVACCT_FILE "/var/log/account/savacct"
292 ++# else
293 ++# if defined(sun) || defined(AMIX)
294 ++# define SAVACCT_FILE "/var/adm/savacct"
295 ++# else
296 ++# if defined(sgi) || defined(SVR4)
297 ++# define SAVACCT_FILE "/usr/adm/savacct"
298 ++# else
299 ++# define SAVACCT_FILE "/usr/adm/savacct"
300 ++# endif
301 ++# endif
302 ++# endif
303 ++#endif
304 ++
305 ++#ifndef USRACCT_FILE
306 ++# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__) \
307 ++ || defined(__FreeBSD_kernel__) || defined(__GLIBC__)
308 ++# define USRACCT_FILE "/var/log/account/usracct"
309 ++# else
310 ++# if defined(sun) || defined(AMIX)
311 ++# define USRACCT_FILE "/var/adm/usracct"
312 ++# else
313 ++# if defined(sgi) || defined(SVR4)
314 ++# define USRACCT_FILE "/usr/adm/usracct"
315 ++# else
316 ++# define USRACCT_FILE "/usr/adm/usracct"
317 ++# endif
318 ++# endif
319 ++# endif
320 ++#endif
321 ++
322 + #define WTMP_FILE_LOC "@WTMP_FILE_LOC@"
323 + #define ACCT_FILE_LOC "@ACCT_FILE_LOC@"
324 + #define SAVACCT_FILE_LOC "@SAVACCT_FILE_LOC@"
325
326 diff --git a/sys-process/acct/files/acct.confd-r1 b/sys-process/acct/files/acct.confd-r1
327 new file mode 100644
328 index 00000000000..4a05da34bcc
329 --- /dev/null
330 +++ b/sys-process/acct/files/acct.confd-r1
331 @@ -0,0 +1,11 @@
332 +# /etc/conf.d/acct
333 +
334 +# ACCT_LOG specifies the accounting logging file.
335 +# Remember to create it manually if it doesn't yet exist.
336 +#ACCT_LOG="/var/account/pacct"
337 +
338 +# REPORT_OPTS contains arguments for the "sa" command,
339 +# used for console-reporting.
340 +# Please run "sa --help" or "man sa" to get a description
341 +# of available options.
342 +#REPORT_OPTS="--sort-real-time --list-all-names --percentage"
343
344 diff --git a/sys-process/acct/files/acct.initd-r2 b/sys-process/acct/files/acct.initd-r2
345 new file mode 100644
346 index 00000000000..4b3a5f3a50b
347 --- /dev/null
348 +++ b/sys-process/acct/files/acct.initd-r2
349 @@ -0,0 +1,65 @@
350 +#!/sbin/openrc-run
351 +# Copyright 1999-2017 Gentoo Foundation
352 +# Distributed under the terms of the GNU General Public License v2
353 +
354 + : ${ACCT_LOG:=/var/account/pacct}
355 + : ${REPORT_OPTS:="--sort-real-time --list-all-names --percentage"}
356 +
357 +extra_started_commands="report"
358 +
359 +depend() {
360 + need localmount
361 +}
362 +
363 +_checkconfig() {
364 + if [ -z "${ACCT_LOG}" ]; then
365 + eerror "No accounting file specified!"
366 + return 1
367 + fi
368 +
369 + checkpath -f -m 600 "${ACCT_LOG}"
370 +}
371 +
372 +_get_service_value() {
373 + local _name=$1
374 +
375 + local _default_value=
376 + if [ -n "${2}" ]; then
377 + _default_value=$2
378 + fi
379 +
380 + local _service_value=$(service_get_value ${_name})
381 + if [ -n "${_service_value}" ]; then
382 + echo "${_service_value}"
383 + else
384 + echo "${_default_value}"
385 + fi
386 +
387 + return 0
388 +}
389 +
390 +ACCT_LOG=$(_get_service_value ACCT_LOG "${ACCT_LOG}")
391 +
392 +start_pre() {
393 + _checkconfig || return 1
394 +}
395 +
396 +start() {
397 + ebegin "Starting accounting"
398 + accton "${ACCT_LOG}" >/dev/null
399 + eend $?
400 +}
401 +
402 +start_post() {
403 + service_set_value ACCT_LOG "${ACCT_LOG}"
404 +}
405 +
406 +stop() {
407 + ebegin "Stopping accounting"
408 + accton off >/dev/null
409 + eend $?
410 +}
411 +
412 +report() {
413 + sa ${REPORT_OPTS} "${ACCT_LOG}"
414 +}
415
416 diff --git a/sys-process/acct/files/acct.logrotate-r1 b/sys-process/acct/files/acct.logrotate-r1
417 new file mode 100644
418 index 00000000000..3587e5acfa6
419 --- /dev/null
420 +++ b/sys-process/acct/files/acct.logrotate-r1
421 @@ -0,0 +1,18 @@
422 +# Logrotate file for acct
423 +
424 +/var/account/pacct {
425 + compress
426 + delaycompress
427 + notifempty
428 + daily
429 + rotate 31
430 + create 0600 root root
431 + missingok
432 + postrotate
433 + if type -p systemctl 2>&1 1>/dev/null && systemctl is-system-running 2>&1 1>/dev/null ; then
434 + systemctl try-restart acct 1>/dev/null
435 + else
436 + /etc/init.d/acct --quiet --ifstarted restart
437 + fi
438 + endscript
439 +}