Openembedded Devel Discussions
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: [PATCH] patch.bbclass: conditional patch-tool dependency
Date: Tue, 21 Dec 2010 18:19:59 +0100	[thread overview]
Message-ID: <1292951999-18969-2-git-send-email-rep.dot.nop@gmail.com> (raw)
In-Reply-To: <1292951999-18969-1-git-send-email-rep.dot.nop@gmail.com>

only depend do_patch on patch-tool if recipe references any patch

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 classes/patch.bbclass |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/classes/patch.bbclass b/classes/patch.bbclass
index 7629e9a..1cfe24c 100644
--- a/classes/patch.bbclass
+++ b/classes/patch.bbclass
@@ -38,7 +38,7 @@ python patch_do_patch() {
 	src_uri = d.getVar("SRC_URI", True).split()
 	srcurldata = bb.fetch.init(src_uri, d, True)
 	workdir = bb.data.getVar('WORKDIR', d, 1)
-	for url in d.getVar("SRC_URI", True).split():
+	for url in src_uri:
 		urldata = srcurldata[url]
 
 		local = urldata.localpath
@@ -120,8 +120,25 @@ python patch_do_patch() {
 			bb.fatal(str(exc))
 }
 
+def patch_deps(d):
+    import oe.unpack
+
+    src_uri = d.getVar("SRC_URI", True).split()
+    srcurldata = bb.fetch.init(src_uri, d, True)
+    for url in src_uri:
+        urldata = srcurldata[url]
+        local = urldata.localpath
+        if local:
+            base, ext = os.path.splitext(os.path.basename(local))
+            if ext in ('.gz', '.bz2', '.Z', '.xz'):
+                local = base
+            if oe.unpack.is_patch(local, urldata.parm):
+                return "${PATCHDEPENDENCY}"
+    return ""
+        
+
 addtask patch after do_unpack
 do_patch[dirs] = "${WORKDIR}"
-do_patch[depends] = "${PATCHDEPENDENCY}"
+do_patch[depends] = "${@patch_deps(d)}"
 
 EXPORT_FUNCTIONS do_patch
-- 
1.7.2.3




  reply	other threads:[~2010-12-21 17:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-21 17:19 [PATCH] conditional patch-tool dep Bernhard Reutner-Fischer
2010-12-21 17:19 ` Bernhard Reutner-Fischer [this message]
2011-01-03 19:54   ` [PATCH] patch.bbclass: conditional patch-tool dependency Bernhard Reutner-Fischer
2011-01-05 12:39   ` Leon Woestenberg

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=1292951999-18969-2-git-send-email-rep.dot.nop@gmail.com \
    --to=rep.dot.nop@gmail.com \
    --cc=openembedded-devel@lists.openembedded.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox