aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/image.bbclass27
1 files changed, 24 insertions, 3 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 8b6c30bce8..c61d8140c5 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -303,6 +303,10 @@ python () {
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 = {}
@@ -379,18 +383,35 @@ python () {
bb.fatal("No IMAGE_CMD defined for IMAGE_FSTYPES entry '%s' - possibly invalid type name or missing support class" % t)
cmds.append(localdata.expand("\tcd ${DEPLOY_DIR_IMAGE}"))
- for bt in basetypes[t]:
+ rm_tmp_images = set()
+ def gen_conversion_cmds(bt):
for ctype in ctypes:
if bt.endswith("." + ctype):
+ type = bt[0:-len(ctype) - 1]
+ # Create input image first.
+ gen_conversion_cmds(type)
+ localdata.setVar('type', type)
cmds.append("\t" + localdata.getVar("COMPRESS_CMD_" + ctype, True))
vardeps.add('COMPRESS_CMD_' + ctype)
- subimages.append(realt + "." + ctype)
+ subimages.append(type + "." + ctype)
+ 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)
+ localdata.setVar('type', realt)
if realt not in alltypes:
- cmds.append(localdata.expand("\trm ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
+ rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
else:
subimages.append(realt)
+ # Clean up after applying all conversion commands. Some of them might
+ # use the same input, therefore we cannot delete sooner without applying
+ # some complex dependency analysis.
+ for image in rm_tmp_images:
+ cmds.append("\trm " + image)
+
after = 'do_image'
for dep in typedeps[t]:
after += ' do_image_%s' % dep.replace("-", "_").replace(".", "_")