1 |
--- |
2 |
eclass/eutils.eclass | 423 ++++++++++++++++++++++++++------------------------- |
3 |
1 file changed, 213 insertions(+), 210 deletions(-) |
4 |
|
5 |
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass |
6 |
index 5481b7f..5c7d1aa 100644 |
7 |
--- a/eclass/eutils.eclass |
8 |
+++ b/eclass/eutils.eclass |
9 |
@@ -20,50 +20,6 @@ _EUTILS_ECLASS=1 |
10 |
|
11 |
inherit multilib toolchain-funcs |
12 |
|
13 |
-if has "${EAPI:-0}" 0 1 2; then |
14 |
- |
15 |
-# @FUNCTION: epause |
16 |
-# @USAGE: [seconds] |
17 |
-# @DESCRIPTION: |
18 |
-# Sleep for the specified number of seconds (default of 5 seconds). Useful when |
19 |
-# printing a message the user should probably be reading and often used in |
20 |
-# conjunction with the ebeep function. If the EPAUSE_IGNORE env var is set, |
21 |
-# don't wait at all. Defined in EAPIs 0 1 and 2. |
22 |
-epause() { |
23 |
- [[ -z ${EPAUSE_IGNORE} ]] && sleep ${1:-5} |
24 |
-} |
25 |
- |
26 |
-# @FUNCTION: ebeep |
27 |
-# @USAGE: [number of beeps] |
28 |
-# @DESCRIPTION: |
29 |
-# Issue the specified number of beeps (default of 5 beeps). Useful when |
30 |
-# printing a message the user should probably be reading and often used in |
31 |
-# conjunction with the epause function. If the EBEEP_IGNORE env var is set, |
32 |
-# don't beep at all. Defined in EAPIs 0 1 and 2. |
33 |
-ebeep() { |
34 |
- local n |
35 |
- if [[ -z ${EBEEP_IGNORE} ]] ; then |
36 |
- for ((n=1 ; n <= ${1:-5} ; n++)) ; do |
37 |
- echo -ne "\a" |
38 |
- sleep 0.1 &>/dev/null ; sleep 0,1 &>/dev/null |
39 |
- echo -ne "\a" |
40 |
- sleep 1 |
41 |
- done |
42 |
- fi |
43 |
-} |
44 |
- |
45 |
-else |
46 |
- |
47 |
-ebeep() { |
48 |
- ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org" |
49 |
-} |
50 |
- |
51 |
-epause() { |
52 |
- ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org" |
53 |
-} |
54 |
- |
55 |
-fi |
56 |
- |
57 |
# @FUNCTION: eqawarn |
58 |
# @USAGE: [message] |
59 |
# @DESCRIPTION: |
60 |
@@ -663,77 +619,6 @@ epatch() { |
61 |
: # everything worked |
62 |
} |
63 |
|
64 |
-if has "${EAPI:-0}" 0 1 2 3 4 5; then |
65 |
-# @VARIABLE: EPATCH_USER_SOURCE |
66 |
-# @DESCRIPTION: |
67 |
-# Location for user patches, see the epatch_user function. |
68 |
-# Should be set by the user. Don't set this in ebuilds. |
69 |
-: ${EPATCH_USER_SOURCE:=${PORTAGE_CONFIGROOT%/}/etc/portage/patches} |
70 |
- |
71 |
-# @FUNCTION: epatch_user |
72 |
-# @USAGE: |
73 |
-# @DESCRIPTION: |
74 |
-# Applies user-provided patches to the source tree. The patches are |
75 |
-# taken from /etc/portage/patches/<CATEGORY>/<P-PR|P|PN>[:SLOT]/, where the first |
76 |
-# of these three directories to exist will be the one to use, ignoring |
77 |
-# any more general directories which might exist as well. They must end |
78 |
-# in ".patch" to be applied. |
79 |
-# |
80 |
-# User patches are intended for quick testing of patches without ebuild |
81 |
-# modifications, as well as for permanent customizations a user might |
82 |
-# desire. Obviously, there can be no official support for arbitrarily |
83 |
-# patched ebuilds. So whenever a build log in a bug report mentions that |
84 |
-# user patches were applied, the user should be asked to reproduce the |
85 |
-# problem without these. |
86 |
-# |
87 |
-# Not all ebuilds do call this function, so placing patches in the |
88 |
-# stated directory might or might not work, depending on the package and |
89 |
-# the eclasses it inherits and uses. It is safe to call the function |
90 |
-# repeatedly, so it is always possible to add a call at the ebuild |
91 |
-# level. The first call is the time when the patches will be |
92 |
-# applied. |
93 |
-# |
94 |
-# Ideally, this function should be called after gentoo-specific patches |
95 |
-# have been applied, so that their code can be modified as well, but |
96 |
-# before calls to e.g. eautoreconf, as the user patches might affect |
97 |
-# autotool input files as well. |
98 |
-epatch_user() { |
99 |
- [[ $# -ne 0 ]] && die "epatch_user takes no options" |
100 |
- |
101 |
- # Allow multiple calls to this function; ignore all but the first |
102 |
- local applied="${T}/epatch_user.log" |
103 |
- [[ -e ${applied} ]] && return 2 |
104 |
- |
105 |
- # don't clobber any EPATCH vars that the parent might want |
106 |
- local EPATCH_SOURCE check |
107 |
- for check in ${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT}}; do |
108 |
- EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CTARGET}/${check} |
109 |
- [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CHOST}/${check} |
110 |
- [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${check} |
111 |
- if [[ -d ${EPATCH_SOURCE} ]] ; then |
112 |
- EPATCH_SOURCE=${EPATCH_SOURCE} \ |
113 |
- EPATCH_SUFFIX="patch" \ |
114 |
- EPATCH_FORCE="yes" \ |
115 |
- EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." \ |
116 |
- epatch |
117 |
- echo "${EPATCH_SOURCE}" > "${applied}" |
118 |
- has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" epatch_user_death_notice" |
119 |
- return 0 |
120 |
- fi |
121 |
- done |
122 |
- echo "none" > "${applied}" |
123 |
- return 1 |
124 |
-} |
125 |
-# @FUNCTION: epatch_user_death_notice |
126 |
-# @INTERNAL |
127 |
-# @DESCRIPTION: |
128 |
-# Include an explicit notice in the die message itself that user patches were |
129 |
-# applied to this build. |
130 |
-epatch_user_death_notice() { |
131 |
- ewarn "!!! User patches were applied to this build!" |
132 |
-} |
133 |
-fi |
134 |
- |
135 |
# @FUNCTION: emktemp |
136 |
# @USAGE: [temp dir] |
137 |
# @DESCRIPTION: |
138 |
@@ -1521,25 +1406,6 @@ path_exists() { |
139 |
esac |
140 |
} |
141 |
|
142 |
-# @FUNCTION: in_iuse |
143 |
-# @USAGE: <flag> |
144 |
-# @DESCRIPTION: |
145 |
-# Determines whether the given flag is in IUSE. Strips IUSE default prefixes |
146 |
-# as necessary. |
147 |
-# |
148 |
-# Note that this function should not be used in the global scope. |
149 |
-if has "${EAPI:-0}" 0 1 2 3 4 5; then |
150 |
- in_iuse() { |
151 |
- debug-print-function ${FUNCNAME} "${@}" |
152 |
- [[ ${#} -eq 1 ]] || die "Invalid args to ${FUNCNAME}()" |
153 |
- |
154 |
- local flag=${1} |
155 |
- local liuse=( ${IUSE} ) |
156 |
- |
157 |
- has "${flag}" "${liuse[@]#[+-]}" |
158 |
- } |
159 |
-fi |
160 |
- |
161 |
# @FUNCTION: use_if_iuse |
162 |
# @USAGE: <flag> |
163 |
# @DESCRIPTION: |
164 |
@@ -1551,17 +1417,6 @@ use_if_iuse() { |
165 |
use $1 |
166 |
} |
167 |
|
168 |
-# @FUNCTION: usex |
169 |
-# @USAGE: <USE flag> [true output] [false output] [true suffix] [false suffix] |
170 |
-# @DESCRIPTION: |
171 |
-# Proxy to declare usex for package managers or EAPIs that do not provide it |
172 |
-# and use the package manager implementation when available (i.e. EAPI >= 5). |
173 |
-# If USE flag is set, echo [true output][true suffix] (defaults to "yes"), |
174 |
-# otherwise echo [false output][false suffix] (defaults to "no"). |
175 |
-if has "${EAPI:-0}" 0 1 2 3 4; then |
176 |
- usex() { use "$1" && echo "${2-yes}$4" || echo "${3-no}$5" ; } #382963 |
177 |
-fi |
178 |
- |
179 |
# @FUNCTION: prune_libtool_files |
180 |
# @USAGE: [--all|--modules] |
181 |
# @DESCRIPTION: |
182 |
@@ -1708,71 +1563,6 @@ prune_libtool_files() { |
183 |
fi |
184 |
} |
185 |
|
186 |
-# @FUNCTION: einstalldocs |
187 |
-# @DESCRIPTION: |
188 |
-# Install documentation using DOCS and HTML_DOCS. |
189 |
-# |
190 |
-# If DOCS is declared and non-empty, all files listed in it are |
191 |
-# installed. The files must exist, otherwise the function will fail. |
192 |
-# In EAPI 4 and subsequent EAPIs DOCS may specify directories as well, |
193 |
-# in other EAPIs using directories is unsupported. |
194 |
-# |
195 |
-# If DOCS is not declared, the files matching patterns given |
196 |
-# in the default EAPI implementation of src_install will be installed. |
197 |
-# If this is undesired, DOCS can be set to empty value to prevent any |
198 |
-# documentation from being installed. |
199 |
-# |
200 |
-# If HTML_DOCS is declared and non-empty, all files and/or directories |
201 |
-# listed in it are installed as HTML docs (using dohtml). |
202 |
-# |
203 |
-# Both DOCS and HTML_DOCS can either be an array or a whitespace- |
204 |
-# separated list. Whenever directories are allowed, '<directory>/.' may |
205 |
-# be specified in order to install all files within the directory |
206 |
-# without creating a sub-directory in docdir. |
207 |
-# |
208 |
-# Passing additional options to dodoc and dohtml is not supported. |
209 |
-# If you needed such a thing, you need to call those helpers explicitly. |
210 |
-if has "${EAPI:-0}" 0 1 2 3 4 5; then |
211 |
- einstalldocs() { |
212 |
- debug-print-function ${FUNCNAME} "${@}" |
213 |
- |
214 |
- local dodoc_opts=-r |
215 |
- has ${EAPI} 0 1 2 3 && dodoc_opts= |
216 |
- |
217 |
- if ! declare -p DOCS &>/dev/null ; then |
218 |
- local d |
219 |
- for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \ |
220 |
- THANKS BUGS FAQ CREDITS CHANGELOG ; do |
221 |
- if [[ -s ${d} ]] ; then |
222 |
- dodoc "${d}" || die |
223 |
- fi |
224 |
- done |
225 |
- elif [[ $(declare -p DOCS) == "declare -a"* ]] ; then |
226 |
- if [[ ${DOCS[@]} ]] ; then |
227 |
- dodoc ${dodoc_opts} "${DOCS[@]}" || die |
228 |
- fi |
229 |
- else |
230 |
- if [[ ${DOCS} ]] ; then |
231 |
- dodoc ${dodoc_opts} ${DOCS} || die |
232 |
- fi |
233 |
- fi |
234 |
- |
235 |
- if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]] ; then |
236 |
- if [[ ${HTML_DOCS[@]} ]] ; then |
237 |
- dohtml -r "${HTML_DOCS[@]}" || die |
238 |
- fi |
239 |
- else |
240 |
- if [[ ${HTML_DOCS} ]] ; then |
241 |
- dohtml -r ${HTML_DOCS} || die |
242 |
- fi |
243 |
- fi |
244 |
- |
245 |
- return 0 |
246 |
- } |
247 |
-fi |
248 |
- |
249 |
-check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; } |
250 |
- |
251 |
# @FUNCTION: optfeature |
252 |
# @USAGE: <short description> <package atom to match> [other atoms] |
253 |
# @DESCRIPTION: |
254 |
@@ -1819,3 +1609,216 @@ optfeature() { |
255 |
} |
256 |
|
257 |
fi |
258 |
+ |
259 |
+check_license() { |
260 |
+ die "you no longer need this as portage supports ACCEPT_LICENSE itself" |
261 |
+} |
262 |
+ |
263 |
+if has "${EAPI:-0}" 0 1 2; then |
264 |
+ |
265 |
+# @FUNCTION: epause |
266 |
+# @USAGE: [seconds] |
267 |
+# @DESCRIPTION: |
268 |
+# Sleep for the specified number of seconds (default of 5 seconds). Useful when |
269 |
+# printing a message the user should probably be reading and often used in |
270 |
+# conjunction with the ebeep function. If the EPAUSE_IGNORE env var is set, |
271 |
+# don't wait at all. Defined in EAPIs 0 1 and 2. |
272 |
+epause() { |
273 |
+ [[ -z ${EPAUSE_IGNORE} ]] && sleep ${1:-5} |
274 |
+} |
275 |
+ |
276 |
+# @FUNCTION: ebeep |
277 |
+# @USAGE: [number of beeps] |
278 |
+# @DESCRIPTION: |
279 |
+# Issue the specified number of beeps (default of 5 beeps). Useful when |
280 |
+# printing a message the user should probably be reading and often used in |
281 |
+# conjunction with the epause function. If the EBEEP_IGNORE env var is set, |
282 |
+# don't beep at all. Defined in EAPIs 0 1 and 2. |
283 |
+ebeep() { |
284 |
+ local n |
285 |
+ if [[ -z ${EBEEP_IGNORE} ]] ; then |
286 |
+ for ((n=1 ; n <= ${1:-5} ; n++)) ; do |
287 |
+ echo -ne "\a" |
288 |
+ sleep 0.1 &>/dev/null ; sleep 0,1 &>/dev/null |
289 |
+ echo -ne "\a" |
290 |
+ sleep 1 |
291 |
+ done |
292 |
+ fi |
293 |
+} |
294 |
+ |
295 |
+else |
296 |
+ |
297 |
+ebeep() { |
298 |
+ ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org" |
299 |
+} |
300 |
+ |
301 |
+epause() { |
302 |
+ ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org" |
303 |
+} |
304 |
+ |
305 |
+fi |
306 |
+ |
307 |
+if has "${EAPI:-0}" 0 1 2 3 4; then |
308 |
+ |
309 |
+# @FUNCTION: usex |
310 |
+# @USAGE: <USE flag> [true output] [false output] [true suffix] [false suffix] |
311 |
+# @DESCRIPTION: |
312 |
+# Proxy to declare usex for package managers or EAPIs that do not provide it |
313 |
+# and use the package manager implementation when available (i.e. EAPI >= 5). |
314 |
+# If USE flag is set, echo [true output][true suffix] (defaults to "yes"), |
315 |
+# otherwise echo [false output][false suffix] (defaults to "no"). |
316 |
+usex() { use "$1" && echo "${2-yes}$4" || echo "${3-no}$5" ; } #382963 |
317 |
+ |
318 |
+fi |
319 |
+ |
320 |
+if has "${EAPI:-0}" 0 1 2 3 4 5; then |
321 |
+ |
322 |
+# @VARIABLE: EPATCH_USER_SOURCE |
323 |
+# @DESCRIPTION: |
324 |
+# Location for user patches, see the epatch_user function. |
325 |
+# Should be set by the user. Don't set this in ebuilds. |
326 |
+: ${EPATCH_USER_SOURCE:=${PORTAGE_CONFIGROOT%/}/etc/portage/patches} |
327 |
+ |
328 |
+# @FUNCTION: epatch_user |
329 |
+# @USAGE: |
330 |
+# @DESCRIPTION: |
331 |
+# Applies user-provided patches to the source tree. The patches are |
332 |
+# taken from /etc/portage/patches/<CATEGORY>/<P-PR|P|PN>[:SLOT]/, where the first |
333 |
+# of these three directories to exist will be the one to use, ignoring |
334 |
+# any more general directories which might exist as well. They must end |
335 |
+# in ".patch" to be applied. |
336 |
+# |
337 |
+# User patches are intended for quick testing of patches without ebuild |
338 |
+# modifications, as well as for permanent customizations a user might |
339 |
+# desire. Obviously, there can be no official support for arbitrarily |
340 |
+# patched ebuilds. So whenever a build log in a bug report mentions that |
341 |
+# user patches were applied, the user should be asked to reproduce the |
342 |
+# problem without these. |
343 |
+# |
344 |
+# Not all ebuilds do call this function, so placing patches in the |
345 |
+# stated directory might or might not work, depending on the package and |
346 |
+# the eclasses it inherits and uses. It is safe to call the function |
347 |
+# repeatedly, so it is always possible to add a call at the ebuild |
348 |
+# level. The first call is the time when the patches will be |
349 |
+# applied. |
350 |
+# |
351 |
+# Ideally, this function should be called after gentoo-specific patches |
352 |
+# have been applied, so that their code can be modified as well, but |
353 |
+# before calls to e.g. eautoreconf, as the user patches might affect |
354 |
+# autotool input files as well. |
355 |
+epatch_user() { |
356 |
+ [[ $# -ne 0 ]] && die "epatch_user takes no options" |
357 |
+ |
358 |
+ # Allow multiple calls to this function; ignore all but the first |
359 |
+ local applied="${T}/epatch_user.log" |
360 |
+ [[ -e ${applied} ]] && return 2 |
361 |
+ |
362 |
+ # don't clobber any EPATCH vars that the parent might want |
363 |
+ local EPATCH_SOURCE check |
364 |
+ for check in ${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT}}; do |
365 |
+ EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CTARGET}/${check} |
366 |
+ [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CHOST}/${check} |
367 |
+ [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${check} |
368 |
+ if [[ -d ${EPATCH_SOURCE} ]] ; then |
369 |
+ EPATCH_SOURCE=${EPATCH_SOURCE} \ |
370 |
+ EPATCH_SUFFIX="patch" \ |
371 |
+ EPATCH_FORCE="yes" \ |
372 |
+ EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." \ |
373 |
+ epatch |
374 |
+ echo "${EPATCH_SOURCE}" > "${applied}" |
375 |
+ has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" epatch_user_death_notice" |
376 |
+ return 0 |
377 |
+ fi |
378 |
+ done |
379 |
+ echo "none" > "${applied}" |
380 |
+ return 1 |
381 |
+} |
382 |
+ |
383 |
+# @FUNCTION: epatch_user_death_notice |
384 |
+# @INTERNAL |
385 |
+# @DESCRIPTION: |
386 |
+# Include an explicit notice in the die message itself that user patches were |
387 |
+# applied to this build. |
388 |
+epatch_user_death_notice() { |
389 |
+ ewarn "!!! User patches were applied to this build!" |
390 |
+} |
391 |
+ |
392 |
+# @FUNCTION: einstalldocs |
393 |
+# @DESCRIPTION: |
394 |
+# Install documentation using DOCS and HTML_DOCS. |
395 |
+# |
396 |
+# If DOCS is declared and non-empty, all files listed in it are |
397 |
+# installed. The files must exist, otherwise the function will fail. |
398 |
+# In EAPI 4 and subsequent EAPIs DOCS may specify directories as well, |
399 |
+# in other EAPIs using directories is unsupported. |
400 |
+# |
401 |
+# If DOCS is not declared, the files matching patterns given |
402 |
+# in the default EAPI implementation of src_install will be installed. |
403 |
+# If this is undesired, DOCS can be set to empty value to prevent any |
404 |
+# documentation from being installed. |
405 |
+# |
406 |
+# If HTML_DOCS is declared and non-empty, all files and/or directories |
407 |
+# listed in it are installed as HTML docs (using dohtml). |
408 |
+# |
409 |
+# Both DOCS and HTML_DOCS can either be an array or a whitespace- |
410 |
+# separated list. Whenever directories are allowed, '<directory>/.' may |
411 |
+# be specified in order to install all files within the directory |
412 |
+# without creating a sub-directory in docdir. |
413 |
+# |
414 |
+# Passing additional options to dodoc and dohtml is not supported. |
415 |
+# If you needed such a thing, you need to call those helpers explicitly. |
416 |
+einstalldocs() { |
417 |
+ debug-print-function ${FUNCNAME} "${@}" |
418 |
+ |
419 |
+ local dodoc_opts=-r |
420 |
+ has ${EAPI} 0 1 2 3 && dodoc_opts= |
421 |
+ |
422 |
+ if ! declare -p DOCS &>/dev/null ; then |
423 |
+ local d |
424 |
+ for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \ |
425 |
+ THANKS BUGS FAQ CREDITS CHANGELOG ; do |
426 |
+ if [[ -s ${d} ]] ; then |
427 |
+ dodoc "${d}" || die |
428 |
+ fi |
429 |
+ done |
430 |
+ elif [[ $(declare -p DOCS) == "declare -a"* ]] ; then |
431 |
+ if [[ ${DOCS[@]} ]] ; then |
432 |
+ dodoc ${dodoc_opts} "${DOCS[@]}" || die |
433 |
+ fi |
434 |
+ else |
435 |
+ if [[ ${DOCS} ]] ; then |
436 |
+ dodoc ${dodoc_opts} ${DOCS} || die |
437 |
+ fi |
438 |
+ fi |
439 |
+ |
440 |
+ if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]] ; then |
441 |
+ if [[ ${HTML_DOCS[@]} ]] ; then |
442 |
+ dohtml -r "${HTML_DOCS[@]}" || die |
443 |
+ fi |
444 |
+ else |
445 |
+ if [[ ${HTML_DOCS} ]] ; then |
446 |
+ dohtml -r ${HTML_DOCS} || die |
447 |
+ fi |
448 |
+ fi |
449 |
+ |
450 |
+ return 0 |
451 |
+} |
452 |
+ |
453 |
+# @FUNCTION: in_iuse |
454 |
+# @USAGE: <flag> |
455 |
+# @DESCRIPTION: |
456 |
+# Determines whether the given flag is in IUSE. Strips IUSE default prefixes |
457 |
+# as necessary. |
458 |
+# |
459 |
+# Note that this function should not be used in the global scope. |
460 |
+in_iuse() { |
461 |
+ debug-print-function ${FUNCNAME} "${@}" |
462 |
+ [[ ${#} -eq 1 ]] || die "Invalid args to ${FUNCNAME}()" |
463 |
+ |
464 |
+ local flag=${1} |
465 |
+ local liuse=( ${IUSE} ) |
466 |
+ |
467 |
+ has "${flag}" "${liuse[@]#[+-]}" |
468 |
+} |
469 |
+ |
470 |
+fi |
471 |
-- |
472 |
2.6.3 |