classes/patch: return non-patch source items
v2 cover classes/patch: return non-patch source items
Richard,
Here's v2 of this request.
Changes since v1:
- Changed the parameter to src_patches from 'type' to 'all, and make it a boolean versus a magic string
- Changed the name of 'others' to 'sources in the collecting list.
With the name 'all' as the parameter, you may think that it would return patches + non-patches instead of just non-patches. But that's largely a property of the new variable name. I'd rather keep them separate and really not return a mix of patches and non-patches. If we think this will cause confusion, I can always change the name of the variable again.
Below is the original request:
When working with Tom on some BSP usability cases, he noted that it was nice that we can specify more complex features in the SRC_URI now that patch ordering and location is maintained by using the src_patches abstraction that Chris added to patch.bbclass. But .. there's always a but, you had to specify some sort of patch to trigger the processing.
Rather than hack something in that is specific to linux-yocto, it seemed like a good idea to add the ability to get 'anything that isn't a patch' from the same routines that Chris added to patch.bbclass.
I'm now using this support to pickup all sorts of things from the SRC_URI, without knowing anything about the format of the SRC_URI itself. Extra filtering on 'other' is the responsibility of the caller.
I'm not the worlds top python coder yet, so I'm sure there are better ways to do this, hence why I'm calling this an RFC patch. I can re-work it as appropriate to get it into the tree, and I'll follow up with my user of the new functionality.
Cheers,
Bruce
PATCH 1/1 classes/patch: optionally return non-patch sources
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.
--- meta/classes/patch.bbclass | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
meta/classes/patch.bbclass +8 -1
@@ -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):
Signature · 1 line
1.7.4.1
Richard Purdie
AppliedRe: [PATCH] classes/patch: optionally return non-patch sources
Quoted 11 lines · Bruce Ashfield
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_URIthat 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 theSRC_URIto locate out of tree kernel features.
Quoted 8 lines
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 <[email protected]>--- meta/classes/patch.bbclass | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
Merged to master, thanks.
Richard