]> code.ossystems Code Review - openembedded-core.git/commitdiff
kernel-devsrc: remove python2 dependency
authorBruce Ashfield <bruce.ashfield@gmail.com>
Wed, 28 Aug 2019 19:28:38 +0000 (15:28 -0400)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 30 Aug 2019 16:10:23 +0000 (17:10 +0100)
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@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-kernel/linux/kernel-devsrc.bb

index 3900489ac50eb17f67dc60b09a4aeafd950567d3..e17c0ea0abb31f4f17b6b7978a1759178cd21757 100644 (file)
@@ -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+