public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Proposed change to base.eclass: EAPI-2 support
@ 2008-11-02 22:08 Peter Alfredsen
  2008-11-02 22:23 ` Peter Alfredsen
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Peter Alfredsen @ 2008-11-02 22:08 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 578 bytes --]

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

[-- Attachment #1.2: base.eclass.patch --]
[-- Type: text/x-diff, Size: 3709 bytes --]

--- /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 <loki_val@gentoo.org>
 #
 # Original author Dan Armak <danarmak@gentoo.org>
 # @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 #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-11-09 15:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-02 22:08 [gentoo-dev] Proposed change to base.eclass: EAPI-2 support Peter Alfredsen
2008-11-02 22:23 ` Peter Alfredsen
2008-11-03  4:49 ` Donnie Berkholz
2008-11-03  4:51   ` Donnie Berkholz
2008-11-03  6:00   ` Peter Alfredsen
2008-11-03  8:29     ` [gentoo-dev] " Steve Long
2008-11-03 19:53       ` Peter Alfredsen
2008-11-05 18:26         ` Thomas Sachau
2008-11-05 18:45           ` Peter Alfredsen
2008-11-05 20:20             ` Thomas Sachau
2008-11-05 20:54               ` Ciaran McCreesh
2008-11-05 23:06               ` Thomas Anderson
2008-11-06  1:27               ` Thomas Rösner
2008-11-06 13:41                 ` Duncan
2008-11-06  3:07               ` Javier Villavicencio
2008-11-09 15:47 ` [gentoo-dev] " Peter Alfredsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox