1 |
This also drops EAPIs < 5 to match toolchain-funcs.eclass. (Its |
2 |
support for EAPI 0 is an implementation detail so crossdev can |
3 |
source it, which is not relevant here.) |
4 |
|
5 |
Signed-off-by: David Michael <fedora.dm0@×××××.com> |
6 |
--- |
7 |
|
8 |
Hi, |
9 |
|
10 |
Here is a simple eclass EAPI cleanup with no dependencies. There are |
11 |
also small tweaks for style consistency. Maybe the deprecated tmpfiles |
12 |
functions ( https://bugs.gentoo.org/740638 ) could be dropped since they |
13 |
have no removal date, unless they're waiting for the big EAPI 5 cleanup. |
14 |
|
15 |
Thanks. |
16 |
|
17 |
David |
18 |
|
19 |
eclass/systemd.eclass | 56 ++++++++++++++++++------------------------- |
20 |
1 file changed, 23 insertions(+), 33 deletions(-) |
21 |
|
22 |
diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass |
23 |
index ab0d6561984..860ba35b35a 100644 |
24 |
--- a/eclass/systemd.eclass |
25 |
+++ b/eclass/systemd.eclass |
26 |
@@ -4,7 +4,7 @@ |
27 |
# @ECLASS: systemd.eclass |
28 |
# @MAINTAINER: |
29 |
# systemd@g.o |
30 |
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7 |
31 |
+# @SUPPORTED_EAPIS: 5 6 7 8 |
32 |
# @BLURB: helper functions to install systemd units |
33 |
# @DESCRIPTION: |
34 |
# This eclass provides a set of functions to install unit files for |
35 |
@@ -24,14 +24,14 @@ |
36 |
# } |
37 |
# @CODE |
38 |
|
39 |
-inherit toolchain-funcs |
40 |
- |
41 |
-case ${EAPI:-0} in |
42 |
- 0|1|2|3|4|5|6|7) ;; |
43 |
- *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established." |
44 |
+case ${EAPI} in |
45 |
+ 5|6|7|8) ;; |
46 |
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; |
47 |
esac |
48 |
|
49 |
-if [[ ${EAPI:-0} == [0123456] ]]; then |
50 |
+inherit toolchain-funcs |
51 |
+ |
52 |
+if [[ ${EAPI} == [56] ]]; then |
53 |
DEPEND="virtual/pkgconfig" |
54 |
else |
55 |
BDEPEND="virtual/pkgconfig" |
56 |
@@ -72,7 +72,6 @@ _systemd_get_systemunitdir() { |
57 |
# ${D}). This function always succeeds, even if systemd is not |
58 |
# installed. |
59 |
systemd_get_systemunitdir() { |
60 |
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= |
61 |
debug-print-function ${FUNCNAME} "${@}" |
62 |
|
63 |
echo "${EPREFIX}$(_systemd_get_systemunitdir)" |
64 |
@@ -82,7 +81,7 @@ systemd_get_systemunitdir() { |
65 |
# @DESCRIPTION: |
66 |
# Deprecated alias for systemd_get_systemunitdir. |
67 |
systemd_get_unitdir() { |
68 |
- [[ ${EAPI} == [012345] ]] || die "${FUNCNAME} is banned in EAPI 6, use systemd_get_systemunitdir instead" |
69 |
+ [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI 6, use systemd_get_systemunitdir instead" |
70 |
|
71 |
systemd_get_systemunitdir |
72 |
} |
73 |
@@ -101,7 +100,6 @@ _systemd_get_userunitdir() { |
74 |
# ${D}). This function always succeeds, even if systemd is not |
75 |
# installed. |
76 |
systemd_get_userunitdir() { |
77 |
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= |
78 |
debug-print-function ${FUNCNAME} "${@}" |
79 |
|
80 |
echo "${EPREFIX}$(_systemd_get_userunitdir)" |
81 |
@@ -121,7 +119,6 @@ _systemd_get_utildir() { |
82 |
# ${D}). This function always succeeds, even if systemd is not |
83 |
# installed. |
84 |
systemd_get_utildir() { |
85 |
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= |
86 |
debug-print-function ${FUNCNAME} "${@}" |
87 |
|
88 |
echo "${EPREFIX}$(_systemd_get_utildir)" |
89 |
@@ -138,10 +135,8 @@ _systemd_get_systemgeneratordir() { |
90 |
# @FUNCTION: systemd_get_systemgeneratordir |
91 |
# @DESCRIPTION: |
92 |
# Output the path for the systemd system generator directory (not including |
93 |
-# ${D}). This function always succeeds, even if systemd is not |
94 |
-# installed. |
95 |
+# ${D}). This function always succeeds, even if systemd is not installed. |
96 |
systemd_get_systemgeneratordir() { |
97 |
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= |
98 |
debug-print-function ${FUNCNAME} "${@}" |
99 |
|
100 |
echo "${EPREFIX}$(_systemd_get_systemgeneratordir)" |
101 |
@@ -150,8 +145,7 @@ systemd_get_systemgeneratordir() { |
102 |
# @FUNCTION: systemd_dounit |
103 |
# @USAGE: <unit>... |
104 |
# @DESCRIPTION: |
105 |
-# Install systemd unit(s). Uses doins, thus it is fatal in EAPI 4 |
106 |
-# and non-fatal in earlier EAPIs. |
107 |
+# Install systemd unit(s). Uses doins, thus it is fatal. |
108 |
systemd_dounit() { |
109 |
debug-print-function ${FUNCNAME} "${@}" |
110 |
|
111 |
@@ -165,8 +159,7 @@ systemd_dounit() { |
112 |
# @FUNCTION: systemd_newunit |
113 |
# @USAGE: <old-name> <new-name> |
114 |
# @DESCRIPTION: |
115 |
-# Install systemd unit with a new name. Uses newins, thus it is fatal |
116 |
-# in EAPI 4 and non-fatal in earlier EAPIs. |
117 |
+# Install systemd unit with a new name. Uses newins, thus it is fatal. |
118 |
systemd_newunit() { |
119 |
debug-print-function ${FUNCNAME} "${@}" |
120 |
|
121 |
@@ -180,8 +173,7 @@ systemd_newunit() { |
122 |
# @FUNCTION: systemd_douserunit |
123 |
# @USAGE: <unit>... |
124 |
# @DESCRIPTION: |
125 |
-# Install systemd user unit(s). Uses doins, thus it is fatal in EAPI 4 |
126 |
-# and non-fatal in earlier EAPIs. |
127 |
+# Install systemd user unit(s). Uses doins, thus it is fatal. |
128 |
systemd_douserunit() { |
129 |
debug-print-function ${FUNCNAME} "${@}" |
130 |
|
131 |
@@ -196,7 +188,7 @@ systemd_douserunit() { |
132 |
# @USAGE: <old-name> <new-name> |
133 |
# @DESCRIPTION: |
134 |
# Install systemd user unit with a new name. Uses newins, thus it |
135 |
-# is fatal in EAPI 4 and non-fatal in earlier EAPIs. |
136 |
+# is fatal. |
137 |
systemd_newuserunit() { |
138 |
debug-print-function ${FUNCNAME} "${@}" |
139 |
|
140 |
@@ -242,11 +234,11 @@ systemd_install_serviced() { |
141 |
# @DESCRIPTION: |
142 |
# Deprecated in favor of tmpfiles.eclass. |
143 |
# |
144 |
-# Install systemd tmpfiles.d files. Uses doins, thus it is fatal |
145 |
-# in EAPI 4 and non-fatal in earlier EAPIs. |
146 |
+# Install systemd tmpfiles.d files. Uses doins, thus it is fatal. |
147 |
systemd_dotmpfilesd() { |
148 |
debug-print-function ${FUNCNAME} "${@}" |
149 |
|
150 |
+ local f |
151 |
for f; do |
152 |
[[ ${f} == *.conf ]] \ |
153 |
|| die 'tmpfiles.d files need to have .conf suffix.' |
154 |
@@ -254,7 +246,7 @@ systemd_dotmpfilesd() { |
155 |
|
156 |
( |
157 |
insopts -m 0644 |
158 |
- insinto /usr/lib/tmpfiles.d/ |
159 |
+ insinto /usr/lib/tmpfiles.d |
160 |
doins "${@}" |
161 |
) |
162 |
} |
163 |
@@ -265,7 +257,7 @@ systemd_dotmpfilesd() { |
164 |
# Deprecated in favor of tmpfiles.eclass. |
165 |
# |
166 |
# Install systemd tmpfiles.d file under a new name. Uses newins, thus it |
167 |
-# is fatal in EAPI 4 and non-fatal in earlier EAPIs. |
168 |
+# is fatal. |
169 |
systemd_newtmpfilesd() { |
170 |
debug-print-function ${FUNCNAME} "${@}" |
171 |
|
172 |
@@ -274,7 +266,7 @@ systemd_newtmpfilesd() { |
173 |
|
174 |
( |
175 |
insopts -m 0644 |
176 |
- insinto /usr/lib/tmpfiles.d/ |
177 |
+ insinto /usr/lib/tmpfiles.d |
178 |
newins "${@}" |
179 |
) |
180 |
} |
181 |
@@ -283,8 +275,7 @@ systemd_newtmpfilesd() { |
182 |
# @USAGE: <target> <service> |
183 |
# @DESCRIPTION: |
184 |
# Enable service in desired target, e.g. install a symlink for it. |
185 |
-# Uses dosym, thus it is fatal in EAPI 4 and non-fatal in earlier |
186 |
-# EAPIs. |
187 |
+# Uses dosym, thus it is fatal. |
188 |
systemd_enable_service() { |
189 |
debug-print-function ${FUNCNAME} "${@}" |
190 |
|
191 |
@@ -307,8 +298,7 @@ systemd_enable_service() { |
192 |
# and name, while the remaining arguments list service units that will |
193 |
# be added to that file. |
194 |
# |
195 |
-# Uses doins, thus it is fatal in EAPI 4 and non-fatal in earlier |
196 |
-# EAPIs. |
197 |
+# Uses doins, thus it is fatal. |
198 |
# |
199 |
# Doc: https://www.freedesktop.org/wiki/Software/systemd/timedated/ |
200 |
systemd_enable_ntpunit() { |
201 |
@@ -363,7 +353,7 @@ systemd_enable_ntpunit() { |
202 |
# argument to this function (`$(systemd_with_unitdir systemdunitdir)'). Please |
203 |
# remember to report a bug upstream as well. |
204 |
systemd_with_unitdir() { |
205 |
- [[ ${EAPI:-0} != [012345] ]] && die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-${1:-systemdsystemunitdir}=\"\$(systemd_get_systemunitdir)\" instead" |
206 |
+ [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-${1:-systemdsystemunitdir}=\"\$(systemd_get_systemunitdir)\" instead" |
207 |
|
208 |
debug-print-function ${FUNCNAME} "${@}" |
209 |
local optname=${1:-systemdsystemunitdir} |
210 |
@@ -380,7 +370,7 @@ systemd_with_unitdir() { |
211 |
# systemd helpers. This function always succeeds. Its output may be quoted |
212 |
# in order to preserve whitespace in paths. |
213 |
systemd_with_utildir() { |
214 |
- [[ ${EAPI:-0} != [012345] ]] && die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-systemdutildir=\"\$(systemd_get_utildir)\" instead" |
215 |
+ [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-systemdutildir=\"\$(systemd_get_utildir)\" instead" |
216 |
|
217 |
debug-print-function ${FUNCNAME} "${@}" |
218 |
|
219 |
@@ -455,7 +445,7 @@ systemd_tmpfiles_create() { |
220 |
[[ ${EBUILD_PHASE} == postinst ]] || die "${FUNCNAME}: Only valid in pkg_postinst" |
221 |
[[ ${#} -gt 0 ]] || die "${FUNCNAME}: Must specify at least one filename" |
222 |
[[ ${ROOT:-/} == / ]] || return 0 |
223 |
- type systemd-tmpfiles &> /dev/null || return 0 |
224 |
+ type systemd-tmpfiles &>/dev/null || return 0 |
225 |
systemd-tmpfiles --create "${@}" |
226 |
} |
227 |
|
228 |
-- |
229 |
2.31.1 |