[v3] distutils.bbclass: only modify *.py file if it contains path to be removed

Submitted by Radek Dostal on May 5, 2014, 7:38 a.m. | Patch ID: 71495


Message ID 1399275502-13602-1-git-send-email-radek.dostal@streamunlimited.com
State Accepted
Commit 2d01c5a4989dcf03a202c27730a2a8f334e0c37a
Headers show

Commit Message

Radek Dostal May 5, 2014, 7:38 a.m.
Currently sed command touches every single *.py file. This modifies the
timestamp of the file. All *.pyo files will be recompiled during the first
boot, because timestamp will not match. This should be only necessary if
sed command changes the file.

Signed-off-by: Radek Dostal <radek.dostal@streamunlimited.com>
 meta/classes/distutils.bbclass |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/meta/classes/distutils.bbclass b/meta/classes/distutils.bbclass
index f3da023..12f2603 100644
--- a/meta/classes/distutils.bbclass
+++ b/meta/classes/distutils.bbclass
@@ -43,7 +43,10 @@  distutils_do_install() {
         # support filenames with *spaces*
         find ${D} -name "*.py" -print0 | while read -d $'\0' i ; do \
-            sed -i -e s:${D}::g "$i"
+            # 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
         if test -e ${D}${bindir} ; then