aboutsummaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-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: