Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Mon, 01 Jan 2018 10:35:01
Message-Id: 1514802884.4feccc918d676aa859f4c989456127dd69dbc7d3.mgorny@gentoo
1 commit: 4feccc918d676aa859f4c989456127dd69dbc7d3
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 30 18:39:57 2017 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 1 10:34:44 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4feccc91
7
8 tmpfiles.eclass: Support using on non-Linux systems
9
10 Fix the eclass code to remove the misguided Linux conditionals.
11 The whole purpose of the eclass was to avoid having to implement
12 fallback logic for systems not having service manager tmpfiles.d
13 support. Making it conditional to Linux implied that for non-Linux
14 systems (Prefix, FreeBSD) we would have to implement explicit fallback
15 to create the necessary directories.
16
17 While systemd (and therefore systemd-tmpfilesd) is indeed
18 Linux-specific, the opentmpfiles implementation should be pretty
19 portable and there is no reason to restrict it to Linux only, or to
20 prevent using it on non-Linux OpenRC (and non-OpenRC) systems.
21
22 eclass/tmpfiles.eclass | 17 ++++++++++-------
23 1 file changed, 10 insertions(+), 7 deletions(-)
24
25 diff --git a/eclass/tmpfiles.eclass b/eclass/tmpfiles.eclass
26 index 2a158c482a5..49c3cba6bdd 100644
27 --- a/eclass/tmpfiles.eclass
28 +++ b/eclass/tmpfiles.eclass
29 @@ -1,4 +1,4 @@
30 -# Copyright 1999-2016 Gentoo Foundation
31 +# Copyright 1999-2018 Gentoo Foundation
32 # Distributed under the terms of the GNU General Public License v2
33
34 # @ECLASS: tmpfiles.eclass
35 @@ -17,10 +17,16 @@
36 # https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
37 #
38 # The dotmpfiles and newtmpfiles functions are used to install
39 -# configuration files into /usr/lib/tmpfiles.d, then in pkg_postinst, the
40 -# tmpfiles_process function can be called to process the newly
41 +# configuration files into /usr/lib/tmpfiles.d, then in pkg_postinst,
42 +# the tmpfiles_process function must be called to process the newly
43 # installed tmpfiles.d entries.
44 #
45 +# The tmpfiles.d files can be used by service managers to recreate/clean
46 +# up temporary directories on boot or periodically. Additionally,
47 +# the pkg_postinst() call ensures that the directories are created
48 +# on systems that do not support tmpfiles.d natively, without a need
49 +# for explicit fallback.
50 +#
51 # @EXAMPLE:
52 # Typical usage of this eclass:
53 #
54 @@ -53,7 +59,7 @@ case "${EAPI}" in
55 *) die "API is undefined for EAPI ${EAPI}" ;;
56 esac
57
58 -RDEPEND="kernel_linux? ( virtual/tmpfiles )"
59 +RDEPEND="virtual/tmpfiles"
60
61 # @FUNCTION: dotmpfiles
62 # @USAGE: dotmpfiles <tmpfiles.d_file> ...
63 @@ -62,7 +68,6 @@ RDEPEND="kernel_linux? ( virtual/tmpfiles )"
64 dotmpfiles() {
65 debug-print-function "${FUNCNAME}" "$@"
66
67 - use kernel_linux || return 0
68 local f
69 for f; do
70 if [[ ${f} != *.conf ]]; then
71 @@ -83,7 +88,6 @@ dotmpfiles() {
72 newtmpfiles() {
73 debug-print-function "${FUNCNAME}" "$@"
74
75 - use kernel_linux || return 0
76 if [[ $2 != *.conf ]]; then
77 die "tmpfiles.d files must end with .conf"
78 fi
79 @@ -102,7 +106,6 @@ newtmpfiles() {
80 tmpfiles_process() {
81 debug-print-function "${FUNCNAME}" "$@"
82
83 - use kernel_linux || return 0
84 [[ ${EBUILD_PHASE} == postinst ]] || die "${FUNCNAME}: Only valid in pkg_postinst"
85 [[ ${#} -gt 0 ]] || die "${FUNCNAME}: Must specify at least one filename"