add nativesdk to BBCLASSEXTEND to python-distribute and to fix the side effect of it.
cover add nativesdk to BBCLASSEXTEND to python-distribute and to fix the side effect of it.
Hi,
My company has a private python build tool that has python-distribute as dependency. That tool builds well with -native. And now I need to put the my private tool in toolchain. So my users could use it.
To accomplish, I added nativesdk to BBCLASSEXTEND. My buildtools-mytool recipe builds and the toolchain get created. But when I try to install the toolchain I get the this:
$ tmp/deploy/sdk/buildtools-mytool-x86_64-nativesdk-standalone-1.6.1.0.sh
Enter target directory for SDK (default: /opt/mydistro/mytool/1.6.1.0):
You are about to install the SDK to "/opt/mydistro/mytool/1.6.1.0". Proceed[Y/n]?
Extracting SDK...done
Setting it up.../opt/mydistro/mytool/1.6.1.0/relocate_sdk.sh: linha 2: erro de sintaxe próximo do `token' não esperado `('One of the files that relocate_sdk.sh was trying to handle is:
/opt/mydistro/mytool/1.6.1.0/sysroots/x 86_64-linuxsdk-linux/usr/lib/python2.7/site-packages/distribute-0.6.32-py2.7.egg/setuptools/script template (dev).py
Maybe there are other recipes when adding nativesdk to BBCLASSEXTEND which this special handler is needed. So it's better ensure the correct handler of file name with spaces characters.
João Henrique Ferreira de Freitas (2):
python-distribute: add nativesdk to BBCLASSEXTEND
populate_sdk_base: ensure that filenames with empty space character
are handled
meta/classes/populate_sdk_base.bbclass | 4 ++-- meta/recipes-devtools/python/python-distribute_0.6.32.bb | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/2 python-distribute: add nativesdk to BBCLASSEXTEND
Without this, python tools that need python-distribute doesn't install in SDK generated by OE.
--- meta/recipes-devtools/python/python-distribute_0.6.32.bb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
meta/recipes-devtools/python/python-distribute_0.6.32.bb +6 -1
@@ -39,6 +39,11 @@ do_install_append() { echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth } +do_install_append_class-nativesdk() { + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${PYTHON_SITEPACKAGES_DIR}/distribute-${PV}-py${PYTHON_BASEVERSION}.egg/setuptools/tests/test_resources.py + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install +} + RDEPENDS_${PN} = "\ python-distutils \ python-compression \
@@ -46,4 +51,4 @@ RDEPENDS_${PN} = "\ RPROVIDES_${PN} += "python-setuptools" -BBCLASSEXTEND = "native" +BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
1.9.1
PATCH 2/2 populate_sdk_base: ensure that filenames with empty space character are handled
In reply to João Henrique Ferreira de FreitasWhen extracting toolchain, if the list $executable_files has filenames with empty space character, the list will created but relocate_sdk.sh will not handle it well. This will lead to the below erro:
./tmp/deploy/sdk/buildtools-mytools-x86_64-nativesdk-standalone-1.6.1.0.sh
Enter target directory for SDK (default: /opt/mydistro/mytoolset/1.6.1.0):
You are about to install the SDK to "/opt/mydistro/mytoolset/1.6.1.0". Proceed[Y/n]?
Extracting SDK...done
Setting it up.../opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: sintaxe error `token' `('
/opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: `eThe same occurs with replacement of ${SDKPATH} in configs/scripts/etc files.
We should ensure that full path is protected before relocate_sdk.sh and ${SDKPATH} replacement calls.
--- meta/classes/populate_sdk_base.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/populate_sdk_base.bbclass +2 -2
@@ -252,7 +252,7 @@ if [ "$dl_path" = "" ] ; then echo "SDK could not be set up. Relocate script unable to find ld-linux.so. Abort!" exit 1 fi -executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111) +executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111 -exec echo \'{}\' \;) tdir=`mktemp -d` if [ x$tdir = x ] ; then
@@ -273,7 +273,7 @@ if [ $relocate = 1 ] ; then fi # replace ${SDKPATH} with the new prefix in all text files: configs/scripts/etc -$SUDO_EXEC find $native_sysroot -type f -exec file '{}' \;|grep ":.*\(ASCII\|script\|source\).*text"|cut -d':' -f1|$SUDO_EXEC xargs sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" +$SUDO_EXEC find $native_sysroot -type f -exec file '{}' \;|grep ":.*\(ASCII\|script\|source\).*text"|cut -d':' -f1|tr "\n" "\0"|$SUDO_EXEC xargs -0 sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" # change all symlinks pointing to ${SDKPATH} for l in $($SUDO_EXEC find $native_sysroot -type l); do
Signature · 1 line
1.9.1
Re: [PATCH 2/2] populate_sdk_base: ensure that filenames with empty space character are handled
Quoted 11 lines · João Henrique Ferreira de Freitas
When extracting toolchain, if the list $executable_files has filenames with empty space character, the list will created but
relocate_sdk.shwill not handle it well. This will lead to the below erro:./tmp/deploy/sdk/buildtools-mytools-x86_64-nativesdk-standalone-1.6.1.0.sh Enter target directory for SDK (default: /opt/mydistro/mytoolset/1.6.1.0): You are about to install the SDK to "/opt/mydistro/mytoolset/1.6.1.0". Proceed[Y/n]? Extracting SDK...done Setting it up.../opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: sintaxe error `token' `(' /opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: `e
Quoted 5 lines
The same occurs with replacement of ${SDKPATH} in configs/scripts/etc files.
We should ensure that full path is protected before
relocate_sdk.shand ${SDKPATH} replacement calls.
I am not sure about this one, there are other cases where spaces in filenames/directory pathes just don't work, so fixing one place may not address all issues, I thought this was documented someplace, but I can't seem to find the associated bug or wiki entries.
Maybe someone else can remind me also where we talk about whitespace in pathe, obviously my search-fu is off right now.
Sau!
Quoted 28 lines
Signed-off-by João Henrique Ferreira de Freitas <[email protected]>--- meta/classes/populate_sdk_base.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)meta/classes/populate_sdk_base.bbclass +2
-2@@ -252,7 +252,7 @@ if [ "$dl_path" = "" ] ; then echo "SDK could not be set up. Relocate script unable to find ld-linux.so. Abort!" exit 1 fi -executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111) +executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111 -exec echo \'{}\' \;) tdir=`mktemp -d` if [ x$tdir = x ] ; then@@ -273,7 +273,7 @@ if [ $relocate = 1 ] ; then fi # replace ${SDKPATH} with the new prefix in all text files: configs/scripts/etc -$SUDO_EXEC find $native_sysroot -type f -exec file '{}' \;|grep ":.*\(ASCII\|script\|source\).*text"|cut -d':' -f1|$SUDO_EXEC xargs sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" +$SUDO_EXEC find $native_sysroot -type f -exec file '{}' \;|grep ":.*\(ASCII\|script\|source\).*text"|cut -d':' -f1|tr "\n" "\0"|$SUDO_EXEC xargs -0 sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" # change all symlinks pointing to ${SDKPATH} for l in $($SUDO_EXEC find $native_sysroot -type l); do
Re: [PATCH 2/2] populate_sdk_base: ensure that filenames with empty space character are handled
Hello Saul,
Quoted 24 lines · Saul Wold
Quoted 16 lines · João Henrique Ferreira de Freitas
When extracting toolchain, if the list $executable_files has filenames with empty space character, the list will created but
relocate_sdk.shwill not handle it well. This will lead to the below erro:
./tmp/deploy/sdk/buildtools-mytools-x86_64-nativesdk-standalone-1.6.1.0.sh
Enter target directory for SDK (default:/opt/mydistro/mytoolset/1.6.1.0):
You are about to install the SDK to
"/opt/mydistro/mytoolset/1.6.1.0". Proceed[Y/n]?Extracting SDK...done Setting it up.../opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: sintaxe error `token' `(' /opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: `eQuoted 6 lines
The same occurs with replacement of ${SDKPATH} in configs/scripts/etc files.
We should ensure that full path is protected before
relocate_sdk.shand ${SDKPATH} replacement calls.
Quoted 7 lines
I am not sure about this one, there are other cases where spaces in filenames/directory pathes just don't work, so fixing one place may not address all issues, I thought this was documented someplace, but I can't seem to find the associated bug or wiki entries.
Maybe someone else can remind me also where we talk about whitespace in pathe, obviously my search-fu is off right now.
I agree this problem should exist in other places but I think this does not invalidate Joao's patch and it should be reviewed and merged if correct.
Now talking about the patch itself, Joao, did you try to avoid the extra fork calling echo? Using '-print0' option in find might help.
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Re: [PATCH 2/2] populate_sdk_base: ensure that filenames with empty space character are handled
Hi Otavio
Em 08-07-2014 22:33, Otavio Salvador escreveu:
Quoted 1 line
Now talking about the patch itself, Joao, did you try to avoid the extra fork calling echo? Using '-print0' option in find might help.
Not until now. But I agree about your concern. So, instead of
executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111 -exec echo \'{}\' \;)
Its better do:
executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111 -printf "'%h/%f' ")
No extra fork was used with -printf "'%h/%f' ".
The argument -print0 is not an option because the output of find command will be 'path1 path2 path 3' a concatenation of strings not strings split by space and protected with ' '.
Both results are valid. But the second is nicer. What do you think?
When I did this patch I was not thinking to solve all problems about spaces in filename. However a deep dig is needed to track all points that have this issue.
Thanks.
Signature · 2 lines
João Henrique Ferreira de Freitas - joaohf_at_gmail.com Campinas-SP-Brasil
Re: [PATCH 2/2] populate_sdk_base: ensure that filenames with empty space character are handled
Quoted 20 lines · João Henrique Ferreira de Freitas
Hi Otavio
Em 08-07-2014 22:33, Otavio Salvador escreveu:
Quoted 2 lines
Now talking about the patch itself, Joao, did you try to avoid the extra fork calling echo? Using '-print0' option in find might help.
Not until now. But I agree about your concern. So, instead of
executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111 -exec echo \'{}\' \;)
Its better do:
executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111 -printf "'%h/%f' ")
Quoted 7 lines
No extra fork was used with -printf "'%h/%f' ".
The argument -print0 is not an option because the output of find command will be 'path1 path2 path 3' a concatenation of strings not strings split by space and protected with ' '.
Both results are valid. But the second is nicer. What do you think?
Nice.
Quoted 3 lines
When I did this patch I was not thinking to solve all problems about spaces in filename. However a deep dig is needed to track all points that have this issue.
Fully agree but this shouldn't deny this patch to be applied. It is a step further.
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
v2 cover add nativesdk to BBCLASSEXTEND to python-distribute and to fix the side effect of it.
In reply to João Henrique Ferreira de FreitasChanges in v2:
- Use 'find -print' instead of an extra fork to protect path
- Replace sha-bang for easy_python version variant
Test steps:
1- apply the two patches
2- include the package 'nativesdk-python-distribute to TOOLCHAIN_HOST_TASK in meta/recipes-core/meta/buildtools-tarball.bb
3- run 'bitbake buildtools-tarball'
4- install the created SDK
Files from python-distribute has space in three filenames and the SDK step will not claim about it.
João Henrique Ferreira de Freitas (2):
python-distribute: add nativesdk to BBCLASSEXTEND
populate_sdk_base: ensure that filenames with empty space character
are handled
meta/classes/populate_sdk_base.bbclass | 4 ++-- meta/recipes-devtools/python/python-distribute_0.6.32.bb | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/2 python-distribute: add nativesdk to BBCLASSEXTEND
Without this, python tools that need python-distribute doesn't install in SDK generated by OE.
--- meta/recipes-devtools/python/python-distribute_0.6.32.bb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-devtools/python/python-distribute_0.6.32.bb +7 -1
@@ -39,6 +39,12 @@ do_install_append() { echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth } +do_install_append_class-nativesdk() { + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${PYTHON_SITEPACKAGES_DIR}/distribute-${PV}-py${PYTHON_BASEVERSION}.egg/setuptools/tests/test_resources.py + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install-${PYTHON_BASEVERSION} +} + RDEPENDS_${PN} = "\ python-distutils \ python-compression \
@@ -46,4 +52,4 @@ RDEPENDS_${PN} = "\ RPROVIDES_${PN} += "python-setuptools" -BBCLASSEXTEND = "native" +BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
1.9.1
Re: [PATCH v2 1/2] python-distribute: add nativesdk to BBCLASSEXTEND
Quoted 13 lines · João Henrique Ferreira de Freitas
Without this, python tools that need python-distribute doesn't install in SDK generated by OE.
Signed-off-by João Henrique Ferreira de Freitas <[email protected]>--- meta/recipes-devtools/python/python-distribute_0.6.32.bb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)meta/recipes-devtools/python/python-distribute_0.6.32.bb +0
-0
meta/recipes-devtools/python/python-distribute_0.6.32.bb do_install_append() { · line 46
Quoted 8 lines
meta/recipes-devtools/python/python-distribute_0.6.32.bb +5
-0@@ -39,6 +39,12 @@ do_install_append() { echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth } +do_install_append_class-nativesdk() { + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${PYTHON_SITEPACKAGES_DIR}/distribute-${PV}-py${PYTHON_BASEVERSION}.egg/setuptools/tests/test_resources.py + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install-${PYTHON_BASEVERSION} +}
Couldn't this be done unconditionally for all target types? "/usr/bin/env python" should work fine in target as well, no?
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Re: [PATCH v2 1/2] python-distribute: add nativesdk to BBCLASSEXTEND
Hi Otavio,
Em 15-07-2014 10:35, Otavio Salvador escreveu:
Quoted 18 lines
Quoted 16 lines · João Henrique Ferreira de Freitas
Without this, python tools that need python-distribute doesn't install in SDK generated by OE.
Signed-off-by João Henrique Ferreira de Freitas <[email protected]>--- meta/recipes-devtools/python/python-distribute_0.6.32.bb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)meta/recipes-devtools/python/python-distribute_0.6.32.bb +0
-0@@ -39,6 +39,12 @@ do_install_append() { echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth }
Quoted 8 lines
meta/recipes-devtools/python/python-distribute_0.6.32.bb do_install_append() { · line 46
Quoted 5 lines
meta/recipes-devtools/python/python-distribute_0.6.32.bb +5
-0+do_install_append_class-nativesdk() { + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${PYTHON_SITEPACKAGES_DIR}/distribute-${PV}-py${PYTHON_BASEVERSION}.egg/setuptools/tests/test_resources.py + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install-${PYTHON_BASEVERSION} +}Couldn't this be done unconditionally for all target types? "
/usr/bin/envpython" should work fine in target as well, no?
I don't know if I fully understood your question...
Do you mean by 'all target types' like native, nativesdk ?
In some recipes (gnome-doc-utils.inc, createrepo_0.4.11.bb) , this pattern was used:
----
# Wrap the python script since the native python is
# ${bindir}/python-native/python, and the "#! /usr/bin/env python" can't
# find it since it is not in PATH.
do_install_append_class-native () {
...
sed -i -e 's|^#!.*/usr/bin/env python|#! /usr/bin/env nativepython|' $i
...
}
----Sometimes I feel really lost when need to fixes things like that. What is the correct way?
Without do_install_append_class-nativesdk() I got:
Computing transaction...error: Can't install nativesdk-python-distribute-0.6.32-ml5@x86_64_nativesdk: no package provides /usr/bin/python
Thanks.
Signature · 2 lines
João Henrique Ferreira de Freitas - joaohf_at_gmail.com Campinas-SP-Brasil
Re: [PATCH v2 1/2] python-distribute: add nativesdk to BBCLASSEXTEND
Quoted 34 lines · João Henrique Ferreira de Freitas
Em 15-07-2014 10:35, Otavio Salvador escreveu:
Quoted 21 lines
Quoted 19 lines · João Henrique Ferreira de Freitas
Without this, python tools that need python-distribute doesn't install in SDK generated by OE.
Signed-off-by João Henrique Ferreira de Freitas <[email protected]>--- meta/recipes-devtools/python/python-distribute_0.6.32.bb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)meta/recipes-devtools/python/python-distribute_0.6.32.bb +0
-0@@ -39,6 +39,12 @@ do_install_append() { echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" >${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth
}Quoted 12 lines
Quoted 8 lines
meta/recipes-devtools/python/python-distribute_0.6.32.bb +2
-0+do_install_append_class-nativesdk() { + sed -i -e '1s|^#!.*|#!/usr/bin/env python|'
${D}${PYTHON_SITEPACKAGES_DIR}/distribute-${PV}-py${PYTHON_BASEVERSION}.egg/setuptools/tests/test_resources.py
+ sed -i -e '1s|^#!.*|#!/usr/bin/env python|'
${D}${bindir}/easy_install
+ sed -i -e '1s|^#!.*|#!/usr/bin/env python|'
${D}${bindir}/easy_install-${PYTHON_BASEVERSION}
+}Couldn't this be done unconditionally for all target types? "
/usr/bin/envpython" should work fine in target as well, no?
Quoted 4 lines
I don't know if I fully understood your question...
Do you mean by 'all target types' like native, nativesdk ?
Yes. To do it in do_install_append and change it for all targets ...
Quoted 14 lines
In some recipes (gnome-doc-utils.inc, createrepo_0.4.11.bb) , this pattern was used:
----
# Wrap the python script since the native python is
# ${bindir}/python-native/python, and the "#!/usr/bin/envpython" can't# find it since it is not in PATH. do_install_append_class-native () { ... sed -i -e 's|^#!.*/usr/bin/env python|#! /usr/bin/env nativepython|' $i ... } ----
Quoted 2 lines
Sometimes I feel really lost when need to fixes things like that. What is the correct way?
I think the above answer my question, it need to be nativepython for native so it indeed must to be different.
Quoted 5 lines
Without do_install_append_class-nativesdk() I got:
Computing transaction...error: Can't install nativesdk-python-distribute-0.6.32-ml5@x86_64_nativesdk: no package provides
/usr/bin/python
Your fix is fine than. Sorry for the noise :-)
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
PATCH v2 2/2 populate_sdk_base: ensure that filenames with empty space character are handled
In reply to João Henrique Ferreira de FreitasWhen extracting toolchain, if the list $executable_files has filenames with empty space character, the list will created but relocate_sdk.sh will not handle it well. This will lead to the below erro:
./tmp/deploy/sdk/buildtools-mytools-x86_64-nativesdk-standalone-1.6.1.0.sh
Enter target directory for SDK (default: /opt/mydistro/mytoolset/1.6.1.0):
You are about to install the SDK to "/opt/mydistro/mytoolset/1.6.1.0". Proceed[Y/n]?
Extracting SDK...done
Setting it up.../opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: sintaxe error `token' `('
/opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: `eThe same occurs with replacement of ${SDKPATH} in configs/scripts/etc files.
We should ensure that full path is protected before relocate_sdk.sh and ${SDKPATH} replacement calls.
--- meta/classes/populate_sdk_base.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/populate_sdk_base.bbclass +2 -2
@@ -252,7 +252,7 @@ if [ "$dl_path" = "" ] ; then echo "SDK could not be set up. Relocate script unable to find ld-linux.so. Abort!" exit 1 fi -executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111) +executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111 -printf "'%h/%f' ") tdir=`mktemp -d` if [ x$tdir = x ] ; then
@@ -273,7 +273,7 @@ if [ $relocate = 1 ] ; then fi # replace ${SDKPATH} with the new prefix in all text files: configs/scripts/etc -$SUDO_EXEC find $native_sysroot -type f -exec file '{}' \;|grep ":.*\(ASCII\|script\|source\).*text"|cut -d':' -f1|$SUDO_EXEC xargs sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" +$SUDO_EXEC find $native_sysroot -type f -exec file '{}' \;|grep ":.*\(ASCII\|script\|source\).*text"|cut -d':' -f1|tr "\n" "\0"|$SUDO_EXEC xargs -0 sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" # change all symlinks pointing to ${SDKPATH} for l in $($SUDO_EXEC find $native_sysroot -type l); do
Signature · 1 line
1.9.1
Re: [PATCH v2 2/2] populate_sdk_base: ensure that filenames with empty space character are handled
Quoted 11 lines · João Henrique Ferreira de Freitas
When extracting toolchain, if the list $executable_files has filenames with empty space character, the list will created but
relocate_sdk.shwill not handle it well. This will lead to the below erro:./tmp/deploy/sdk/buildtools-mytools-x86_64-nativesdk-standalone-1.6.1.0.sh Enter target directory for SDK (default: /opt/mydistro/mytoolset/1.6.1.0): You are about to install the SDK to "/opt/mydistro/mytoolset/1.6.1.0". Proceed[Y/n]? Extracting SDK...done Setting it up.../opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: sintaxe error `token' `(' /opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: `e
Quoted 6 lines
The same occurs with replacement of ${SDKPATH} in configs/scripts/etc files.
We should ensure that full path is protected before
relocate_sdk.shand ${SDKPATH} replacement calls.Signed-off-by João Henrique Ferreira de Freitas <[email protected]>
I am wondering if we cannot get rid of the 'tr' command that converts newlines to '\0'. This would avoid a new fork of command. Did you think about it?
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Re: [PATCH v2 2/2] populate_sdk_base: ensure that filenames with empty space character are handled
Em 15-07-2014 10:33, Otavio Salvador escreveu:
Quoted 15 lines
Quoted 13 lines · João Henrique Ferreira de Freitas
When extracting toolchain, if the list $executable_files has filenames with empty space character, the list will created but
relocate_sdk.shwill not handle it well. This will lead to the below erro:./tmp/deploy/sdk/buildtools-mytools-x86_64-nativesdk-standalone-1.6.1.0.sh Enter target directory for SDK (default: /opt/mydistro/mytoolset/1.6.1.0): You are about to install the SDK to "/opt/mydistro/mytoolset/1.6.1.0". Proceed[Y/n]? Extracting SDK...done Setting it up.../opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: sintaxe error `token' `(' /opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: `eThe same occurs with replacement of ${SDKPATH} in configs/scripts/etc files.
Quoted 8 lines
Quoted 4 lines
We should ensure that full path is protected before
relocate_sdk.shand ${SDKPATH} replacement calls.Signed-off-by João Henrique Ferreira de Freitas <[email protected]>I am wondering if we cannot get rid of the 'tr' command that converts newlines to '\0'. This would avoid a new fork of command. Did you think about it?
I think it's possible. Maybe using: awk -F':' '{printf "%s\0", $1}' like this:
$SUDO_EXEC find $native_sysroot -type f -exec file '{}' \;|grep ":.*\(ASCII\|script\|source\).*text"|awk -F':' '{printf "%s\0", $1}'|$SUDO_EXEC xargs -0 sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g"
I will finish my tests before send a v3.
Thanks.
Signature · 2 lines
João Henrique Ferreira de Freitas - joaohf_at_gmail.com Campinas-SP-Brasil
v3 cover add nativesdk to BBCLASSEXTEND to python-distribute and to fix the side effect of it.
In reply to João Henrique Ferreira de FreitasChanges in v3:
- Use awk and remove two extra forks
João Henrique Ferreira de Freitas (2):
python-distribute: add nativesdk to BBCLASSEXTEND
populate_sdk_base: ensure that filenames with empty space character
are handled
meta/classes/populate_sdk_base.bbclass | 4 ++-- meta/recipes-devtools/python/python-distribute_0.6.32.bb | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
PATCH v3 1/2 python-distribute: add nativesdk to BBCLASSEXTEND
Without this, python tools that need python-distribute doesn't install in SDK generated by OE.
--- meta/recipes-devtools/python/python-distribute_0.6.32.bb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-devtools/python/python-distribute_0.6.32.bb +7 -1
@@ -39,6 +39,12 @@ do_install_append() { echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth } +do_install_append_class-nativesdk() { + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${PYTHON_SITEPACKAGES_DIR}/distribute-${PV}-py${PYTHON_BASEVERSION}.egg/setuptools/tests/test_resources.py + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install + sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install-${PYTHON_BASEVERSION} +} + RDEPENDS_${PN} = "\ python-distutils \ python-compression \
@@ -46,4 +52,4 @@ RDEPENDS_${PN} = "\ RPROVIDES_${PN} += "python-setuptools" -BBCLASSEXTEND = "native" +BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
1.9.1
PATCH v3 2/2 populate_sdk_base: ensure that filenames with empty space character are handled
In reply to João Henrique Ferreira de FreitasWhen extracting toolchain, if the list $executable_files has filenames with empty space character, the list will created but relocate_sdk.sh will not handle it well. This will lead to the below erro:
./tmp/deploy/sdk/buildtools-mytools-x86_64-nativesdk-standalone-1.6.1.0.sh
Enter target directory for SDK (default: /opt/mydistro/mytoolset/1.6.1.0):
You are about to install the SDK to "/opt/mydistro/mytoolset/1.6.1.0". Proceed[Y/n]?
Extracting SDK...done
Setting it up.../opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: sintaxe error `token' `('
/opt/mydistro/mytoolset/1.6.1.0/relocate_sdk.sh: line 2: `eThe same occurs with replacement of ${SDKPATH} in configs/scripts/etc files.
We should ensure that full path is protected before relocate_sdk.sh and ${SDKPATH} replacement calls.
--- meta/classes/populate_sdk_base.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/populate_sdk_base.bbclass +2 -2
@@ -252,7 +252,7 @@ if [ "$dl_path" = "" ] ; then echo "SDK could not be set up. Relocate script unable to find ld-linux.so. Abort!" exit 1 fi -executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111) +executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111 -printf "'%h/%f' ") tdir=`mktemp -d` if [ x$tdir = x ] ; then
@@ -273,7 +273,7 @@ if [ $relocate = 1 ] ; then fi # replace ${SDKPATH} with the new prefix in all text files: configs/scripts/etc -$SUDO_EXEC find $native_sysroot -type f -exec file '{}' \;|grep ":.*\(ASCII\|script\|source\).*text"|cut -d':' -f1|$SUDO_EXEC xargs sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" +$SUDO_EXEC find $native_sysroot -type f -exec file '{}' \;|grep ":.*\(ASCII\|script\|source\).*text"|awk -F':' '{printf "%s\0", $1}'|$SUDO_EXEC xargs -0 sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" # change all symlinks pointing to ${SDKPATH} for l in $($SUDO_EXEC find $native_sysroot -type l); do
Signature · 1 line
1.9.1