Patchwork distutils/distutils3: Fix bashism

login
register
mail settings
Submitter Richard Purdie
Date June 27, 2014, 9:23 a.m.
Message ID <1403861003.28648.3.camel@ted>
Download mbox | patch
Permalink /patch/74425/
State Accepted
Commit 946fb184bf986b8bde2fe0502d48f69bc7cd4a18
Headers show

Comments

Richard Purdie - June 27, 2014, 9:23 a.m.
read -d is a bashism. Replace with a direct exec to avoid the problem
in this case. This fixes silent build failures in do_install of
tasks on systems with dash as /bin/sh.

Also merge the fix to distutils for only changing necessary files
to disutils3 as well.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

Patch

diff --git a/meta/classes/distutils.bbclass b/meta/classes/distutils.bbclass
index 12f2603..6ed7ecc 100644
--- a/meta/classes/distutils.bbclass
+++ b/meta/classes/distutils.bbclass
@@ -42,12 +42,8 @@  distutils_do_install() {
         bbfatal "${PYTHON_PN} setup.py install execution failed."
 
         # support filenames with *spaces*
-        find ${D} -name "*.py" -print0 | while read -d $'\0' i ; do \
-            # only modify file if it contains path to avoid recompilation on the target
-            if grep -q "${D}" "$i"; then
-                sed -i -e s:${D}::g "$i"
-            fi
-        done
+        # only modify file if it contains path to avoid recompilation on the target
+        find ${D} -name "*.py" -exec grep -q ${D} {} \; -exec sed -i -e s:${D}::g {} \;
 
         if test -e ${D}${bindir} ; then	
             for i in ${D}${bindir}/* ; do \
diff --git a/meta/classes/distutils3.bbclass b/meta/classes/distutils3.bbclass
index bbd645c..e909ef4 100644
--- a/meta/classes/distutils3.bbclass
+++ b/meta/classes/distutils3.bbclass
@@ -64,9 +64,7 @@  distutils3_do_install() {
         bbfatal "${PYTHON_PN} setup.py install execution failed."
 
         # support filenames with *spaces*
-        find ${D} -name "*.py" -print0 | while read -d $'\0' i ; do \
-            sed -i -e s:${D}::g "$i"
-        done
+        find ${D} -name "*.py" -exec grep -q ${D} {} \; -exec sed -i -e s:${D}::g {} \;
 
         if test -e ${D}${bindir} ; then	
             for i in ${D}${bindir}/* ; do \