Re: [gentoo-dev] Proposed change to base.eclass: EAPI-2 support
On Sunday 02 November 2008, Peter Alfredsen wrote: The attached patch for bug 238753 makes base.eclass support EAPI 2 functions. Applied -- /PA signature.asc Description: This is a digitally signed message part.
[gentoo-dev] Proposed change to base.eclass: EAPI-2 support
The attached patch for bug 238753 makes base.eclass support EAPI 2 functions. None of the previous functionality of exported functions is changed, so you can still do base_src_unpack autopatch. It's only the default actions of base_src_compile and base_src_unpack that's affected and only if EAPI=2. The case..esac for EXPORT_FUNCTIONS is borrowed from kde4-base. I've not done tree-rebuilds with this, so please give it a thorough review. I'm not entirely happy about the base_src_work and base_src_util function names, so suggestions are welcome. -- /PA --- /usr/portage/eclass/base.eclass 2008-07-17 12:06:27.0 +0200 +++ base.eclass 2008-11-02 22:52:10.0 +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 $ # @ECLASS: base.eclass # @MAINTAINER: -# ??? +# Peter Alfredsen [EMAIL PROTECTED] # # Original author Dan Armak [EMAIL PROTECTED] # @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 functions +# may be exported. inherit eutils +case ${EAPI} in + 2) + EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install + ;; + *) + EXPORT_FUNCTIONS src_unpack src_compile src_install + ;; +esac + DESCRIPTION=Based on the $ECLASS eclass # @FUNCTION: base_src_unpack # @USAGE: [ unpack ] [ patch ] [ autopatch ] [ all ] # @DESCRIPTION: # The base src_unpack function, which is exported. If no argument is given, -# all is assumed. +# all is assumed if EAPI!=2, unpack if EAPI=2. base_src_unpack() { debug-print-function $FUNCNAME $* - [ -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=2. 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 $* cd ${WORKDIR} while [ $1 ]; do @@ -57,28 +103,62 @@ done fi ;; all) debug-print-section all - base_src_unpack unpack autopatch + base_src_util unpack autopatch ;; esac shift done } +# @FUNCTION: base_src_configure +# @DESCRIPTION: +# The base src_prepare function, which is exported when EAPI=2. 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 given, -# all is asasumed. +# all is assumed if EAPI!=2, compile if EAPI=2. base_src_compile() { debug-print-function $FUNCNAME $* - [ -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 $* cd ${S} while [ $1 ]; do @@ -91,11 +171,11 @@ debug-print-section make emake || die died running emake, $FUNCNAME:make ;; all) debug-print-section all - base_src_compile configure make + base_src_work configure make ;; esac shift done signature.asc Description: This is a digitally signed message part.
Re: [gentoo-dev] Proposed change to base.eclass: EAPI-2 support
On Sunday 02 November 2008, Peter Alfredsen wrote: [...] Please just imagine that this is added to the end of the patch: - -EXPORT_FUNCTIONS src_unpack src_compile src_install /me had started hacking on this in-tree, and the first change was removing that line. -- /PA signature.asc Description: This is a digitally signed message part.
Re: [gentoo-dev] Proposed change to base.eclass: EAPI-2 support
On 00:08 Mon 03 Nov , Peter Alfredsen wrote: +case ${EAPI} in + 2) + EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install + ;; + *) + EXPORT_FUNCTIONS src_unpack src_compile src_install + ;; +esac + This eclass needs to do the same thing as the other eclasses that got EAPI=2 patches and default EAPI to 0 when it's not defined, everywhere where it tests the value of EAPI. -- Thanks, Donnie Donnie Berkholz Developer, Gentoo Linux Blog: http://dberkholz.wordpress.com pgpNlXoc32bCu.pgp Description: PGP signature
Re: [gentoo-dev] Proposed change to base.eclass: EAPI-2 support
On 20:49 Sun 02 Nov , Donnie Berkholz wrote: On 00:08 Mon 03 Nov , Peter Alfredsen wrote: +case ${EAPI} in + 2) + EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install + ;; + *) + EXPORT_FUNCTIONS src_unpack src_compile src_install + ;; +esac + This eclass needs to do the same thing as the other eclasses that got EAPI=2 patches and default EAPI to 0 when it's not defined, everywhere where it tests the value of EAPI. Yeah, I realize it might technically work, but it's just asking for breakage in my opinion. Better to be explicit and have the '*' case be for something unexpected instead of an expected case. -- Thanks, Donnie Donnie Berkholz Developer, Gentoo Linux Blog: http://dberkholz.wordpress.com pgpOp3iAdqqL7.pgp Description: PGP signature
Re: [gentoo-dev] Proposed change to base.eclass: EAPI-2 support
On Monday 03 November 2008, Donnie Berkholz wrote: This eclass needs to do the same thing as the other eclasses that got EAPI=2 patches and default EAPI to 0 when it's not defined, everywhere where it tests the value of EAPI. Yes, that makes sense, though grepping for EAPI in eclass/ shows me that not all chose that approach. Updated patch attached. -- /PA --- /usr/portage/eclass/base.eclass 2008-07-17 12:06:27.0 +0200 +++ base.eclass 2008-11-03 06:57:10.0 +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 $ # @ECLASS: base.eclass # @MAINTAINER: -# ??? +# Peter Alfredsen [EMAIL PROTECTED] # # Original author Dan Armak [EMAIL PROTECTED] # @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 functions +# may be exported. inherit eutils +case ${EAPI:-0} in + 2) + EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install + ;; + *) + EXPORT_FUNCTIONS src_unpack src_compile src_install + ;; +esac + DESCRIPTION=Based on the $ECLASS eclass # @FUNCTION: base_src_unpack # @USAGE: [ unpack ] [ patch ] [ autopatch ] [ all ] # @DESCRIPTION: # The base src_unpack function, which is exported. If no argument is given, -# all is assumed. +# all is assumed if EAPI!=2, unpack if EAPI=2. base_src_unpack() { debug-print-function $FUNCNAME $* - [ -z $1 ] base_src_unpack all + + if [ -z $1 ] + then + case ${EAPI:-0} 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=2. 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 $* cd ${WORKDIR} while [ $1 ]; do @@ -57,28 +103,62 @@ done fi ;; all) debug-print-section all - base_src_unpack unpack autopatch + base_src_util unpack autopatch ;; esac shift done } +# @FUNCTION: base_src_configure +# @DESCRIPTION: +# The base src_prepare function, which is exported when EAPI=2. 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 given, -# all is asasumed. +# all is assumed if EAPI!=2, make if EAPI=2. base_src_compile() { debug-print-function $FUNCNAME $* - [ -z $1 ] base_src_compile all + + if [ -z $1 ] + then + case ${EAPI:-0} 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 $* cd ${S} while [ $1 ]; do @@ -91,11 +171,11 @@ debug-print-section make emake || die died running emake, $FUNCNAME:make ;; all) debug-print-section all - base_src_compile configure make + base_src_work configure make ;; esac shift done @@ -129,7 +209,5 @@ shift done } - -EXPORT_FUNCTIONS src_unpack src_compile src_install signature.asc Description: This is a digitally signed message part.