aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2016-09-30 13:47:33 +0200
committerPatrick Ohly <patrick.ohly@intel.com>2016-12-08 14:12:55 +0100
commit0793caebc7b5c482993a898ecf05643e7b1321f7 (patch)
tree3dd73810b89a8b8f4ce253b7976adba8746d078d
parentb641cc200acdcd4df6cb299acd10b6be165eb951 (diff)
downloadmeta-swupd-0793caebc7b5c482993a898ecf05643e7b1321f7.tar.gz
meta-swupd-0793caebc7b5c482993a898ecf05643e7b1321f7.tar.bz2
meta-swupd-0793caebc7b5c482993a898ecf05643e7b1321f7.zip
meta-swupd: fix virtual image dependencies
Sharing of pseudo databases was broken, leading to files with wrong attributes: ${IMAGE_BASENAME} is different among all virtual recipes and thus updating PSEUDO_LOCALSTATEDIR did not have the desired effect. Bundle recipes do not need to copy from anything (and thus they do not depend on the mega image do_image) and also do not need to share the pseudo database, because all that matters is the list of entries in their rootfs. Being very specific about the task dependencies allows more long-running image creation tasks to run in parallel. Distinguishing between the various virtual image recipes and the base image is a bit tricky. Therefore the "(virtual) swupd image recipes" (called so because they get created by swupdimage.bbclass) now unsets BUNDLE_NAME (thus removing the default "os-core" which is set in the base recipe) and the usage of PN, PN_BASE, and BUNDLE_NAME is explained in a comment. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
-rw-r--r--classes/swupd-image.bbclass55
-rw-r--r--classes/swupdimage.bbclass3
2 files changed, 31 insertions, 27 deletions
diff --git a/classes/swupd-image.bbclass b/classes/swupd-image.bbclass
index 8110e99..a5d79e1 100644
--- a/classes/swupd-image.bbclass
+++ b/classes/swupd-image.bbclass
@@ -50,8 +50,12 @@ python () {
havebundles = (d.getVar('SWUPD_BUNDLES', True) or '') != ''
- pn_base = d.getVar('PN_BASE', True)
+ # Always set, value differs among virtual image recipes.
pn = d.getVar('PN', True)
+ # The PN value of the base image recipe. None in the base image recipe itself.
+ pn_base = d.getVar('PN_BASE', True)
+ # For bundle images, the corresponding bundle name. None in swupd images.
+ bundle_name = d.getVar('BUNDLE_NAME', True)
# We set the path to the rootfs folder of the mega image here so that
# it's simple to refer to later.
@@ -66,6 +70,23 @@ python () {
manfileprefix = manfileprefix + '-' + ver
d.setVar('SSTATE_MANFILEPREFIX', manfileprefix)
+ # do_stage_swupd_inputs in the main image recipe and do_image in the
+ # swupd images will copy files from the mega bundle and thus those
+ # recipes must use the same pseudo database.
+ #
+ # All other bundles can use their own pseudo instance, because the
+ # main image recipe is only interested in file lists, not the actual
+ # file attributes.
+ #
+ # Because real image building via SWUPD_IMAGES can happen also after
+ # the initial "bitbake <core image>" invocation, we have to keep that
+ # pseudo database around and cannot delete it.
+ if pn_base is None or \
+ bundle_name is None or \
+ bundle_name == 'mega':
+ pseudo_state = d.expand('${TMPDIR}/work-shared/%s/pseudo') % (pn_base or pn)
+ d.setVar('PSEUDO_LOCALSTATEDIR', pseudo_state)
+
if pn_base is not None:
# We want all virtual images from this recipe to deploy to the same
# directory
@@ -73,35 +94,15 @@ python () {
deploy_dir = os.path.join(deploy_dir, pn_base)
d.setVar('DEPLOY_DIR_SWUPD', deploy_dir)
- # We need all virtual images from this recipe to share the same pseudo
- # database so that permissions are correctly set in the copied bundle
- # directories when swupd post-processing happens.
- #
- # Because real image building via SWUPD_IMAGES can happen also after
- # the initial "bitbake <core image>" invocation, we have to keep that
- # pseudo database around and cannot delete it.
- pseudo_state = d.expand('${TMPDIR}/work-shared/${IMAGE_BASENAME}/pseudo')
- d.setVar('PSEUDO_LOCALSTATEDIR', pseudo_state)
-
- # Non mega virtual images must depend on the mega image having been
- # built, as they will copy contents from there
- if d.getVar('BUNDLE_NAME', True) == 'mega':
- return
-
- mega_name = (' bundle-%s-mega:do_image_complete' % pn_base)
- d.appendVarFlag('do_image', 'depends', mega_name)
+ # Swupd images must depend on the mega image having been
+ # built, as they will copy contents from there. For bundle
+ # images that is irrelevant.
+ if bundle_name is None:
+ mega_name = (' bundle-%s-mega:do_image_complete' % pn_base)
+ d.appendVarFlag('do_image', 'depends', mega_name)
return
- # We use a shared Pseudo database in order to ensure that all tasks have
- # full awareness of the files created for the base image recipe and each
- # of its virtual recipes (primarily the mega image).
- # However, we must be careful with the pseudo database and managing
- # database lifecycles in order to avoid confusion should inode numbers be
- # reused when files are deleted outside of pseudo's awareness.
- pseudo_state = d.expand('${TMPDIR}/work-shared/${IMAGE_BASENAME}/pseudo')
- d.setVar('PSEUDO_LOCALSTATEDIR', pseudo_state)
-
deploy_dir = d.expand('${DEPLOY_DIR_SWUPDBASE}/${IMAGE_BASENAME}')
d.setVar('DEPLOY_DIR_SWUPD', deploy_dir)
# do_swupd_update requires the full swupd directory hierarchy
diff --git a/classes/swupdimage.bbclass b/classes/swupdimage.bbclass
index b831ad4..4b64fa9 100644
--- a/classes/swupdimage.bbclass
+++ b/classes/swupdimage.bbclass
@@ -33,6 +33,9 @@ python swupdimage_virtclass_handler () {
pn = pn + '-' + imageext
e.data.setVar("PN", pn)
+ # Unset BUNDLE_NAME because we are not a bundle.
+ e.data.delVar("BUNDLE_NAME")
+
# Sanity check settings to catch errors already during parsing.
imagebundles = (e.data.getVarFlag('SWUPD_IMAGES', imageext, True) or '').split()
if not imagebundles: