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 1Kwl9G-0003od-24 for garchives@archives.gentoo.org; Sun, 02 Nov 2008 22:10:18 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 07767E0221; Sun, 2 Nov 2008 22:10:12 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B0F68E0221 for ; Sun, 2 Nov 2008 22:10:11 +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 D78E4645D9 for ; Sun, 2 Nov 2008 22:10:09 +0000 (UTC) From: Peter Alfredsen To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] Proposed change to base.eclass: EAPI-2 support Date: Mon, 3 Nov 2008 00:08:46 +0200 User-Agent: KMail/1.9.10 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="nextPart1620999.zUmv7e19i6"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200811022308.49072.loki_val@gentoo.org> X-Archives-Salt: eede1a76-81fe-47a8-afba-77fd71d8997e X-Archives-Hash: 439330a161eb63ac045612e7f97b7eab --nextPart1620999.zUmv7e19i6 Content-Type: multipart/mixed; boundary="Boundary-01=_uTiDJJniROS3z1z" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_uTiDJJniROS3z1z Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline The attached patch for bug 238753 makes base.eclass support EAPI 2=20 functions. None of the previous functionality of exported functions is=20 changed, so you can still do base_src_unpack autopatch. It's only the=20 default actions of base_src_compile and base_src_unpack that's affected=20 and only if EAPI=3D2. The case..esac for EXPORT_FUNCTIONS is borrowed=20 from kde4-base. I've not done tree-rebuilds with this, so please give=20 it a thorough review. I'm not entirely happy about the base_src_work=20 and base_src_util function names, so suggestions are welcome. =2D-=20 /PA --Boundary-01=_uTiDJJniROS3z1z Content-Type: text/x-diff; charset="utf-8"; 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-02 22:52:10.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}" 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 debug-print-function $FUNCNAME $* =2D [ -z "$1" ] && base_src_unpack all + + if [ -z "$1" ] + then + case "${EAPI}" in + 2) + base_src_util unpack + ;; + *) + base_src_util all + ;; + esac + else + base_src_util $1 + 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, "compile" if EAPI=3D2. base_src_compile() { =20 debug-print-function $FUNCNAME $* =2D [ -z "$1" ] && base_src_compile all + + if [ -z "$1" ] + then + case "${EAPI}" in + 2) + base_src_work make + ;; + *) + base_src_work all + ;; + esac + else + base_src_work $1 + 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 --Boundary-01=_uTiDJJniROS3z1z-- --nextPart1620999.zUmv7e19i6 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) iEYEABECAAYFAkkOJPEACgkQtEGUx4TfHiS2hgCdHpeM42fqHR8ZeMMp5O+OCcaQ 8RIAn2T48tLAlTr/nb7YIq5wxDvLOGOU =9ARM -----END PGP SIGNATURE----- --nextPart1620999.zUmv7e19i6--