[oe-commits] Bernhard Reutner-Fischer : patch.bbclass: conditional patch-tool dependency

git version control git at git.openembedded.org
Tue Jan 11 20:38:15 UTC 2011


Module: openembedded.git
Branch: master
Commit: 0f2330dd7a03d4a2ffa46f44a94aa2218127dd3b
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=0f2330dd7a03d4a2ffa46f44a94aa2218127dd3b

Author: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
Date:   Tue Dec 21 13:40:52 2010 +0100

patch.bbclass: conditional patch-tool dependency

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

The whole of do_patch should be gated through a facility to determine if
there is any patch at all. TODO.

Acked-by: Leon Woestenberg <leon at sidebranch.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>

---

 classes/patch.bbclass |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/classes/patch.bbclass b/classes/patch.bbclass
index bc52ae7..edfb5e9 100644
--- a/classes/patch.bbclass
+++ b/classes/patch.bbclass
@@ -43,7 +43,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
@@ -97,7 +97,7 @@ python patch_do_patch() {
 				continue
 
 		if "maxrev" in parm:
-			srcrev = bb.data.getVar('SRCREV', d, 1)		
+			srcrev = bb.data.getVar('SRCREV', d, 1)
 			if srcrev and srcrev > parm["maxrev"]:
 				bb.note("Patch '%s' applies to earlier revisions" % pname)
 				continue
@@ -125,8 +125,24 @@ 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





More information about the Openembedded-commits mailing list