Add support in EAPI 2_pre2 for a function named "default" is redefined for
authorZac Medico <zmedico@gentoo.org>
Thu, 7 Aug 2008 12:50:08 +0000 (12:50 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 7 Aug 2008 12:50:08 +0000 (12:50 -0000)
each phase so that it will call the default_* function corresponding to the
current phase. Thanks to Thomas Anderson <gentoofan23> for the initial
patch.

svn path=/main/trunk/; revision=11342

bin/ebuild.sh
doc/package/ebuild/eapi/2.docbook

index fe9adc02c96fc57021d721903b7b43c065801c4f..b7612a3843a43e6251170df329fbeef9cbbc4dfe 100755 (executable)
@@ -1373,12 +1373,21 @@ source_all_bashrcs() {
                [[ $(type -t src_configure) = function ]] || \
                        src_configure() { _default_src_configure "$@" ; }
 
+               default() {
+                       _default_${EBUILD_PHASE}
+               }
+
        else
                for x in $default_phases ; do
                        eval "default_$x() {
                                die \"default_$x() is not supported with EAPI='$EAPI'\"
                        }"
                done
+
+               default() {
+                       die "default() is not supported with EAPI='$EAPI'"
+               }
+
        fi
 
        local OCC="${CC}" OCXX="${CXX}"
index dc2e0dc0a51b8d8e03968f1b42eff6b17ea15fc1..275ab71ef0c0e4bce3a573e159f0081adb51fff8 100644 (file)
                        implementation.
                        </para>
                </sect3>
+               <sect3 id='package-ebuild-eapi-2-phases-default-function-alias'>
+                       <title>Default Phase Function Alias</title>
+                       <para>
+                       A function named "default" is redefined for each phase so that it
+                       will call the default_* function corresponding to the current phase.
+                       For example, a call to the function named "default" during the
+                       src_compile phase is equivalent to a call to the function named
+                       default_src_compile.
+                       </para>
+               </sect3>
        </sect2>
 </sect1>