All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vyacheslav Yurkov" <uvv.mail@gmail.com>
To: Openembedded-core@lists.openembedded.org
Cc: Vyacheslav Yurkov <uvv.mail@gmail.com>
Subject: [PATCH v4 3/7] rootfs-postcommands: add QA check for overlayfs
Date: Fri,  6 Aug 2021 14:06:07 +0200	[thread overview]
Message-ID: <20210806120611.124246-3-uvv.mail@gmail.com> (raw)
In-Reply-To: <20210806120611.124246-1-uvv.mail@gmail.com>

The check is conditional and only enabled when overlayfs is set in
DISTRO_FEATURES

Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com>
---
 meta/classes/rootfs-postcommands.bbclass | 25 ++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

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')
+}
-- 
2.28.0


  parent reply	other threads:[~2021-08-06 12:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06 12:06 [PATCH v4 1/7] lib/oe: add generic functions for overlayfs Vyacheslav Yurkov
2021-08-06 12:06 ` [PATCH v4 2/7] overlayfs.bbclass: generate overlayfs mount units Vyacheslav Yurkov
2021-08-06 13:00   ` [OE-core] " Michael Opdenacker
2021-08-06 13:04     ` Richard Purdie
2021-08-06 13:13       ` Vyacheslav Yurkov
2021-08-06 13:28         ` Michael Opdenacker
2021-08-06 12:06 ` Vyacheslav Yurkov [this message]
2021-08-06 12:06 ` [PATCH v4 4/7] systemd-machine-units: add bbappend for meta-selftest Vyacheslav Yurkov
2021-08-06 12:06 ` [PATCH v4 5/7] overlayfs: meta-selftest recipe Vyacheslav Yurkov
2021-08-06 12:06 ` [PATCH v4 6/7] oeqa/selftest: overlayfs unit tests Vyacheslav Yurkov
2021-08-06 12:06 ` [PATCH v4 7/7] MAINTAINERS: add overlayfs maintainer Vyacheslav Yurkov
2021-08-06 13:01   ` [OE-core] " Michael Opdenacker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210806120611.124246-3-uvv.mail@gmail.com \
    --to=uvv.mail@gmail.com \
    --cc=Openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.