xref: /OK3568_Linux_fs/buildroot/package/python3/0027-python-config.sh-don-t-reassign-prefix.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 106d9378c61e7fa9cad0a63ba068668d54cd11b8 Mon Sep 17 00:00:00 2001
2From: Matt Weber <matthew.weber@rockwellcollins.com>
3Date: Fri, 6 Oct 2017 09:54:15 -0500
4Subject: [PATCH] python-config.sh: don't reassign ${prefix}
5
6When prefix is set to a path like /usr during crossbuild
7the sed operations end up executing twice, once for the prefix
8reassignment and another for includedir if it is set as a string
9including the ${prefix} variable.  This results in an issue
10when the build directory is under /usr.
11
12This patch updates the remaining location which uses the prefix
13variable to also sed and update to use the real path.
14
15Upstream bug report:
16https://bugs.python.org/issue31713
17
18Buildroot bug:
19https://bugs.busybox.net/show_bug.cgi?id=10361
20
21Fixes failures like the following:
22dbus-python-1.2.4 | NOK | http://autobuild.buildroot.net/results/758858efa97b6273c1b470513f5492258a6d8853
23
24Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
25---
26 Misc/python-config.sh.in | 4 ++--
27 1 file changed, 2 insertions(+), 2 deletions(-)
28
29diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in
30index a1bc3cd..164d2d3 100644
31--- a/Misc/python-config.sh.in
32+++ b/Misc/python-config.sh.in
33@@ -31,7 +31,7 @@ prefix_real=$(installed_prefix "$0")
34 # locations. Keep prefix & exec_prefix using their original values in case
35 # they are referenced in other configure variables, to prevent double
36 # substitution, issue #22140.
37-prefix=$(echo "$prefix_build" | sed "s#^$prefix_build#$prefix_real#")
38+prefix=$prefix_build
39 exec_prefix=$(echo "$exec_prefix_build" | sed "s#^$exec_prefix_build#$prefix_real#")
40 exec_prefix_real=${prefix_real}
41 includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#")
42@@ -49,7 +49,7 @@ LDLIBRARY="@LDLIBRARY@"
43 OPT="@OPT@"
44 PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
45 LDVERSION="@LDVERSION@"
46-LIBDEST=${prefix_real}/lib/python${VERSION}
47+LIBDEST=$( echo "${prefix}/lib/python${VERSION}" | sed "s#^$prefix_build#$prefix_real#")
48 LIBPL=$(echo "@LIBPL@" | sed "s#^$prefix_build#$prefix_real#")
49 SO="@EXT_SUFFIX@"
50 PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
51--
522.30.2
53
54