[OE-core] [PATCH 18/22] package.bbclass: Add PACKAGESPLITFUNCS variable

Richard Purdie richard.purdie at linuxfoundation.org
Sun Feb 3 23:55:48 UTC 2013


Prepending to populate_packages is rather ugly and means its hard to trace
errors and also profiling informaiton is summed together in one function.

This patch starts to split out the prepends to become separate functions
to avoid these issues. This is generally a neater way to write functions
than prepending to where there can sometimes be variable scope issues
and we've been bitten by whitespace issues in the past.

Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/kernel.bbclass              |    4 +++-
 meta/classes/package.bbclass             |    6 ++++++
 meta/classes/update-alternatives.bbclass |    4 +++-
 meta/classes/update-rc.d_real.bbclass    |    4 +++-
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 4805944..00117a6 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -301,7 +301,9 @@ if [ x"$D" = "x" ]; then
 fi
 }
 
-python populate_packages_prepend () {
+PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
+
+python split_kernel_packages () {
     import re
 
     modinfoexp = re.compile("([^=]+)=(.*)")
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index c822c43..a09eb15 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1754,6 +1754,9 @@ PACKAGEBUILDPKGD ?= " \
                 ${PACKAGE_PREPROCESS_FUNCS} \
                 split_and_strip_files \
                 fixup_perms \
+                "
+# Functions which split PKGD up into separate packages
+PACKAGESPLITFUNCS ?= " \
                 package_do_split_locales \
                 populate_packages"
 # Functions which process metadata based on split packages
@@ -1793,6 +1796,9 @@ python do_package () {
     for f in (d.getVar('PACKAGEBUILDPKGD', True) or '').split():
         bb.build.exec_func(f, d)
 
+    for f in (d.getVar('PACKAGESPLITFUNCS', True) or '').split():
+        bb.build.exec_func(f, d)
+
     # Build global list of files in each split package
     global pkgfiles
     pkgfiles = {}
diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass
index 90bc56b..147d236 100644
--- a/meta/classes/update-alternatives.bbclass
+++ b/meta/classes/update-alternatives.bbclass
@@ -282,7 +282,9 @@ python perform_packagecopy_append () {
                     bb.warn('%s: Unable to resolve dangling symlink: %s' % (pn, alt_target))
 }
 
-python populate_packages_prepend () {
+PACKAGESPLITFUNCS_prepend = "populate_packages_updateralternatives "
+
+python populate_packages_updatealternatives () {
     pn = d.getVar('BPN', True)
 
     # Do actual update alternatives processing
diff --git a/meta/classes/update-rc.d_real.bbclass b/meta/classes/update-rc.d_real.bbclass
index 0cd671f..f9d55fb 100644
--- a/meta/classes/update-rc.d_real.bbclass
+++ b/meta/classes/update-rc.d_real.bbclass
@@ -47,7 +47,9 @@ python __anonymous() {
     update_rc_after_parse(d)
 }
 
-python populate_packages_prepend () {
+PACKAGESPLITFUNCS_prepend = "populate_packages_updatercd "
+
+python populate_packages_updatercd () {
     def update_rcd_package(pkg):
         bb.debug(1, 'adding update-rc.d calls to postinst/postrm for %s' % pkg)
         """
-- 
1.7.10.4





More information about the Openembedded-core mailing list