All of lore.kernel.org
 help / color / mirror / Atom feed
From: Radek Dostal <radek.dostal@streamunlimited.com>
To: richard.purdie@linuxfoundation.org
Cc: Radek Dostal <radek.dostal@streamunlimited.com>,
	openembedded-core@lists.openembedded.org
Subject: [PATCH] distutils.bbclass: only modify *.py file if it contains path to be removed
Date: Fri,  2 May 2014 11:00:18 +0200	[thread overview]
Message-ID: <1399021218-27441-1-git-send-email-radek.dostal@streamunlimited.com> (raw)
In-Reply-To: <1398872793.16672.526.camel@ted>

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 |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/classes/distutils.bbclass b/meta/classes/distutils.bbclass
index f3da023..18e1a34 100644
--- a/meta/classes/distutils.bbclass
+++ b/meta/classes/distutils.bbclass
@@ -43,7 +43,11 @@ 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 "${D}" "$i") >/dev/null 2>&1
+            then
+                sed -i -e s:${D}::g "$i"
+            fi
         done
 
         if test -e ${D}${bindir} ; then	
-- 
1.7.9.5



  reply	other threads:[~2014-05-02  9:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30 13:01 [PATCH] distutils.bbclass: only modify *.py file if it contains path to be removed Radek Dostal
2014-04-30 15:46 ` Richard Purdie
2014-05-02  9:00   ` Radek Dostal [this message]
2014-05-03  1:36     ` Christopher Larson
2014-05-05  7:38       ` [PATCH v3] " Radek Dostal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399021218-27441-1-git-send-email-radek.dostal@streamunlimited.com \
    --to=radek.dostal@streamunlimited.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.