[OE-core] [PATCH v3 1/4] image.bbclass: fix dependency calculation when using conversion chaining
Ed Bartosh
ed.bartosh at linux.intel.com
Tue Jun 7 14:17:53 UTC 2016
From: Patrick Ohly <patrick.ohly at intel.com>
When using conversion chaining (for example example: .dsk.vdi.xz),
the imagetypes_getdepends() did not properly detect all compression
commands (thus skipping the corresponding COMPRESS_DEPENDS) and
the base type, leading to missing dependencies of the image's do_rootfs
task.
This is not a big problem in practice because in those cases where
conversion chaining is useful (as in the example above), the missing
dependency is qemu-native, which typically gets built anyway.
imagetypes_getdepends() had hard-coded special treatment for certain
image types. This gets replaced with setting the normal IMAGE_DEPENDS
variables for these types.
[YOCTO #9076]
Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
Signed-off-by: Ed Bartosh <eduard.bartosh at intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
meta/classes/image.bbclass | 25 +++++------------
meta/classes/image_types.bbclass | 60 ++++++++++++++++++++++++++++------------
2 files changed, 49 insertions(+), 36 deletions(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 9f4c83f..46a4d03 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -143,7 +143,7 @@ IMAGE_TYPE_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi", "qcow
inherit ${IMAGE_TYPE_vm}
python () {
- deps = " " + imagetypes_getdepends(d)
+ deps = " " + image_getdepends(d)
d.appendVarFlag('do_rootfs', 'depends', deps)
deps = ""
@@ -308,19 +308,6 @@ python () {
ctypes = set(d.getVar('COMPRESSIONTYPES', True).split())
old_overrides = d.getVar('OVERRIDES', 0)
- def _image_base_type(type):
- basetype = type
- for ctype in ctypes:
- if type.endswith("." + ctype):
- basetype = type[:-len("." + ctype)]
- break
-
- if basetype != type:
- # New base type itself might be generated by a conversion command.
- basetype = _image_base_type(basetype)
-
- return basetype
-
basetypes = {}
alltypes = d.getVar('IMAGE_FSTYPES', True).split()
typedeps = {}
@@ -331,7 +318,7 @@ python () {
alltypes.append("debugfs_" + t)
def _add_type(t):
- baset = _image_base_type(t)
+ baset = image_split_type(t, ctypes)[0]
input_t = t
if baset not in basetypes:
basetypes[baset]= []
@@ -350,7 +337,7 @@ python () {
if dep not in alltypes:
alltypes.append(dep)
_add_type(dep)
- basedep = _image_base_type(dep)
+ basedep = image_split_type(dep, ctypes)[0]
typedeps[baset].add(basedep)
if baset != input_t:
@@ -420,8 +407,10 @@ python () {
if type not in alltypes:
rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
- for bt in basetypes[t]:
- gen_conversion_cmds(bt)
+ for type in basetypes[t]:
+ # Probably t == bt, but better check explicitly, perhaps that'll change.
+ bt = image_split_type(type, ctypes)[0]
+ gen_conversion_cmds(bt, type)
localdata.setVar('type', realt)
if t not in alltypes:
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index ea45809..028bc53 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -9,30 +9,47 @@ IMAGE_NAME_SUFFIX ??= ".rootfs"
# set this value to 2048 (2MiB alignment).
IMAGE_ROOTFS_ALIGNMENT ?= "1"
-def imagetypes_getdepends(d):
- def adddep(depstr, deps):
- for d in (depstr or "").split():
- # Add task dependency if not already present
- if ":" not in d:
- d += ":do_populate_sysroot"
- deps.add(d)
+def image_split_type(type, allctypes):
+ '''Returns (basetype, set of compression types in use).'''
+ basetype = type
+ compressiontypes = set()
+ for ctype in allctypes:
+ if type.endswith("." + ctype):
+ basetype = type[:-len("." + ctype)]
+ compressiontypes.add(ctype)
+ break
- fstypes = set((d.getVar('IMAGE_FSTYPES', True) or "").split())
- fstypes |= set((d.getVar('IMAGE_FSTYPES_DEBUGFS', True) or "").split())
+ if basetype != type:
+ # New base type itself might be generated by a conversion command.
+ basetype, newctypes = image_split_type(basetype, allctypes)
+ compressiontypes.update(newctypes)
- deps = set()
- for typestring in fstypes:
- types = typestring.split(".")
- basetype, resttypes = types[0], types[1:]
+ return (basetype, compressiontypes)
- adddep(d.getVar('IMAGE_DEPENDS_%s' % basetype, True) , deps)
+
+def image_getdepends(d):
+ def adddep(depstr, deps):
+ # It is not an error if the dependency was not set,
+ # simply do nothing in that case.
+ for i in (depstr or "").split():
+ if i not in deps:
+ deps.append(i)
+
+ deps = []
+ ctypes = set(d.getVar('COMPRESSIONTYPES', True).split())
+ for type in (d.getVar('IMAGE_FSTYPES', True) or "").split():
+ basetype, compressiontypes = image_split_type(type, ctypes)
+ for ctype in compressiontypes:
+ adddep(d.getVar("COMPRESS_DEPENDS_%s" % ctype, True), deps)
for typedepends in (d.getVar("IMAGE_TYPEDEP_%s" % basetype, True) or "").split():
adddep(d.getVar('IMAGE_DEPENDS_%s' % typedepends, True) , deps)
- for ctype in resttypes:
- adddep(d.getVar("COMPRESS_DEPENDS_%s" % ctype, True), deps)
+ adddep(d.getVar('IMAGE_DEPENDS_%s' % basetype, True) , deps)
+
+ depstr = ""
+ for dep in deps:
+ depstr += " " + dep + ":do_populate_sysroot"
+ return depstr
- # Sort the set so that ordering is consistant
- return " ".join(sorted(deps))
XZ_COMPRESSION_LEVEL ?= "-3"
XZ_INTEGRITY_CHECK ?= "crc32"
@@ -240,6 +257,13 @@ IMAGE_DEPENDS_ubifs = "mtd-utils-native"
IMAGE_DEPENDS_multiubi = "mtd-utils-native"
IMAGE_DEPENDS_wic = "parted-native"
+# Same dependencies as in ext4. image_getdepends() shouldn't
+# have to hard-code this, so just define it normally in
+# variables.
+IMAGE_DEPENDS_live = "${IMAGE_DEPENDS_ext4}"
+IMAGE_DEPENDS_iso = "${IMAGE_DEPENDS_ext4}"
+IMAGE_DEPENDS_hddimg = "${IMAGE_DEPENDS_ext4}"
+
# This variable is available to request which values are suitable for IMAGE_FSTYPES
IMAGE_TYPES = " \
jffs2 jffs2.sum \
--
2.1.4
More information about the Openembedded-core
mailing list