Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Zhaolong Zhang <zhangzl2013@126.com>
To: openembedded-core@lists.openembedded.org, zhangzl2013@126.com
Subject: [PATCH] kernel-yocto: checksum indirect cfg and scc files
Date: Thu,  4 Jul 2019 18:29:43 +0800	[thread overview]
Message-ID: <1562236183-6069-1-git-send-email-zhangzl2013@126.com> (raw)

Currently, Yocto can not realize the modification of the cfg/scc files indirectly
introduced by scc files in custom layers.

Instead of introducing complicated scc parser code, this patch walks though
FILESEXTRAPATHS and takes all the cfg/scc files into account when calculating
checksums.

Signed-off-by: Zhaolong Zhang <zhangzl2013@126.com>
---
 meta/classes/kernel-yocto.bbclass | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index ed9bcfa57c..a9aac8a9d9 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -69,6 +69,24 @@ def get_machine_branch(d, default):
 	    
     return default
 
+def get_files_in_filesextrapaths(d):
+    extrapaths = []
+    extrafiles = []
+    extrapathsvalue = (d.getVar("FILESEXTRAPATHS") or "")
+    # Remove default flag which was used for checking
+    extrapathsvalue = extrapathsvalue.replace("__default:", "")
+    extrapaths = extrapathsvalue.split(":")
+    for path in extrapaths:
+        for root, dirs, files in os.walk(path):
+            for name in files:
+                base, ext = os.path.splitext(name)
+                if ext and ext in [".scc", ".cfg"]:
+                    filepath = os.path.join(root, name)
+                    extrafiles.append(filepath + ":" + str(os.path.exists(filepath)))
+    return " ".join(extrafiles)
+
+
+
 do_kernel_metadata() {
 	set +e
 	cd ${S}
@@ -296,6 +314,7 @@ do_kernel_checkout[dirs] = "${S}"
 addtask kernel_checkout before do_kernel_metadata after do_unpack
 addtask kernel_metadata after do_validate_branches do_unpack before do_patch
 do_kernel_metadata[depends] = "kern-tools-native:do_populate_sysroot"
+do_kernel_metadata[file-checksums] = " ${@get_files_in_filesextrapaths(d)}"
 do_validate_branches[depends] = "kern-tools-native:do_populate_sysroot"
 
 do_kernel_configme[depends] += "virtual/${TARGET_PREFIX}binutils:do_populate_sysroot"
-- 
2.19.1



             reply	other threads:[~2019-07-04 11:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-04 10:29 Zhaolong Zhang [this message]
2019-07-04 12:48 ` [PATCH] kernel-yocto: checksum indirect cfg and scc files Bruce Ashfield
2019-07-04 15:18   ` Richard Purdie
2019-07-04 16:29     ` Bruce Ashfield
2019-07-04 16:36       ` richard.purdie
2019-07-04 16:42         ` Bruce Ashfield
2019-07-05  7:49           ` Zhaolong Zhang
2019-07-05 17:11           ` Robert Berger

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=1562236183-6069-1-git-send-email-zhangzl2013@126.com \
    --to=zhangzl2013@126.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox