* [RFC PATCH 0/1] classes/patch: return "other" elements found on the SRC_URI @ 2012-02-01 14:42 Bruce Ashfield 2012-02-01 14:42 ` [PATCH] " Bruce Ashfield 0 siblings, 1 reply; 4+ messages in thread From: Bruce Ashfield @ 2012-02-01 14:42 UTC (permalink / raw) To: richard.purdie; +Cc: chris_larson, openembedded-core Richard, 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 cc: Chris Larson <chris_larson@mentor.com> ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] classes/patch: return "other" elements found on the SRC_URI 2012-02-01 14:42 [RFC PATCH 0/1] classes/patch: return "other" elements found on the SRC_URI Bruce Ashfield @ 2012-02-01 14:42 ` Bruce Ashfield 2012-02-01 15:52 ` Richard Purdie 0 siblings, 1 reply; 4+ messages in thread From: Bruce Ashfield @ 2012-02-01 14:42 UTC (permalink / raw) To: richard.purdie; +Cc: chris_larson, openembedded-core 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' items on the SRC_URI to locate out of tree kernel features. This change keeps the default the same, but adds the ability to query for anything 'non-patch' that may be on the SRC_URI. Additional filtering is left up to the caller of the routine. Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> --- meta/classes/patch.bbclass | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass index 1ea4bc5..d664215 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, type = "patches"): workdir = d.getVar('WORKDIR', True) fetch = bb.fetch2.Fetch([], d) patches = [] + others = [] for url in fetch.urls: local = patch_path(url, fetch, workdir) if not local: + if type == "others": + local = fetch.localpath(url) + others.append(local) continue urldata = fetch.ud[url] @@ -43,7 +47,10 @@ def src_patches(d): localurl = bb.encodeurl(('file', '', local, '', '', patchparm)) patches.append(localurl) - return patches + if type == "others": + return others + else: + return patches def patch_path(url, fetch, workdir): """Return the local path of a patch, or None if this isn't a patch""" -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] classes/patch: return "other" elements found on the SRC_URI 2012-02-01 14:42 ` [PATCH] " Bruce Ashfield @ 2012-02-01 15:52 ` Richard Purdie 2012-02-01 15:56 ` Bruce Ashfield 0 siblings, 1 reply; 4+ messages in thread From: Richard Purdie @ 2012-02-01 15:52 UTC (permalink / raw) To: Bruce Ashfield; +Cc: chris_larson, openembedded-core On Wed, 2012-02-01 at 09:42 -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' items on the SRC_URI to > locate out of tree kernel features. > > This change keeps the default the same, but adds the ability to query > for anything 'non-patch' that may be on the SRC_URI. Additional filtering > is left up to the caller of the routine. > > Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> > --- > meta/classes/patch.bbclass | 11 +++++++++-- > 1 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass > index 1ea4bc5..d664215 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, type = "patches"): Knowing "magic" strings to pass to functions isn't very intuitive. You could do: +def src_patches(d, all = False): > workdir = d.getVar('WORKDIR', True) > fetch = bb.fetch2.Fetch([], d) > patches = [] > + others = [] > for url in fetch.urls: > local = patch_path(url, fetch, workdir) > if not local: > + if type == "others": > + local = fetch.localpath(url) > + others.append(local) > continue > > urldata = fetch.ud[url] > @@ -43,7 +47,10 @@ def src_patches(d): > localurl = bb.encodeurl(('file', '', local, '', '', patchparm)) > patches.append(localurl) > > - return patches > + if type == "others": > + return others > + else: > + return patches if all: return others return patches You might want to call it sources instead of others too. Cheers, Richard ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] classes/patch: return "other" elements found on the SRC_URI 2012-02-01 15:52 ` Richard Purdie @ 2012-02-01 15:56 ` Bruce Ashfield 0 siblings, 0 replies; 4+ messages in thread From: Bruce Ashfield @ 2012-02-01 15:56 UTC (permalink / raw) To: Richard Purdie; +Cc: chris_larson, openembedded-core On 12-02-01 10:52 AM, Richard Purdie wrote: > On Wed, 2012-02-01 at 09:42 -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' items on the SRC_URI to >> locate out of tree kernel features. >> >> This change keeps the default the same, but adds the ability to query >> for anything 'non-patch' that may be on the SRC_URI. Additional filtering >> is left up to the caller of the routine. >> >> Signed-off-by: Bruce Ashfield<bruce.ashfield@windriver.com> >> --- >> meta/classes/patch.bbclass | 11 +++++++++-- >> 1 files changed, 9 insertions(+), 2 deletions(-) >> >> diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass >> index 1ea4bc5..d664215 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, type = "patches"): > > Knowing "magic" strings to pass to functions isn't very intuitive. You > could do: I disliked it as well, but was stumped for something better at the time :) > > +def src_patches(d, all = False): > > >> workdir = d.getVar('WORKDIR', True) >> fetch = bb.fetch2.Fetch([], d) >> patches = [] >> + others = [] >> for url in fetch.urls: >> local = patch_path(url, fetch, workdir) >> if not local: >> + if type == "others": >> + local = fetch.localpath(url) >> + others.append(local) >> continue >> >> urldata = fetch.ud[url] >> @@ -43,7 +47,10 @@ def src_patches(d): >> localurl = bb.encodeurl(('file', '', local, '', '', patchparm)) >> patches.append(localurl) >> >> - return patches >> + if type == "others": >> + return others >> + else: >> + return patches > > if all: > return others > return patches > > You might want to call it sources instead of others too. Yep. Works for me. I'll do those fixups here. Cheers, Bruce > > Cheers, > > Richard > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-02-01 16:04 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-02-01 14:42 [RFC PATCH 0/1] classes/patch: return "other" elements found on the SRC_URI Bruce Ashfield 2012-02-01 14:42 ` [PATCH] " Bruce Ashfield 2012-02-01 15:52 ` Richard Purdie 2012-02-01 15:56 ` Bruce Ashfield
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox