summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-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 () {
303 basetype = type[:-len("." + ctype)] 303 basetype = type[:-len("." + ctype)]
304 break 304 break
305 305
306 if basetype != type:
307 # New base type itself might be generated by a conversion command.
308 basetype = _image_base_type(basetype)
309
306 return basetype 310 return basetype
307 311
308 basetypes = {} 312 basetypes = {}
@@ -379,18 +383,35 @@ python () {
379 bb.fatal("No IMAGE_CMD defined for IMAGE_FSTYPES entry '%s' - possibly invalid type name or missing support class" % t) 383 bb.fatal("No IMAGE_CMD defined for IMAGE_FSTYPES entry '%s' - possibly invalid type name or missing support class" % t)
380 cmds.append(localdata.expand("\tcd ${DEPLOY_DIR_IMAGE}")) 384 cmds.append(localdata.expand("\tcd ${DEPLOY_DIR_IMAGE}"))
381 385
382 for bt in basetypes[t]: 386 rm_tmp_images = set()
387 def gen_conversion_cmds(bt):
383 for ctype in ctypes: 388 for ctype in ctypes:
384 if bt.endswith("." + ctype): 389 if bt.endswith("." + ctype):
390 type = bt[0:-len(ctype) - 1]
391 # Create input image first.
392 gen_conversion_cmds(type)
393 localdata.setVar('type', type)
385 cmds.append("\t" + localdata.getVar("COMPRESS_CMD_" + ctype, True)) 394 cmds.append("\t" + localdata.getVar("COMPRESS_CMD_" + ctype, True))
386 vardeps.add('COMPRESS_CMD_' + ctype) 395 vardeps.add('COMPRESS_CMD_' + ctype)
387 subimages.append(realt + "." + ctype) 396 subimages.append(type + "." + ctype)
397 if type not in alltypes:
398 rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
399
400 for bt in basetypes[t]:
401 gen_conversion_cmds(bt)
388 402
403 localdata.setVar('type', realt)
389 if realt not in alltypes: 404 if realt not in alltypes:
390 cmds.append(localdata.expand("\trm ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}")) 405 rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
391 else: 406 else:
392 subimages.append(realt) 407 subimages.append(realt)
393 408
409 # Clean up after applying all conversion commands. Some of them might
410 # use the same input, therefore we cannot delete sooner without applying
411 # some complex dependency analysis.
412 for image in rm_tmp_images:
413 cmds.append("\trm " + image)
414
394 after = 'do_image' 415 after = 'do_image'
395 for dep in typedeps[t]: 416 for dep in typedeps[t]:
396 after += ' do_image_%s' % dep.replace("-", "_").replace(".", "_") 417 after += ' do_image_%s' % dep.replace("-", "_").replace(".", "_")