From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Kx5WJ-0008CR-9W for garchives@archives.gentoo.org; Mon, 03 Nov 2008 19:55:28 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 78A00E02DA; Mon, 3 Nov 2008 19:55:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 2B9C1E02DA for ; Mon, 3 Nov 2008 19:55:26 +0000 (UTC) Received: from 0x3ef266d2.svgnxx4.dynamic.dsl.tele.dk (0x3ef266d2.svgnxx4.dynamic.dsl.tele.dk [62.242.102.210]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id 394426463A for ; Mon, 3 Nov 2008 19:55:24 +0000 (UTC) From: Peter Alfredsen To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] Re: Proposed change to base.eclass: EAPI-2 support Date: Mon, 3 Nov 2008 21:53:55 +0200 User-Agent: KMail/1.9.10 References: <200811022308.49072.loki_val@gentoo.org> <200811030700.34515.loki_val@gentoo.org> In-Reply-To: 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="nextPart1583593.hchHthXntH"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200811032053.59249.loki_val@gentoo.org> X-Archives-Salt: e7af9110-156e-4cab-b180-370d61b18828 X-Archives-Hash: fbca94489aff2d0afd409d7ce26da93d --nextPart1583593.hchHthXntH Content-Type: multipart/mixed; boundary="Boundary-01=_Tb1DJX5qvNHL64M" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_Tb1DJX5qvNHL64M Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Monday 03 November 2008, Steve Long wrote: > Peter Alfredsen wrote: > > debug-print-function $FUNCNAME $* > > You should be using "$@" not unquoted $*. =46ixed. Also fixed base_src_unpack and base_src_compile calling their=20 grunt functions with $1, when clearly it should have been $@. > Seems like the FUNCNAME bit should just be rolled into the function > with "${FUNCNAME[1]}" which could be done tree-wide quite easily. I guess that function was written before bash-3 when FUNCNAME was turned=20 into an array. =2D-=20 /PA --Boundary-01=_Tb1DJX5qvNHL64M Content-Type: text/x-diff; charset="iso-8859-1"; name="base.eclass.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="base.eclass.patch" =2D-- /usr/portage/eclass/base.eclass 2008-07-17 12:06:27.000000000 +0200 +++ base.eclass 2008-11-03 20:45:44.000000000 +0100 @@ -2,32 +2,78 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.34 2008/07/17 09= :49:14 pva Exp $ =20 # @ECLASS: base.eclass # @MAINTAINER: =2D# ??? +# Peter Alfredsen # # Original author Dan Armak # @BLURB: The base eclass defines some default functions and variables. # @DESCRIPTION: # The base eclass defines some default functions and variables. Nearly # everything else inherits from here. +# +# NOTE: You must define EAPI before inheriting from base, or the wrong fun= ctions +# may be exported. =20 =20 inherit eutils =20 +case "${EAPI:-0}" in + 2) + EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_in= stall + ;; + *) + EXPORT_FUNCTIONS src_unpack src_compile src_install + ;; +esac + DESCRIPTION=3D"Based on the $ECLASS eclass" =20 # @FUNCTION: base_src_unpack # @USAGE: [ unpack ] [ patch ] [ autopatch ] [ all ] # @DESCRIPTION: # The base src_unpack function, which is exported. If no argument is given, =2D# "all" is assumed. +# "all" is assumed if EAPI!=3D2, "unpack" if EAPI=3D2. base_src_unpack() { =20 =2D debug-print-function $FUNCNAME $* =2D [ -z "$1" ] && base_src_unpack all + debug-print-function $FUNCNAME "$@" + + if [ -z "$1" ] + then + case "${EAPI:-0}" in + 2) + base_src_util unpack + ;; + *) + base_src_util all + ;; + esac + else + base_src_util $@ + fi +} + +# @FUNCTION: base_src_prepare +# @DESCRIPTION: +# The base src_prepare function, which is exported when EAPI=3D2. Performs +# "base_src_util autopatch". +base_src_prepare() { + + debug-print-function $FUNCNAME "$@" + + base_src_util autopatch +} + +# @FUNCTION: base_src_util +# @USAGE: [ unpack ] [ patch ] [ autopatch ] [ all ] +# @DESCRIPTION: +# The base_src_util function is the grunt function for base src_unpack +# and base src_prepare. +base_src_util() { + + debug-print-function $FUNCNAME "$@" =20 cd "${WORKDIR}" =20 while [ "$1" ]; do =20 @@ -57,28 +103,62 @@ done fi ;; all) debug-print-section all =2D base_src_unpack unpack autopatch + base_src_util unpack autopatch ;; esac =20 shift done =20 } =20 +# @FUNCTION: base_src_configure +# @DESCRIPTION: +# The base src_prepare function, which is exported when EAPI=3D2. Performs +# "base_src_work configure". +base_src_configure() { + + debug-print-function $FUNCNAME "$@" + + base_src_work configure +} + # @FUNCTION: base_src_compile # @USAGE: [ configure ] [ make ] [ all ] # @DESCRIPTION: # The base src_compile function, which is exported. If no argument is give= n, =2D# "all" is asasumed. +# "all" is assumed if EAPI!=3D2, "make" if EAPI=3D2. base_src_compile() { =20 =2D debug-print-function $FUNCNAME $* =2D [ -z "$1" ] && base_src_compile all + debug-print-function $FUNCNAME "$@" + + if [ -z "$1" ] + then + case "${EAPI:-0}" in + 2) + base_src_work make + ;; + *) + base_src_work all + ;; + esac + else + base_src_work $@ + fi +} + +# @FUNCTION: base_src_work +# @USAGE: [ configure ] [ make ] [ all ] +# @DESCRIPTION: +# The base_src_work function is the grunt function for base src_configure +# and base src_compile. +base_src_work() { + + debug-print-function $FUNCNAME "$@" =20 cd "${S}" =20 while [ "$1" ]; do =20 @@ -91,11 +171,11 @@ debug-print-section make emake || die "died running emake, $FUNCNAME:make" ;; all) debug-print-section all =2D base_src_compile configure make + base_src_work configure make ;; esac =20 shift done @@ -107,11 +187,11 @@ # @DESCRIPTION: # The base src_install function, which is exported. If no argument is give= n, # "all" is assumed. base_src_install() { =20 =2D debug-print-function $FUNCNAME $* + debug-print-function $FUNCNAME "$@" [ -z "$1" ] && base_src_install all =20 cd "${S}" =20 while [ "$1" ]; do @@ -129,7 +209,5 @@ =20 shift done =20 } =2D =2DEXPORT_FUNCTIONS src_unpack src_compile src_install --Boundary-01=_Tb1DJX5qvNHL64M-- --nextPart1583593.hchHthXntH Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEABECAAYFAkkPVtcACgkQtEGUx4TfHiQiNwCfc9oei4MaTg/PRXReZitGdNoy 8TEAoI+bLZx78DQc8xBggGoswUeyf8tq =4cWn -----END PGP SIGNATURE----- --nextPart1583593.hchHthXntH--