From: Patrick Ohly <[email protected]> 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. The solution moves imagetypes_getdepends() to image.bbclass because that is the only place where it gets used and rewrites it so that it and generating the image commands use a new common utility method, image_split_type(). 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 <[email protected]> Signed-off-by: Ed Bartosh <[email protected]> --- meta/classes/image.bbclass | 61 +++++++++++++++++++++++++++++----------- meta/classes/image_types.bbclass | 36 +++++------------------- 2 files changed, 52 insertions(+), 45 deletions(-) diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 56a4ddd..7b79e3a 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -142,8 +142,50 @@ inherit ${IMAGE_TYPE_live} IMAGE_TYPE_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi", "qcow2", "hdddirect"], "image-vm", "", d)}' inherit ${IMAGE_TYPE_vm} +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 + + if basetype != type: + # New base type itself might be generated by a conversion command. + basetype, newctypes = image_split_type(basetype, allctypes) + compressiontypes.update(newctypes) + + return (basetype, compressiontypes) + + +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) + adddep(d.getVar('IMAGE_DEPENDS_%s' % basetype, True) , deps) + + depstr = "" + for dep in deps: + depstr += " " + dep + ":do_populate_sysroot" + return depstr + + python () { - deps = " " + imagetypes_getdepends(d) + deps = " " + image_getdepends(d) d.appendVarFlag('do_rootfs', 'depends', deps) deps = "" @@ -308,19 +350,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 +360,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 +379,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: diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 40a4a1b..e2b7ebb 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass @@ -9,35 +9,6 @@ IMAGE_NAME_SUFFIX ??= ".rootfs" # set this value to 2048 (2MiB alignment). IMAGE_ROOTFS_ALIGNMENT ?= "1" -def imagetypes_getdepends(d): - def adddep(depstr, deps): - for i in (depstr or "").split(): - if i not in deps: - deps.append(i) - - deps = [] - 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: - if type in ["vmdk", "vdi", "qcow2", "hdddirect", "live", "iso", "hddimg"]: - type = "ext4" - basetype = type - for ctype in ctypes: - if type.endswith("." + ctype): - 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 = "" - for dep in deps: - depstr += " " + dep + ":do_populate_sysroot" - return depstr - - XZ_COMPRESSION_LEVEL ?= "-e -6" XZ_INTEGRITY_CHECK ?= "crc32" XZ_THREADS ?= "-T 0" @@ -242,6 +213,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 -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
