[oe-commits] [meta-openembedded] 04/14: itstool: Don't use hardcoded, absolute path to python3 binary.

git at git.openembedded.org git at git.openembedded.org
Sun Jul 28 16:05:35 UTC 2019


This is an automated email from the git hooks/post-receive script.

khem pushed a commit to branch master-next
in repository meta-openembedded.

commit 3eb402d7a622e105821dfefc9f6a7633c5a7b835
Author: Piotr Tworek <tworaz at tworaz.net>
AuthorDate: Sat Jul 27 10:56:16 2019 +0200

    itstool: Don't use hardcoded, absolute path to python3 binary.
    
    Unfortunately itstoll build system produces script file which contains
    absolute path to python3 binary used during packaging. In case of OE
    this refers to recipe-sysroot-native directory. This obviously make the
    resulting script unusable for both target and native builds. This
    problem was patched in OE using sed after the script file was installed.
    The sed line replaced one absolute path with /usr/bin/python3. This
    seems to work fine for target builds but is still not good enough for
    native targets.s
    
    The main problem with native builds is we can't mix host and OE provided
    python3 when recipe using the tool inherits python3native bbclass. This
    bbclass exports _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" which is
    likely to break host python3.
    
    To make sure itstool is usable on both build host and target replace
    /usr/bin/python3 absolute path with /usr/bin/env python3.
    
    Signed-off-by: Piotr Tworek <tworaz at tworaz.net>
    Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 ...e-build-time-hardcoded-python-binary-path.patch | 29 ++++++++++++++++++++++
 meta-oe/recipes-support/itstool/itstool_2.0.5.bb   |  8 ++----
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/meta-oe/recipes-support/itstool/itstool/0001-Don-t-use-build-time-hardcoded-python-binary-path.patch b/meta-oe/recipes-support/itstool/itstool/0001-Don-t-use-build-time-hardcoded-python-binary-path.patch
new file mode 100644
index 0000000..b911053
--- /dev/null
+++ b/meta-oe/recipes-support/itstool/itstool/0001-Don-t-use-build-time-hardcoded-python-binary-path.patch
@@ -0,0 +1,29 @@
+From cd9b56224895576125e91cca317ace8a80f3eb77 Mon Sep 17 00:00:00 2001
+From: Piotr Tworek <tworaz at tworaz.net>
+Date: Sat, 27 Jul 2019 10:19:11 +0200
+Subject: [PATCH] Don't use build time hardcoded python binary path.
+
+This path obviously won't work on target since they refer to build
+machine directory structure. Native builds will also fail if local.conf
+has INHERIT+=rm_work. Instread of hardcoding path to python binary use
+whatever is found in PATH first. This should also allow the tool to use
+python3 binary provided in recipe-sysroot-native.
+
+Upstream-Status: Inappropriate [OE specific]
+---
+ itstool.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/itstool.in b/itstool.in
+index b3c0033..7df2476 100755
+--- a/itstool.in
++++ b/itstool.in
+@@ -1,4 +1,4 @@
+-#!@PYTHON@ -s
++#!/usr/bin/env -S python3 -s
+ #
+ # Copyright (c) 2010-2018 Shaun McCance <shaunm at gnome.org>
+ #
+--
+2.21.0
+
diff --git a/meta-oe/recipes-support/itstool/itstool_2.0.5.bb b/meta-oe/recipes-support/itstool/itstool_2.0.5.bb
index a0af44a..2e7e8f1 100644
--- a/meta-oe/recipes-support/itstool/itstool_2.0.5.bb
+++ b/meta-oe/recipes-support/itstool/itstool_2.0.5.bb
@@ -7,15 +7,11 @@ inherit autotools python3native
 
 DEPENDS = "libxml2-native"
 
-SRC_URI = "http://files.itstool.org/${BPN}/${BPN}-${PV}.tar.bz2"
+SRC_URI = "http://files.itstool.org/${BPN}/${BPN}-${PV}.tar.bz2 \
+           file://0001-Don-t-use-build-time-hardcoded-python-binary-path.patch"
 SRC_URI[md5sum] = "655c6f78fc64faee45adcc45ccc5a57e"
 SRC_URI[sha256sum] = "100506f8df62cca6225ec3e631a8237e9c04650c77495af4919ac6a100d4b308"
 
-do_install_append() {
-    # fix shebang of main script
-    sed -i 's:^#!${WORKDIR}.*${PYTHON_PN} -s:#!${bindir_native}/${PYTHON_PN} -s:' ${D}${bindir}/itstool
-}
-
 BBCLASSEXTEND = "native"
 
 RDEPENDS_${PN} += "libxml2-python"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list