public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v2] meta: add quality check helper to image class
@ 2022-03-03 13:25 Henning Schild
  2022-03-17 13:52 ` Anton Mikanovich
  0 siblings, 1 reply; 2+ messages in thread
From: Henning Schild @ 2022-03-03 13:25 UTC (permalink / raw)
  To: isar-users; +Cc: vijaikumar.kanagarajan, Henning Schild

From: Henning Schild <henning.schild@siemens.com>

Content of rootfs should ideally all be coming from packages and their
hooks. POSTPROCESSing and custom tasks should be handled with a lot of
care and avoided where possible.

This commit introduces a quality check task to help devs not
accidentially abuse POSTPROCESS, while allowing them to add files to an
ignore list.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/classes/image.bbclass | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index d44298bcdd7c..eb879ffe6ce3 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -231,5 +231,33 @@ EOSUDO
 }
 addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess
 
+ROOTFS_QA_FIND_ARGS ?= ""
+
+do_rootfs_quality_check() {
+    rootfs_install_stamp=$( ls -1 "${STAMP}".do_rootfs_install* | head -1 )
+    test -f "$rootfs_install_stamp"
+
+    args="$ROOTFS_QA_FIND_ARGS"
+    # rootfs_finalize chroot-setup.sh
+    args="${args} ! -path ${ROOTFSDIR}/var/lib/dpkg/diversions"
+    for cmd in ${ROOTFS_POSTPROCESS_COMMAND}; do
+        case "${cmd}" in
+	    image_postprocess_mark)
+	        args="${args} ! -path ${ROOTFSDIR}/etc/os-release";;
+	    image_postprocess_machine_id)
+	        args="${args} ! -path ${ROOTFSDIR}/etc/machine-id";;
+	esac
+    done
+    found=$( sudo find ${ROOTFSDIR} -type f -newer $rootfs_install_stamp $args )
+    if [ -n "$found" ]; then
+        bbwarn "Files changed after package install. The following files seem"
+	bbwarn "to have changed where they probably should not have."
+	bbwarn "You might have a custom task or writing POSTPROCESS function."
+	bbwarn "$found"
+    fi
+}
+
+addtask rootfs_quality_check after do_rootfs_finalize before do_rootfs
+
 # Last so that the image type can overwrite tasks if needed
 inherit ${IMAGE_FSTYPES}
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-17 13:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 13:25 [PATCH v2] meta: add quality check helper to image class Henning Schild
2022-03-17 13:52 ` Anton Mikanovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox