Gentoo Archives: gentoo-commits

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