summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-03-24 12:23:10 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-03-24 12:23:10 +0000
commitda5d038f955bf47155a0f217dba2f96e263bcad8 (patch)
tree7db1854383ca11e0e88e24fa89315954ebbd3e0b
parentf2fe5e840b8aa0558b5462ef2c7517b2f14ec2ea (diff)
downloadopenembedded-core-da5d038f955bf47155a0f217dba2f96e263bcad8.tar.gz
openembedded-core-da5d038f955bf47155a0f217dba2f96e263bcad8.tar.bz2
openembedded-core-da5d038f955bf47155a0f217dba2f96e263bcad8.zip
image.bbclass: Improve readability of the image generation code
The quoting in get_imagecmds() is hard to read. We can simplify the constuction a little to make this easier to parse and reduce complexity slightly. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/image.bbclass20
1 files changed, 13 insertions, 7 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 2cc17e1721..2ff6a1d168 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -69,16 +69,22 @@ def get_imagecmds(d):
old_overrides = bb.data.getVar('OVERRIDES', d, 0)
for type in bb.data.getVar('IMAGE_FSTYPES', d, True).split():
localdata = bb.data.createCopy(d)
- bb.data.setVar('OVERRIDES', '%s:%s' % (type, old_overrides), localdata)
+ localdata.setVar('OVERRIDES', '%s:%s' % (type, old_overrides))
bb.data.update_data(localdata)
- cmd = "\t#Code for image type " + type + "\n"
- cmd += "\t${IMAGE_CMD_" + type + "}\n"
- cmd += "\tcd ${DEPLOY_DIR_IMAGE}/\n"
- cmd += "\trm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}." + type + "\n"
- cmd += "\tln -s ${IMAGE_NAME}.rootfs." + type + " ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}." + type + "\n\n"
- cmds += bb.data.expand(cmd, localdata)
+ localdata.setVar('type', type)
+ cmd = localdata.getVar("IMAGE_CMD_" + type, True)
+ localdata.setVar('cmd', cmd)
+ cmds += localdata.getVar("runimagecmd", True)
return cmds
+runimagecmd () {
+ # Image generation code for image type ${type}
+ ${cmd}
+ cd ${DEPLOY_DIR_IMAGE}/
+ rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${type}
+ ln -s ${IMAGE_NAME}.rootfs.${type} ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${type}
+}
+
IMAGE_POSTPROCESS_COMMAND ?= ""
MACHINE_POSTPROCESS_COMMAND ?= ""
ROOTFS_POSTPROCESS_COMMAND ?= ""