From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7069776205411516416 X-Received: by 2002:ac2:592a:0:b0:43a:1334:25b8 with SMTP id v10-20020ac2592a000000b0043a133425b8mr21749167lfi.649.1646313956550; Thu, 03 Mar 2022 05:25:56 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:bc07:0:b0:247:b308:7b8c with SMTP id b7-20020a2ebc07000000b00247b3087b8cls449549ljf.0.gmail; Thu, 03 Mar 2022 05:25:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1Ie5yjRocHYW5gQ/A8rxC5c21vqQZyiDweGYjZ6jGceAWuyzFDAXMBMXPjhjIaOlouWhJ X-Received: by 2002:a2e:87d7:0:b0:246:1466:c43b with SMTP id v23-20020a2e87d7000000b002461466c43bmr23423604ljj.279.1646313955730; Thu, 03 Mar 2022 05:25:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646313955; cv=none; d=google.com; s=arc-20160816; b=K1OkAJpZuloDuY+H4Lu9MEitxPi5hKzmCqsp/NKpegXmzWtv3IQfeEZifj10zFVWed 43TLnh1jnPZG8kU3R+oR30FprjXhPwJJA+gqEWqtxr+jlvztaDWBGxPWxm6WO2E7V0MB hptCLq2dqRmRM9ncHvbM7SSUE0MieHiu/S0vLImpYnP7gqemiWWvoEy78rf6ijy5AYn1 7qh79ZhbF0KOkVLp5yBZ2czq22v1U0fz0S1GfYGXM7/Vv9+k3SRD9tr2deFWA8JdZ4x6 otsnptO0Jcf1MW8TJ1MO2m6h8msXaBSLYrRrgx0BBc16r3zB3QmOnB6KjWIa7QwwXwIq Y8jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=M8iAbuB6sU2gKNG+ROYg9ftHWehk/j0toyJDt25c6/4=; b=nqT/KrkNzsuDs9DUp6hR8GGQ6TSKicl1Q5imwQ5+vpiwOG49Npwm7UidBO71h1yoJF viSoJUPVfQLjAtqxoRsI1mfuRMb9bPIkwSwH9iALd/hXdoXZHGnrk49AEClsb44bKxsL lmi1iD2oh8biMXJHhZdBctW3mL/SBrY10oj4sHpB/rOWWUlbUhla+3WPNy+HnrsLoBC0 feCukAdLXzHE5l186JGfscV793G/a/lPP/925G9YQJ6dtOlZp1wnjUaYFlo/7pQt6DcO hgjIO/ejDXHS4B+O0xB2UNBAgJ8wZDRZclIix94iEozf2QRO0FHeiiF2fvw9P/CGmoBL 0eyw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of work@hennsch.de designates 2a01:488:42:1000:50ed:842d:: as permitted sender) smtp.mailfrom=work@hennsch.de Return-Path: Received: from wp038.webpack.hosteurope.de (wp038.webpack.hosteurope.de. [2a01:488:42:1000:50ed:842d::]) by gmr-mx.google.com with ESMTPS id o11-20020ac25e2b000000b00443c501a389si101507lfg.1.2022.03.03.05.25.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 05:25:55 -0800 (PST) Received-SPF: pass (google.com: domain of work@hennsch.de designates 2a01:488:42:1000:50ed:842d:: as permitted sender) client-ip=2a01:488:42:1000:50ed:842d::; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of work@hennsch.de designates 2a01:488:42:1000:50ed:842d:: as permitted sender) smtp.mailfrom=work@hennsch.de Received: from [2003:a:d7a:1f00:9610:3eff:feb8:7861] (helo=md1za8fc.ad001.siemens.net); authenticated by wp038.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) id 1nPlSt-0001RR-3u; Thu, 03 Mar 2022 14:25:55 +0100 From: Henning Schild To: isar-users@googlegroups.com Cc: vijaikumar.kanagarajan@gmail.com, Henning Schild Subject: [PATCH v2] meta: add quality check helper to image class Date: Thu, 3 Mar 2022 14:25:53 +0100 Message-Id: <20220303132553.31315-1-work@hennsch.de> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-bounce-key: webpack.hosteurope.de;work@hennsch.de;1646313955;3f9eca2d; X-HE-SMSGID: 1nPlSt-0001RR-3u X-TUID: hcGJNpeDY4jW From: Henning Schild 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 --- 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