All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] conditional patch-tool dep
@ 2010-12-21 17:19 Bernhard Reutner-Fischer
  2010-12-21 17:19 ` [PATCH] patch.bbclass: conditional patch-tool dependency Bernhard Reutner-Fischer
  0 siblings, 1 reply; 4+ messages in thread
From: Bernhard Reutner-Fischer @ 2010-12-21 17:19 UTC (permalink / raw)
  To: openembedded-devel

Hi,

If a recipe doesn't reference any patch then patching doesn't make sense
and neither does depending on patch-tool.

I didn't look yet if i can say
addtask patch after do_unpack if needs_patching_at_all(d)
(or something like that).
So, for a start, don't depend do_patch on the patch tool if there is no
patch in the SRC_URI.

untested.

PS: There should be some oe.is_compressed(uri) shorthand that is used to
decide if an uri is in a compressed format, imho.

Bernhard Reutner-Fischer (1):
  patch.bbclass: conditional patch-tool dependency

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

-- 
1.7.2.3




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] patch.bbclass: conditional patch-tool dependency
  2010-12-21 17:19 [PATCH] conditional patch-tool dep Bernhard Reutner-Fischer
@ 2010-12-21 17:19 ` Bernhard Reutner-Fischer
  2011-01-03 19:54   ` Bernhard Reutner-Fischer
  2011-01-05 12:39   ` Leon Woestenberg
  0 siblings, 2 replies; 4+ messages in thread
From: Bernhard Reutner-Fischer @ 2010-12-21 17:19 UTC (permalink / raw)
  To: openembedded-devel

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




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] patch.bbclass: conditional patch-tool dependency
  2010-12-21 17:19 ` [PATCH] patch.bbclass: conditional patch-tool dependency Bernhard Reutner-Fischer
@ 2011-01-03 19:54   ` Bernhard Reutner-Fischer
  2011-01-05 12:39   ` Leon Woestenberg
  1 sibling, 0 replies; 4+ messages in thread
From: Bernhard Reutner-Fischer @ 2011-01-03 19:54 UTC (permalink / raw)
  To: openembedded-devel

On Tue, Dec 21, 2010 at 06:19:59PM +0100, Bernhard Reutner-Fischer wrote:
>only depend do_patch on patch-tool if recipe references any patch

ping?
>
>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
>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] patch.bbclass: conditional patch-tool dependency
  2010-12-21 17:19 ` [PATCH] patch.bbclass: conditional patch-tool dependency Bernhard Reutner-Fischer
  2011-01-03 19:54   ` Bernhard Reutner-Fischer
@ 2011-01-05 12:39   ` Leon Woestenberg
  1 sibling, 0 replies; 4+ messages in thread
From: Leon Woestenberg @ 2011-01-05 12:39 UTC (permalink / raw)
  To: openembedded-devel

Hello,

On Tue, Dec 21, 2010 at 6:19 PM, Bernhard Reutner-Fischer
<rep.dot.nop@gmail.com> wrote:
> only depend do_patch on patch-tool if recipe references any patch
>
> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
> ---

Untested but I like it.

Acked-by: Leon Woestenberg <leon@sidebranch.com>

-- 
Leon



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-05 12:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-21 17:19 [PATCH] conditional patch-tool dep Bernhard Reutner-Fischer
2010-12-21 17:19 ` [PATCH] patch.bbclass: conditional patch-tool dependency Bernhard Reutner-Fischer
2011-01-03 19:54   ` Bernhard Reutner-Fischer
2011-01-05 12:39   ` Leon Woestenberg

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.