From: Amy Fong <[email protected]>

On some builds with really long paths, we can end up exceeding the maximum
length line for an interpreter (man execve: A maximum line length of
127 characters is allowed for the first line in a #!  executable shell
script.)

To avoid this limit, we use env to execute python, with this, we will
be using python that's first found in our PATH.

The former ${bindir}/env is not a good idea for apps requiring native-python
since coreutil*-native may not have been built (${bindir}/env may not exist)
and with long paths, we can end up running into the same issue, hence we
use /usr/bin/env from the host.

Signed-off-by: Amy Fong <[email protected]>
Signed-off-by: Robert Yang <[email protected]>
Signed-off-by: Hongxu Jia <[email protected]>
---
 meta/classes/distutils.bbclass | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/meta/classes/distutils.bbclass b/meta/classes/distutils.bbclass
index f3da023..1a53ebd 100644
--- a/meta/classes/distutils.bbclass
+++ b/meta/classes/distutils.bbclass
@@ -50,7 +50,13 @@ distutils_do_install() {
             for i in ${D}${bindir}/* ; do \
                 if [ ${PN} != "${BPN}-native" ]; then
                        sed -i -e 
s:${STAGING_BINDIR_NATIVE}/python-native/python:${bindir}/env\ python:g $i
-               fi
+                else
+                       # The former ${bindir}/env is not a good idea for apps 
requiring native-python
+                       # since coreutil*-native may not have been built 
(${bindir}/env may not exist)
+                       # and with long paths, we can end up running into an 
issue where the
+                       # interpreter line is too long, hence we use 
/usr/bin/env from the host.
+                       sed -i -e 
s:${STAGING_BINDIR_NATIVE}/python-native/python:/usr/bin/env\ python:g $i
+                fi
                 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
             done
         fi
@@ -59,6 +65,12 @@ distutils_do_install() {
             for i in ${D}${sbindir}/* ; do \
                 if [ ${PN} != "${BPN}-native" ]; then
                        sed -i -e 
s:${STAGING_BINDIR_NATIVE}/python-native/python:${bindir}/env\ python:g $i
+                else
+                       # The former ${bindir}/env is not a good idea for apps 
requiring native-python
+                       # since coreutil*-native may not have been built 
(${bindir}/env may not exist)
+                       # and with long paths, we can end up running into an 
issue where the
+                       # interpreter line is too long, hence we use 
/usr/bin/env from the host.
+                       sed -i -e 
s:${STAGING_BINDIR_NATIVE}/python-native/python:/usr/bin/env\ python:g $i
                fi
                 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
             done
-- 
1.8.1.2

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to