Add support for the new DEFINED_PHASES metadata key which is automatically generated
authorZac Medico <zmedico@gentoo.org>
Sun, 21 Dec 2008 21:41:13 +0000 (21:41 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 21 Dec 2008 21:41:13 +0000 (21:41 -0000)
from the set of phase functions that are defined by the ebuild and any eclasses it
may have inherited.

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

bin/ebuild.sh
pym/portage/__init__.py
pym/portage/cache/flat_list.py
pym/portage/cache/metadata.py

index 7b4fa68689fb1f3a9cd1586ef9b972304cfee4fc..bab8eca2c521e50e642882f8d7af4f5135c9b3d5 100755 (executable)
@@ -2053,12 +2053,38 @@ ebuild_main() {
 
                auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
                        DESCRIPTION KEYWORDS INHERITED IUSE CDEPEND PDEPEND PROVIDE EAPI
-                       PROPERTIES UNUSED_06 UNUSED_05 UNUSED_04
+                       PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04
                        UNUSED_03 UNUSED_02 UNUSED_01"
 
                #the extra $(echo) commands remove newlines
                unset CDEPEND
                [ -n "${EAPI}" ] || EAPI=0
+               local eapi=$EAPI
+
+               # alphabetically ordered by $EBUILD_PHASE value
+               local valid_phases
+               case $eapi in
+                       0|1)
+                               valid_phases="src_compile src_install pkg_nofetch
+                                       pkg_postinst pkg_postrm pkg_preinst pkg_prerm pkg_setup
+                                       src_test src_unpack"
+                               ;;
+                       *)
+                               valid_phases="src_compile src_configure src_install
+                                       pkg_nofetch pkg_postinst pkg_postrm pkg_preinst
+                                       src_prepare pkg_prerm pkg_setup src_test src_unpack"
+                               ;;
+               esac
+
+               DEFINED_PHASES=
+               for f in $valid_phases ; do
+                       if [[ $(type -t $f) = function ]] ; then
+                               f=${f#pkg_}
+                               DEFINED_PHASES+=" ${f#src_}"
+                       fi
+               done
+               [[ -n $DEFINED_PHASES ]] || DEFINED_PHASES=-
+
                if [ -n "${dbkey}" ] ; then
                        > "${dbkey}"
                        for f in ${auxdbkeys} ; do
index 1267efb902ae9c2a5b9c727dacc9aea4c43a4aba..a69ca7a4a2c2badd4b43503dd6d439138f2a10a0 100644 (file)
@@ -7114,7 +7114,7 @@ auxdbkeys=[
        'RESTRICT',  'HOMEPAGE',  'LICENSE',   'DESCRIPTION',
        'KEYWORDS',  'INHERITED', 'IUSE',      'CDEPEND',
        'PDEPEND',   'PROVIDE', 'EAPI',
-       'PROPERTIES', 'UNUSED_06', 'UNUSED_05', 'UNUSED_04',
+       'PROPERTIES', 'DEFINED_PHASES', 'UNUSED_05', 'UNUSED_04',
        'UNUSED_03', 'UNUSED_02', 'UNUSED_01',
        ]
 auxdbkeylen=len(auxdbkeys)
index 65983393f5e91fa974158fdcb1443b93980f1c01..413d4d33d164ad4193f50214be871173af470e5f 100644 (file)
@@ -11,7 +11,7 @@ class database(fs_template.FsBased):
        auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI',
                'RESTRICT',  'HOMEPAGE',  'LICENSE', 'DESCRIPTION',
                'KEYWORDS',  'IUSE', 'CDEPEND',
-               'PDEPEND',   'PROVIDE', 'EAPI', 'PROPERTIES')
+               'PDEPEND',   'PROVIDE', 'EAPI', 'PROPERTIES', 'DEFINED_PHASES')
 
        def __init__(self, label, auxdbkeys, **config):
                super(database,self).__init__(label, auxdbkeys, **config)
index 164761adbd90f09494a088917e357bed1bb0a384..86717e6c528dc576da88d1b4cf2498ccc5d3495a 100644 (file)
@@ -18,7 +18,7 @@ class database(flat_hash.database):
        auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI',
                'RESTRICT',  'HOMEPAGE',  'LICENSE', 'DESCRIPTION',
                'KEYWORDS',  'INHERITED', 'IUSE', 'CDEPEND',
-               'PDEPEND',   'PROVIDE', 'EAPI', 'PROPERTIES')
+               'PDEPEND',   'PROVIDE', 'EAPI', 'PROPERTIES', 'DEFINED_PHASES')
 
        autocommits = True