[OE-core] [RFC][PATCH 2/7] image.bbclass: support duplicate compression types

Ed Bartosh ed.bartosh at linux.intel.com
Fri May 6 14:58:45 UTC 2016


From: Patrick Ohly <patrick.ohly at intel.com>

When a derived distro adds a certain type, say zip, to
COMPRESSIONTYPES and later OE-core does the same, we end up with the
type being listed twice, and that would have undesired effects
(commands generated twice).

So to support such loosely coupled extension, we de-duplicated the
list of types first.

Alternatively, such a situation could also be treated as error. But that
seems unnecessary because typically commands for the same type will also
do the same thing.

Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
 meta/classes/image.bbclass       | 10 +++++++++-
 meta/classes/image_types.bbclass |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 4542e95..56a4ddd 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -297,7 +297,15 @@ python setup_debugfs () {
 
 python () {
     vardeps = set()
-    ctypes = d.getVar('COMPRESSIONTYPES', True).split()
+    # We allow COMPRESSIONTYPES to have duplicates. That avoids breaking
+    # derived distros when OE-core or some other layer independently adds
+    # the same type. There is still only one command for each type, but
+    # presumably the commands will do the same when the type is the same,
+    # even when added in different places.
+    #
+    # Without de-duplication, gen_conversion_cmds() below
+    # would create the same compression command multiple times.
+    ctypes = set(d.getVar('COMPRESSIONTYPES', True).split())
     old_overrides = d.getVar('OVERRIDES', 0)
 
     def _image_base_type(type):
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index d13bdf5..40a4a1b 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -16,7 +16,7 @@ def imagetypes_getdepends(d):
                 deps.append(i)
 
     deps = []
-    ctypes = d.getVar('COMPRESSIONTYPES', True).split()
+    ctypes = set(d.getVar('COMPRESSIONTYPES', True).split())
     fstypes = set((d.getVar('IMAGE_FSTYPES', True) or "").split())
     fstypes |= set((d.getVar('IMAGE_FSTYPES_DEBUGFS', True) or "").split())
     for type in fstypes:
-- 
2.1.4




More information about the Openembedded-core mailing list