Patchwork classes/patch: optionally return non-patch sources

login
register
mail settings
Submitter Bruce Ashfield
Date Feb. 1, 2012, 6:55 p.m.
Message ID <1328122541-27434-2-git-send-email-bruce.ashfield@windriver.com>
Download mbox | patch
Permalink /patch/20505/
State Accepted
Commit 41e92923a0b2fe047ecaa9f9ffb564d6069f784f
Headers show

Comments

Bruce Ashfield - Feb. 1, 2012, 6:55 p.m.
commit:

  patch.bbclass: abstract out logic that determines patches to apply

gives the ability for other clases to emit series files for use outside
of a build system, or even within the build system. There are sometimes
elements on the SRC_URI that while not directly applicable to patching,
can be related to patching the package. For example, the yocto kernel
class would like to know about these other source items on the SRC_URI
to locate out of tree kernel features.

This change keeps the default behaviour of returning patches, but adds the
ability to request that non-patch results be returned.  Additional filtering
within the non-patch category, is left up to the caller of the routine.

Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
---
 meta/classes/patch.bbclass |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
Richard Purdie - Feb. 3, 2012, 4:51 p.m.
On Wed, 2012-02-01 at 13:55 -0500, Bruce Ashfield wrote:
> commit:
> 
>   patch.bbclass: abstract out logic that determines patches to apply
> 
> gives the ability for other clases to emit series files for use outside
> of a build system, or even within the build system. There are sometimes
> elements on the SRC_URI that while not directly applicable to patching,
> can be related to patching the package. For example, the yocto kernel
> class would like to know about these other source items on the SRC_URI
> to locate out of tree kernel features.
> 
> This change keeps the default behaviour of returning patches, but adds the
> ability to request that non-patch results be returned.  Additional filtering
> within the non-patch category, is left up to the caller of the routine.
> 
> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
> ---
>  meta/classes/patch.bbclass |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)

Merged to master, thanks.

Richard

Patch

diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 1ea4bc5..31db9e3 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -7,13 +7,17 @@  PATCHDEPENDENCY = "${PATCHTOOL}-native:do_populate_sysroot"
 
 inherit terminal
 
-def src_patches(d):
+def src_patches(d, all = False ):
 	workdir = d.getVar('WORKDIR', True)
 	fetch = bb.fetch2.Fetch([], d)
 	patches = []
+	sources = []
 	for url in fetch.urls:
 		local = patch_path(url, fetch, workdir)
 		if not local:
+			if all:
+				local = fetch.localpath(url)
+				sources.append(local)
 			continue
 
 		urldata = fetch.ud[url]
@@ -43,6 +47,9 @@  def src_patches(d):
 		localurl = bb.encodeurl(('file', '', local, '', '', patchparm))
 		patches.append(localurl)
 
+	if all:
+		return sources
+
 	return patches
 
 def patch_path(url, fetch, workdir):