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.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 $
 
 # @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

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to