[RFC,1/2] wic-img: Forward warnings from wic to bitbake

Message ID 20210201185815.382326-2-florian.bezdeka@siemens.com
State Accepted, archived
Headers show
Series wic: warn on usage of Y2038 affected file systems | expand

Commit Message

Florian Bezdeka Feb. 1, 2021, 8:58 a.m. UTC
From: Florian Bezdeka <florian.bezdeka@siemens.com>

By now warnings generated by wic are visible in the wic log file, but
they are note visible in the bitbake output (stdout) so they can easily
be overlooked.

To forward the warnings from the logfile to bitbake the logfile is
being parsed once the wic image generation has been done.

The bitbake task (do_wic_image) is now a python function which first
calls the previous (unchanged) shell function (now called
generate_wic_image) which does the image generation and checks for wic
warnings afterwards.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 meta/classes/wic-img.bbclass | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

Patch

diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
index bbf5dd8..a11e493 100644
--- a/meta/classes/wic-img.bbclass
+++ b/meta/classes/wic-img.bbclass
@@ -129,7 +129,21 @@  do_rootfs_wicenv[prefuncs] = 'set_image_size'
 
 WIC_IMAGE_FILE ="${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.wic.img"
 
-do_wic_image() {
+python check_for_wic_warnings() {
+    with open("{}/log.do_wic_image".format(d.getVar("T"))) as f:
+        for line in f.readlines():
+            if line.startswith("WARNING"):
+                bb.warn(line.strip())
+}
+
+do_wic_image[file-checksums] += "${WKS_FILE_CHECKSUM}"
+python do_wic_image() {
+    bb.build.exec_func("generate_wic_image", d)
+    bb.build.exec_func("check_for_wic_warnings", d)
+}
+addtask wic_image before do_image after do_image_tools
+
+generate_wic_image() {
     buildchroot_do_mounts
     sudo -s <<'EOSUDO'
         ( flock 9
@@ -186,7 +200,3 @@  EOSUDO
     rm -rf ${BUILDCHROOT_DIR}/${WICTMP}
     rm -rf ${IMAGE_ROOTFS}/../pseudo
 }
-
-do_wic_image[file-checksums] += "${WKS_FILE_CHECKSUM}"
-
-addtask wic_image before do_image after do_image_tools