diff options
author | Vyacheslav Yurkov <uvv.mail@gmail.com> | 2021-08-06 14:06:07 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-08-12 06:26:15 +0100 |
commit | 550511e446d2f64b575d8fc12563358eaeef3c1e (patch) | |
tree | 0e94e47eb8db1b0997011f69b23db1b73fd3991a /meta/classes | |
parent | d6e1f08ee3809ca699ffd61bea17bccde8a1cbee (diff) | |
download | poky-550511e446d2f64b575d8fc12563358eaeef3c1e.tar.gz |
rootfs-postcommands: add QA check for overlayfs
The check is conditional and only enabled when overlayfs is set in
DISTRO_FEATURES
(From OE-Core rev: 4734799bacf0a5d2487e1cde3ae1c00223b032b2)
Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/rootfs-postcommands.bbclass | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass index fbfa63fcb3..c5746eba13 100644 --- a/meta/classes/rootfs-postcommands.bbclass +++ b/meta/classes/rootfs-postcommands.bbclass | |||
@@ -39,6 +39,8 @@ ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd" | |||
39 | 39 | ||
40 | ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;' | 40 | ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;' |
41 | 41 | ||
42 | ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "overlayfs", "overlayfs_qa_check;", "", d)}' | ||
43 | |||
42 | inherit image-artifact-names | 44 | inherit image-artifact-names |
43 | 45 | ||
44 | # Sort the user and group entries in /etc by ID in order to make the content | 46 | # Sort the user and group entries in /etc by ID in order to make the content |
@@ -373,3 +375,26 @@ rootfs_reproducible () { | |||
373 | fi | 375 | fi |
374 | fi | 376 | fi |
375 | } | 377 | } |
378 | |||
379 | python overlayfs_qa_check() { | ||
380 | from oe.overlayfs import mountUnitName | ||
381 | |||
382 | # this is a dumb check for unit existence, not its validity | ||
383 | overlayMountPoints = d.getVarFlags("OVERLAYFS_MOUNT_POINT") | ||
384 | imagepath = d.getVar("IMAGE_ROOTFS") | ||
385 | searchpaths = [oe.path.join(imagepath, d.getVar("sysconfdir"), "systemd", "system"), | ||
386 | oe.path.join(imagepath, d.getVar("systemd_system_unitdir"))] | ||
387 | |||
388 | allUnitExist = True; | ||
389 | for mountPoint in overlayMountPoints: | ||
390 | path = d.getVarFlag('OVERLAYFS_MOUNT_POINT', mountPoint) | ||
391 | unit = mountUnitName(path) | ||
392 | |||
393 | if not any(os.path.isfile(oe.path.join(dirpath, unit)) | ||
394 | for dirpath in searchpaths): | ||
395 | bb.warn('Unit name %s not found in systemd unit directories' % unit) | ||
396 | allUnitExist = False; | ||
397 | |||
398 | if not allUnitExist: | ||
399 | bb.fatal('Not all mount units are installed by the BSP') | ||
400 | } | ||