summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVyacheslav Yurkov <uvv.mail@gmail.com>2021-08-06 14:06:07 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-12 06:26:10 +0100
commit4734799bacf0a5d2487e1cde3ae1c00223b032b2 (patch)
tree86468d7afabf79e66ee65ce18d487b1b904a3c03
parent18377d6f09fc8855c71f2e5c097cbbbccf5632ce (diff)
downloadopenembedded-core-4734799bacf0a5d2487e1cde3ae1c00223b032b2.tar.gz
rootfs-postcommands: add QA check for overlayfs
The check is conditional and only enabled when overlayfs is set in DISTRO_FEATURES Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/rootfs-postcommands.bbclass25
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"
ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;'
+ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "overlayfs", "overlayfs_qa_check;", "", d)}'
+
inherit image-artifact-names
# Sort the user and group entries in /etc by ID in order to make the content
@@ -373,3 +375,26 @@ rootfs_reproducible () {
fi
fi
}
+
+python overlayfs_qa_check() {
+ from oe.overlayfs import mountUnitName
+
+ # this is a dumb check for unit existence, not its validity
+ overlayMountPoints = d.getVarFlags("OVERLAYFS_MOUNT_POINT")
+ imagepath = d.getVar("IMAGE_ROOTFS")
+ searchpaths = [oe.path.join(imagepath, d.getVar("sysconfdir"), "systemd", "system"),
+ oe.path.join(imagepath, d.getVar("systemd_system_unitdir"))]
+
+ allUnitExist = True;
+ for mountPoint in overlayMountPoints:
+ path = d.getVarFlag('OVERLAYFS_MOUNT_POINT', mountPoint)
+ unit = mountUnitName(path)
+
+ if not any(os.path.isfile(oe.path.join(dirpath, unit))
+ for dirpath in searchpaths):
+ bb.warn('Unit name %s not found in systemd unit directories' % unit)
+ allUnitExist = False;
+
+ if not allUnitExist:
+ bb.fatal('Not all mount units are installed by the BSP')
+}