Due to recent security update[1] in git, a subprocess will be unable
to not able to run git rev-parse to fetch revision.

So instead, use the SRCPV to parse the short commit ID and set the
KERNEL_LOCALVERSION variable.

[1] https://github.blog/2022-04-12-git-security-vulnerability-announced/

Inspired-by: Devarsh Thakkar <devar...@ti.com>
Signed-off-by: Nishanth Menon <n...@ti.com>
---
 recipes-kernel/linux/setup-defconfig.inc | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/recipes-kernel/linux/setup-defconfig.inc 
b/recipes-kernel/linux/setup-defconfig.inc
index 850a1dd8d613..1e97acc0ee63 100644
--- a/recipes-kernel/linux/setup-defconfig.inc
+++ b/recipes-kernel/linux/setup-defconfig.inc
@@ -1,14 +1,6 @@
 # KERNEL_LOCALVERSION can be set to add a tag to the end of the
 # kernel version string.  such as the commit id
-def get_git_revision(p):
-    import subprocess
-
-    try:
-        return subprocess.Popen("git rev-parse HEAD 2>/dev/null ", cwd=p, 
shell=True, stdout=subprocess.PIPE, 
universal_newlines=True).communicate()[0].rstrip()
-    except OSError:
-        return None
-
-KERNEL_LOCALVERSION = "-g${@get_git_revision('${S}').__str__()[:10]}"
+KERNEL_LOCALVERSION = "-g${@d.getVar('SRCPV', True).split('+')[1]}"
 
 # Check the defconfig file and see if it points to an in kernel
 # defconfig that should be used, or if it is a complete config file
-- 
2.31.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#14627): 
https://lists.yoctoproject.org/g/meta-ti/message/14627
Mute This Topic: https://lists.yoctoproject.org/mt/90746187/21656
Group Owner: meta-ti+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

  • [meta-ti] [PATCH] recipes-kernel... Nishanth Menon via lists.yoctoproject.org

Reply via email to