[OE-core] [PATCH] kernel-yocto: checksum indirect cfg and scc files

Zhaolong Zhang zhangzl2013 at 126.com
Thu Jul 4 10:29:43 UTC 2019


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 at 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



More information about the Openembedded-core mailing list