[OE-core] [PATCH 4/8] kernel-devsrc: remove python2 dependency

bruce.ashfield at gmail.com bruce.ashfield at gmail.com
Wed Aug 28 19:28:38 UTC 2019


From: Bruce Ashfield <bruce.ashfield at gmail.com>

Witht the approaching EOL of python2, the kernel packages need to
be updated to depend on python3.

The core kernel scripts are now python3 safe, making the RDEPENDS
change relatively simple.

but

There are some scripts that are captured in the devsrc files that
are not used, but reference /usr/bin/python. The python3 package
does not provide /usr/bin/python so any package managers with
automatic dependency detection will fail to assemble a rootfs due
to the missing intepreter.

We could drop the scripts from the source capture, but that
risks dropping something that we need in certain operations and
we'd miss when they are updated in tree to explicitly call python3
(since they won't be revisited often). Light testing shows that the
scripts do run with python3, so rather than removing them, we change
the interpreter once they are copied, and automatic dependency
detection won't cause us rootfs assembly issues.

Signed-off-by: Bruce Ashfield <bruce.ashfield at gmail.com>
---
 meta/recipes-kernel/linux/kernel-devsrc.bb | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
index 3900489ac5..e17c0ea0ab 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -240,6 +240,15 @@ do_install() {
     # Copy .config to include/config/auto.conf so "make prepare" is unnecessary.
     cp $kerneldir/build/.config $kerneldir/build/include/config/auto.conf
 
+    # make the scripts python3 safe. We won't be running these, and if they are
+    # left as /usr/bin/python rootfs assembly will fail, since we only have python3
+    # in the RDEPENDS (and the python3 package does not include /usr/bin/python)
+    for ss in $(find $kerneldir/build/scripts -type f -name '*'); do
+	sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "$ss"
+	sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "$ss"
+	sed -i 's,/usr/bin/python,/usr/bin/env python3,' "$ss"
+    done
+
     chown -R root:root ${D}
 }
 
@@ -249,7 +258,7 @@ do_install[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
 FILES_${PN} = "${KERNEL_BUILD_ROOT} ${KERNEL_SRC_PATH}"
 FILES_${PN}-dbg += "${KERNEL_BUILD_ROOT}*/build/scripts/*/.debug/*"
 
-RDEPENDS_${PN} = "bc python flex bison ${TCLIBC}-utils"
+RDEPENDS_${PN} = "bc python3 flex bison ${TCLIBC}-utils"
 # 4.15+ needs these next two RDEPENDS
 RDEPENDS_${PN} += "openssl-dev util-linux"
 # and x86 needs a bit more for 4.15+
-- 
2.19.1



More information about the Openembedded-core mailing list