From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id EB1D81384B4 for ; Sun, 29 Nov 2015 13:31:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 05C1E21C08F; Sun, 29 Nov 2015 13:31:06 +0000 (UTC) Received: from a1www.kph.uni-mainz.de (a1www.kph.uni-mainz.de [134.93.134.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7EE9E21C035 for ; Sun, 29 Nov 2015 13:31:04 +0000 (UTC) Received: from a1i15.kph.uni-mainz.de (a1i15.kph.uni-mainz.de [134.93.134.92]) by a1www.kph.uni-mainz.de (8.14.9/8.14.7) with ESMTP id tATDV283010518 for ; Sun, 29 Nov 2015 14:31:02 +0100 Received: from a1i15.kph.uni-mainz.de (localhost [127.0.0.1]) by a1i15.kph.uni-mainz.de (8.14.8/8.14.2) with ESMTP id tATDV2Ec023882; Sun, 29 Nov 2015 14:31:02 +0100 Received: (from ulm@localhost) by a1i15.kph.uni-mainz.de (8.14.8/8.14.8/Submit) id tATDV2uH023878; Sun, 29 Nov 2015 14:31:02 +0100 Message-ID: <22106.65046.157926.965616@a1i15.kph.uni-mainz.de> Date: Sun, 29 Nov 2015 14:31:02 +0100 To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] [PATCH 2/2] eutils.eclass: Move all deprecated functions to the end. In-Reply-To: <22106.64938.215501.17191@a1i15.kph.uni-mainz.de> References: <22106.64938.215501.17191@a1i15.kph.uni-mainz.de> X-Mailer: VM 8.2.0b under 24.3.1 (x86_64-pc-linux-gnu) From: =?UTF-8?q?Ulrich=20M=C3=BCller?= Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="pgp+signed+iON4fmyzaayDz6U"; micalg=pgp-sha256; protocol="application/pgp-signature" X-Archives-Salt: a4f065cb-ff45-4ded-916c-2738af8ae0ab X-Archives-Hash: 11e39f5608e383b64d252c7a53cfaa9a This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --pgp+signed+iON4fmyzaayDz6U Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit --- eclass/eutils.eclass | 423 ++++++++++++++++++++++++++------------------------- 1 file changed, 213 insertions(+), 210 deletions(-) diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index 5481b7f..5c7d1aa 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -20,50 +20,6 @@ _EUTILS_ECLASS=1 inherit multilib toolchain-funcs -if has "${EAPI:-0}" 0 1 2; then - -# @FUNCTION: epause -# @USAGE: [seconds] -# @DESCRIPTION: -# Sleep for the specified number of seconds (default of 5 seconds). Useful when -# printing a message the user should probably be reading and often used in -# conjunction with the ebeep function. If the EPAUSE_IGNORE env var is set, -# don't wait at all. Defined in EAPIs 0 1 and 2. -epause() { - [[ -z ${EPAUSE_IGNORE} ]] && sleep ${1:-5} -} - -# @FUNCTION: ebeep -# @USAGE: [number of beeps] -# @DESCRIPTION: -# Issue the specified number of beeps (default of 5 beeps). Useful when -# printing a message the user should probably be reading and often used in -# conjunction with the epause function. If the EBEEP_IGNORE env var is set, -# don't beep at all. Defined in EAPIs 0 1 and 2. -ebeep() { - local n - if [[ -z ${EBEEP_IGNORE} ]] ; then - for ((n=1 ; n <= ${1:-5} ; n++)) ; do - echo -ne "\a" - sleep 0.1 &>/dev/null ; sleep 0,1 &>/dev/null - echo -ne "\a" - sleep 1 - done - fi -} - -else - -ebeep() { - ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org" -} - -epause() { - ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org" -} - -fi - # @FUNCTION: eqawarn # @USAGE: [message] # @DESCRIPTION: @@ -663,77 +619,6 @@ epatch() { : # everything worked } -if has "${EAPI:-0}" 0 1 2 3 4 5; then -# @VARIABLE: EPATCH_USER_SOURCE -# @DESCRIPTION: -# Location for user patches, see the epatch_user function. -# Should be set by the user. Don't set this in ebuilds. -: ${EPATCH_USER_SOURCE:=${PORTAGE_CONFIGROOT%/}/etc/portage/patches} - -# @FUNCTION: epatch_user -# @USAGE: -# @DESCRIPTION: -# Applies user-provided patches to the source tree. The patches are -# taken from /etc/portage/patches//[:SLOT]/, where the first -# of these three directories to exist will be the one to use, ignoring -# any more general directories which might exist as well. They must end -# in ".patch" to be applied. -# -# User patches are intended for quick testing of patches without ebuild -# modifications, as well as for permanent customizations a user might -# desire. Obviously, there can be no official support for arbitrarily -# patched ebuilds. So whenever a build log in a bug report mentions that -# user patches were applied, the user should be asked to reproduce the -# problem without these. -# -# Not all ebuilds do call this function, so placing patches in the -# stated directory might or might not work, depending on the package and -# the eclasses it inherits and uses. It is safe to call the function -# repeatedly, so it is always possible to add a call at the ebuild -# level. The first call is the time when the patches will be -# applied. -# -# Ideally, this function should be called after gentoo-specific patches -# have been applied, so that their code can be modified as well, but -# before calls to e.g. eautoreconf, as the user patches might affect -# autotool input files as well. -epatch_user() { - [[ $# -ne 0 ]] && die "epatch_user takes no options" - - # Allow multiple calls to this function; ignore all but the first - local applied="${T}/epatch_user.log" - [[ -e ${applied} ]] && return 2 - - # don't clobber any EPATCH vars that the parent might want - local EPATCH_SOURCE check - for check in ${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT}}; do - EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CTARGET}/${check} - [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CHOST}/${check} - [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${check} - if [[ -d ${EPATCH_SOURCE} ]] ; then - EPATCH_SOURCE=${EPATCH_SOURCE} \ - EPATCH_SUFFIX="patch" \ - EPATCH_FORCE="yes" \ - EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." \ - epatch - echo "${EPATCH_SOURCE}" > "${applied}" - has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" epatch_user_death_notice" - return 0 - fi - done - echo "none" > "${applied}" - return 1 -} -# @FUNCTION: epatch_user_death_notice -# @INTERNAL -# @DESCRIPTION: -# Include an explicit notice in the die message itself that user patches were -# applied to this build. -epatch_user_death_notice() { - ewarn "!!! User patches were applied to this build!" -} -fi - # @FUNCTION: emktemp # @USAGE: [temp dir] # @DESCRIPTION: @@ -1521,25 +1406,6 @@ path_exists() { esac } -# @FUNCTION: in_iuse -# @USAGE: -# @DESCRIPTION: -# Determines whether the given flag is in IUSE. Strips IUSE default prefixes -# as necessary. -# -# Note that this function should not be used in the global scope. -if has "${EAPI:-0}" 0 1 2 3 4 5; then - in_iuse() { - debug-print-function ${FUNCNAME} "${@}" - [[ ${#} -eq 1 ]] || die "Invalid args to ${FUNCNAME}()" - - local flag=${1} - local liuse=( ${IUSE} ) - - has "${flag}" "${liuse[@]#[+-]}" - } -fi - # @FUNCTION: use_if_iuse # @USAGE: # @DESCRIPTION: @@ -1551,17 +1417,6 @@ use_if_iuse() { use $1 } -# @FUNCTION: usex -# @USAGE: [true output] [false output] [true suffix] [false suffix] -# @DESCRIPTION: -# Proxy to declare usex for package managers or EAPIs that do not provide it -# and use the package manager implementation when available (i.e. EAPI >= 5). -# If USE flag is set, echo [true output][true suffix] (defaults to "yes"), -# otherwise echo [false output][false suffix] (defaults to "no"). -if has "${EAPI:-0}" 0 1 2 3 4; then - usex() { use "$1" && echo "${2-yes}$4" || echo "${3-no}$5" ; } #382963 -fi - # @FUNCTION: prune_libtool_files # @USAGE: [--all|--modules] # @DESCRIPTION: @@ -1708,71 +1563,6 @@ prune_libtool_files() { fi } -# @FUNCTION: einstalldocs -# @DESCRIPTION: -# Install documentation using DOCS and HTML_DOCS. -# -# If DOCS is declared and non-empty, all files listed in it are -# installed. The files must exist, otherwise the function will fail. -# In EAPI 4 and subsequent EAPIs DOCS may specify directories as well, -# in other EAPIs using directories is unsupported. -# -# If DOCS is not declared, the files matching patterns given -# in the default EAPI implementation of src_install will be installed. -# If this is undesired, DOCS can be set to empty value to prevent any -# documentation from being installed. -# -# If HTML_DOCS is declared and non-empty, all files and/or directories -# listed in it are installed as HTML docs (using dohtml). -# -# Both DOCS and HTML_DOCS can either be an array or a whitespace- -# separated list. Whenever directories are allowed, '/.' may -# be specified in order to install all files within the directory -# without creating a sub-directory in docdir. -# -# Passing additional options to dodoc and dohtml is not supported. -# If you needed such a thing, you need to call those helpers explicitly. -if has "${EAPI:-0}" 0 1 2 3 4 5; then - einstalldocs() { - debug-print-function ${FUNCNAME} "${@}" - - local dodoc_opts=-r - has ${EAPI} 0 1 2 3 && dodoc_opts= - - if ! declare -p DOCS &>/dev/null ; then - local d - for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \ - THANKS BUGS FAQ CREDITS CHANGELOG ; do - if [[ -s ${d} ]] ; then - dodoc "${d}" || die - fi - done - elif [[ $(declare -p DOCS) == "declare -a"* ]] ; then - if [[ ${DOCS[@]} ]] ; then - dodoc ${dodoc_opts} "${DOCS[@]}" || die - fi - else - if [[ ${DOCS} ]] ; then - dodoc ${dodoc_opts} ${DOCS} || die - fi - fi - - if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]] ; then - if [[ ${HTML_DOCS[@]} ]] ; then - dohtml -r "${HTML_DOCS[@]}" || die - fi - else - if [[ ${HTML_DOCS} ]] ; then - dohtml -r ${HTML_DOCS} || die - fi - fi - - return 0 - } -fi - -check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; } - # @FUNCTION: optfeature # @USAGE: [other atoms] # @DESCRIPTION: @@ -1819,3 +1609,216 @@ optfeature() { } fi + +check_license() { + die "you no longer need this as portage supports ACCEPT_LICENSE itself" +} + +if has "${EAPI:-0}" 0 1 2; then + +# @FUNCTION: epause +# @USAGE: [seconds] +# @DESCRIPTION: +# Sleep for the specified number of seconds (default of 5 seconds). Useful when +# printing a message the user should probably be reading and often used in +# conjunction with the ebeep function. If the EPAUSE_IGNORE env var is set, +# don't wait at all. Defined in EAPIs 0 1 and 2. +epause() { + [[ -z ${EPAUSE_IGNORE} ]] && sleep ${1:-5} +} + +# @FUNCTION: ebeep +# @USAGE: [number of beeps] +# @DESCRIPTION: +# Issue the specified number of beeps (default of 5 beeps). Useful when +# printing a message the user should probably be reading and often used in +# conjunction with the epause function. If the EBEEP_IGNORE env var is set, +# don't beep at all. Defined in EAPIs 0 1 and 2. +ebeep() { + local n + if [[ -z ${EBEEP_IGNORE} ]] ; then + for ((n=1 ; n <= ${1:-5} ; n++)) ; do + echo -ne "\a" + sleep 0.1 &>/dev/null ; sleep 0,1 &>/dev/null + echo -ne "\a" + sleep 1 + done + fi +} + +else + +ebeep() { + ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org" +} + +epause() { + ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org" +} + +fi + +if has "${EAPI:-0}" 0 1 2 3 4; then + +# @FUNCTION: usex +# @USAGE: [true output] [false output] [true suffix] [false suffix] +# @DESCRIPTION: +# Proxy to declare usex for package managers or EAPIs that do not provide it +# and use the package manager implementation when available (i.e. EAPI >= 5). +# If USE flag is set, echo [true output][true suffix] (defaults to "yes"), +# otherwise echo [false output][false suffix] (defaults to "no"). +usex() { use "$1" && echo "${2-yes}$4" || echo "${3-no}$5" ; } #382963 + +fi + +if has "${EAPI:-0}" 0 1 2 3 4 5; then + +# @VARIABLE: EPATCH_USER_SOURCE +# @DESCRIPTION: +# Location for user patches, see the epatch_user function. +# Should be set by the user. Don't set this in ebuilds. +: ${EPATCH_USER_SOURCE:=${PORTAGE_CONFIGROOT%/}/etc/portage/patches} + +# @FUNCTION: epatch_user +# @USAGE: +# @DESCRIPTION: +# Applies user-provided patches to the source tree. The patches are +# taken from /etc/portage/patches//[:SLOT]/, where the first +# of these three directories to exist will be the one to use, ignoring +# any more general directories which might exist as well. They must end +# in ".patch" to be applied. +# +# User patches are intended for quick testing of patches without ebuild +# modifications, as well as for permanent customizations a user might +# desire. Obviously, there can be no official support for arbitrarily +# patched ebuilds. So whenever a build log in a bug report mentions that +# user patches were applied, the user should be asked to reproduce the +# problem without these. +# +# Not all ebuilds do call this function, so placing patches in the +# stated directory might or might not work, depending on the package and +# the eclasses it inherits and uses. It is safe to call the function +# repeatedly, so it is always possible to add a call at the ebuild +# level. The first call is the time when the patches will be +# applied. +# +# Ideally, this function should be called after gentoo-specific patches +# have been applied, so that their code can be modified as well, but +# before calls to e.g. eautoreconf, as the user patches might affect +# autotool input files as well. +epatch_user() { + [[ $# -ne 0 ]] && die "epatch_user takes no options" + + # Allow multiple calls to this function; ignore all but the first + local applied="${T}/epatch_user.log" + [[ -e ${applied} ]] && return 2 + + # don't clobber any EPATCH vars that the parent might want + local EPATCH_SOURCE check + for check in ${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT}}; do + EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CTARGET}/${check} + [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CHOST}/${check} + [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${check} + if [[ -d ${EPATCH_SOURCE} ]] ; then + EPATCH_SOURCE=${EPATCH_SOURCE} \ + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." \ + epatch + echo "${EPATCH_SOURCE}" > "${applied}" + has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" epatch_user_death_notice" + return 0 + fi + done + echo "none" > "${applied}" + return 1 +} + +# @FUNCTION: epatch_user_death_notice +# @INTERNAL +# @DESCRIPTION: +# Include an explicit notice in the die message itself that user patches were +# applied to this build. +epatch_user_death_notice() { + ewarn "!!! User patches were applied to this build!" +} + +# @FUNCTION: einstalldocs +# @DESCRIPTION: +# Install documentation using DOCS and HTML_DOCS. +# +# If DOCS is declared and non-empty, all files listed in it are +# installed. The files must exist, otherwise the function will fail. +# In EAPI 4 and subsequent EAPIs DOCS may specify directories as well, +# in other EAPIs using directories is unsupported. +# +# If DOCS is not declared, the files matching patterns given +# in the default EAPI implementation of src_install will be installed. +# If this is undesired, DOCS can be set to empty value to prevent any +# documentation from being installed. +# +# If HTML_DOCS is declared and non-empty, all files and/or directories +# listed in it are installed as HTML docs (using dohtml). +# +# Both DOCS and HTML_DOCS can either be an array or a whitespace- +# separated list. Whenever directories are allowed, '/.' may +# be specified in order to install all files within the directory +# without creating a sub-directory in docdir. +# +# Passing additional options to dodoc and dohtml is not supported. +# If you needed such a thing, you need to call those helpers explicitly. +einstalldocs() { + debug-print-function ${FUNCNAME} "${@}" + + local dodoc_opts=-r + has ${EAPI} 0 1 2 3 && dodoc_opts= + + if ! declare -p DOCS &>/dev/null ; then + local d + for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \ + THANKS BUGS FAQ CREDITS CHANGELOG ; do + if [[ -s ${d} ]] ; then + dodoc "${d}" || die + fi + done + elif [[ $(declare -p DOCS) == "declare -a"* ]] ; then + if [[ ${DOCS[@]} ]] ; then + dodoc ${dodoc_opts} "${DOCS[@]}" || die + fi + else + if [[ ${DOCS} ]] ; then + dodoc ${dodoc_opts} ${DOCS} || die + fi + fi + + if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]] ; then + if [[ ${HTML_DOCS[@]} ]] ; then + dohtml -r "${HTML_DOCS[@]}" || die + fi + else + if [[ ${HTML_DOCS} ]] ; then + dohtml -r ${HTML_DOCS} || die + fi + fi + + return 0 +} + +# @FUNCTION: in_iuse +# @USAGE: +# @DESCRIPTION: +# Determines whether the given flag is in IUSE. Strips IUSE default prefixes +# as necessary. +# +# Note that this function should not be used in the global scope. +in_iuse() { + debug-print-function ${FUNCNAME} "${@}" + [[ ${#} -eq 1 ]] || die "Invalid args to ${FUNCNAME}()" + + local flag=${1} + local liuse=( ${IUSE} ) + + has "${flag}" "${liuse[@]#[+-]}" +} + +fi -- 2.6.3 --pgp+signed+iON4fmyzaayDz6U Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBCAAGBQJWWv4UAAoJEMMJBoUcYcJzcjoIALXk5BXwnj6VMqTY8jLPjaSx Xy1PNPgYMvHa6Mjvel6KiUcbcYEm046+GW5LryeaRiDEYxswu/CjfTa+RM5KtzDF xvuqrwk8X+1FZAAR9PgOAznLzr4iwWfGwz01LpPhlouNFIMCTDjwSvenxvx1HZqF 9FieOyO7yAlVZ4gYlstL0PLQLm4cnQ1KZ/vnvV4+v4uKclD2g6dwGwRTnd33d2jo pJ98hswcAZwTFtWq1xhczigh0vh5SryDuTzCOXjX3yf++cENmkyY6Mb1Auwt9YTA qhzuHDhNYS1k9w3iX2UX1iwpkYezptjauUFb4+OjmClJF/U/SPch0IJtybnvxsA= =66Kk -----END PGP SIGNATURE----- --pgp+signed+iON4fmyzaayDz6U--