[OE-core] [PATCH] classes/packagegroup: Refactor code to be simpler

Ulf Magnusson Ulf.Magnusson at bmw-carit.de
Fri Apr 1 10:53:31 UTC 2016


This was originally going to be a fix for ALLOW_EMPTY not being set on
complementary package groups, but that was already fixed by
d96ea299b3b5a44b1959 (classes/packagegroup: fix dbg/dev/ptest
complementary packages).

Since I also spent some time refactoring the code, I'll submit a patch
(against the latest version) anyway. This version should be a bit
shorter and more readable.
---
 meta/classes/packagegroup.bbclass | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/meta/classes/packagegroup.bbclass b/meta/classes/packagegroup.bbclass
index d56248f..ee7a22d 100644
--- a/meta/classes/packagegroup.bbclass
+++ b/meta/classes/packagegroup.bbclass
@@ -22,19 +22,15 @@ inherit ${@oe.utils.ifelse(d.getVar('PACKAGE_ARCH_EXPANDED', True) == 'all', 'al
 # Also mark all packages as ALLOW_EMPTY
 python () {
     packages = d.getVar('PACKAGES', True).split()
-    for pkg in packages:
-        d.setVar("ALLOW_EMPTY_%s" % pkg, "1")
     if d.getVar('PACKAGEGROUP_DISABLE_COMPLEMENTARY', True) != '1':
-        # Add complementary packagegroups
-        genpackages = []
-        complementary_types = ['-dbg', '-dev']
+        types = ['', '-dbg', '-dev']
         if bb.utils.contains('DISTRO_FEATURES', 'ptest', True, False, d):
-            complementary_types.append('-ptest')
-        for pkg in packages:
-            for postfix in complementary_types:
-                genpackages.append(pkg+postfix)
-                d.setVar("ALLOW_EMPTY_%s" % pkg+postfix, "1")
-        d.setVar('PACKAGES', ' '.join(packages+genpackages))
+            types.append('-ptest')
+        packages = [pkg + suffix for pkg in packages
+                    for suffix in types]
+        d.setVar('PACKAGES', ' '.join(packages))
+    for pkg in packages:
+        d.setVar('ALLOW_EMPTY_%s' % pkg, '1')
 }

 # We don't want to look at shared library dependencies for the
--
2.1.4

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20160401/a914c2bb/attachment-0002.html>


More information about the Openembedded-core mailing list