Skip to contentSkip to conversation

image_types.bbclass: Respect IMAGE_TYPEDEP dependencies

PATCH New Otavio Salvador 1 participant 3 messages Dec 24, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 image_types.bbclass: Respect IMAGE_TYPEDEP dependencies

The IMAGE_TYPEDEP dependencies also need to be taken into account when building an IMAGE_FSTYPE.

---
 meta/classes/image_types.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes/image_types.bbclass +2 -0
index 1b8ceee..71b2ea9 100644
@@ -21,6 +21,8 @@ def imagetypes_getdepends(d):
                 basetype = type[:-len("." + ctype)]
                 adddep(d.getVar("COMPRESS_DEPENDS_%s" % ctype, True), deps)
                 break
+        for typedepends in (d.getVar("IMAGE_TYPEDEP_%s" % basetype, True) or "").split():
+            adddep(d.getVar('IMAGE_DEPENDS_%s' % typedepends, True) , deps)
         adddep(d.getVar('IMAGE_DEPENDS_%s' % basetype, True) , deps)
 
     depstr = ""
Signature · 1 line
2.1.3
#1 lore raw

PATCH v2 2/3 image_types.bbclass: Rework code to map types for 'ext3'

---
 meta/classes/image_types.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/image_types.bbclass +1 -1
index 71b2ea9..02b107c 100644
@@ -13,7 +13,7 @@ def imagetypes_getdepends(d):
     deps = []
     ctypes = d.getVar('COMPRESSIONTYPES', True).split()
     for type in (d.getVar('IMAGE_FSTYPES', True) or "").split():
-        if type == "vmdk" or type == "live" or type == "iso" or type == "hddimg":
+        if type in ["vmdk", "live", "iso", "hddimg"]:
             type = "ext3"
         basetype = type
         for ctype in ctypes:
Signature · 1 line
2.1.3
#2 lore raw

PATCH v2 3/3 lib/oe/image.py: Handle compressed IMAGE_TYPEDEP values

In reply to Otavio Salvador

When computing the dependency graph for the image generation, we need to take into account the compression type and identify the base type it relates to. This allow for a more robust graph generation even when using composed image types.

---
 meta/lib/oe/image.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
meta/lib/oe/image.py +16 -2
index 7e080b0..f9c8f84 100644
@@ -48,11 +48,13 @@ class ImageDepGraph(object):
         graph = dict()
 
         def add_node(node):
+            base_type = self._image_base_type(node)
             deps = (self.d.getVar('IMAGE_TYPEDEP_' + node, True) or "")
-            if deps != "":
+            base_deps = (self.d.getVar('IMAGE_TYPEDEP_' + base_type, True) or "")
+            if deps != "" or base_deps != "":
                 graph[node] = deps
 
-                for dep in deps.split():
+                for dep in deps.split() + base_deps.split():
                     if not dep in graph:
                         add_node(dep)
             else:
@@ -72,6 +74,18 @@ class ImageDepGraph(object):
         for item in remove_list:
             self.graph.pop(item, None)
 
+    def _image_base_type(self, type):
+        ctypes = self.d.getVar('COMPRESSIONTYPES', True).split()
+        if type in ["vmdk", "live", "iso", "hddimg"]:
+            type = "ext3"
+        basetype = type
+        for ctype in ctypes:
+            if type.endswith("." + ctype):
+                basetype = type[:-len("." + ctype)]
+                break
+
+        return basetype
+
     def _compute_dependencies(self):
         """
         returns dict object of nodes with [no_of_depends_on, no_of_depended_by]
Signature · 1 line
2.1.3