* Re: [PATCH] cooker.py: allow dangling bbappends if explicitly whitelisted
2017-06-02 12:58 ` Richard Purdie
@ 2017-06-02 13:06 ` Patrick Ohly
2017-06-02 13:26 ` Mark Hatle
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: Patrick Ohly @ 2017-06-02 13:06 UTC (permalink / raw)
To: Richard Purdie; +Cc: bitbake-devel
On Fri, 2017-06-02 at 13:58 +0100, Richard Purdie wrote:
> I'm wondering if there is a hybrid solution if we extend this syntax a
> little, e.g.:
>
> BBFILES_DYNAMIC += "\
> XXXX:${LAYERDIR}/optional-bbappends-XXX/recipes-*/*/*.bbappend
> YYYY:${LAYERDIR}/optional-bbappends-YYY/recipes-*/*/*.bbappend
> "
>
> so that the code only applies these BBFILES entries if the layer named
> in the first parameter is present?
>
> This would happen at the end of parsing so ordering becomes a moot
> point. The direction you stack BBFILES_DYANMIC in would determin
> bbappend application order.
>
> How does that sound to people?
Sounds good to me.
--
Best Regards, Patrick Ohly
The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] cooker.py: allow dangling bbappends if explicitly whitelisted
2017-06-02 12:58 ` Richard Purdie
2017-06-02 13:06 ` Patrick Ohly
@ 2017-06-02 13:26 ` Mark Hatle
2017-06-02 13:42 ` Christopher Larson
2017-06-02 16:14 ` Patrick Ohly
2017-06-07 9:03 ` [PATCH] cookerdata: Add support for BBFILES_DYNAMIC Patrick Ohly
3 siblings, 1 reply; 12+ messages in thread
From: Mark Hatle @ 2017-06-02 13:26 UTC (permalink / raw)
To: Richard Purdie, Patrick Ohly, bitbake-devel
On 6/2/17 7:58 AM, Richard Purdie wrote:
> On Mon, 2017-05-22 at 12:50 +0200, Patrick Ohly wrote:
>> Having a .bbappend without corresponding .bb file triggers an error
>> or
>> at least warning, depending on the global
>> BB_DANGLINGAPPENDS_WARNONLY.
>>
>> Some layers (for example, meta-freescale) avoid that message by only
>> adding .bbappends to the BBFILES when the layers they apply to are
>> present. Others (like intel-iot-refkit) avoid such .bbappends by
>> falling back to global assignments with _pn-<recipe> as override.
>> Both
>> is complicated.
>>
>> Now the warning code checks BBAPPENDS_DANGLING_WHITELIST and ignores
>> all bbappends which match a file pattern in that list. This is an
>> easier way to have bbappends which may or may not apply to an
>> existing recipe.
>>
>> Example usage:
>>
>> # We have recipes-* directories, add to BBFILES
>> BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
>> ${LAYERDIR}/optional-bbappends/recipes-*/*/*.bbappend \
>> ${LAYERDIR}/recipes-*/*/*.bbappend"
>>
>> # Several of our *.bbappends might be for layers that are not
>> # guaranteed to be present. Don't warn or even error out because
>> # of those.
>> BBAPPENDS_DANGLING_WHITELIST += "${LAYERDIR}/optional-
>> bbappends/recipes-*/*/*.bbappend"
>
> I've been giving this some thought. The freescale layer approach does
> have ordering issues which I don't like. Equally, Chris' comment about
> this is also a valid concern. Experience suggests saying the layer
> maintainer needs to be careful doesn't work in practise.
>
> I'm wondering if there is a hybrid solution if we extend this syntax a
> little, e.g.:
>
> BBFILES_DYNAMIC += "\
> XXXX:${LAYERDIR}/optional-bbappends-XXX/recipes-*/*/*.bbappend
> YYYY:${LAYERDIR}/optional-bbappends-YYY/recipes-*/*/*.bbappend
> "
>
> so that the code only applies these BBFILES entries if the layer named
> in the first parameter is present?
>
> This would happen at the end of parsing so ordering becomes a moot
> point. The direction you stack BBFILES_DYANMIC in would determin
> bbappend application order.
>
> How does that sound to people?
That sounds reasonable to me, and has a precedent in the package_dynamic as well.
--Mark
> Cheers,
>
> Richard
>
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] cooker.py: allow dangling bbappends if explicitly whitelisted
2017-06-02 13:26 ` Mark Hatle
@ 2017-06-02 13:42 ` Christopher Larson
0 siblings, 0 replies; 12+ messages in thread
From: Christopher Larson @ 2017-06-02 13:42 UTC (permalink / raw)
To: Mark Hatle; +Cc: bitbake-devel@lists.openembedded.org
[-- Attachment #1: Type: text/plain, Size: 2608 bytes --]
On Fri, Jun 2, 2017 at 6:26 AM, Mark Hatle <mark.hatle@windriver.com> wrote:
> On 6/2/17 7:58 AM, Richard Purdie wrote:
> > On Mon, 2017-05-22 at 12:50 +0200, Patrick Ohly wrote:
> >> Having a .bbappend without corresponding .bb file triggers an error
> >> or
> >> at least warning, depending on the global
> >> BB_DANGLINGAPPENDS_WARNONLY.
> >>
> >> Some layers (for example, meta-freescale) avoid that message by only
> >> adding .bbappends to the BBFILES when the layers they apply to are
> >> present. Others (like intel-iot-refkit) avoid such .bbappends by
> >> falling back to global assignments with _pn-<recipe> as override.
> >> Both
> >> is complicated.
> >>
> >> Now the warning code checks BBAPPENDS_DANGLING_WHITELIST and ignores
> >> all bbappends which match a file pattern in that list. This is an
> >> easier way to have bbappends which may or may not apply to an
> >> existing recipe.
> >>
> >> Example usage:
> >>
> >> # We have recipes-* directories, add to BBFILES
> >> BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
> >> ${LAYERDIR}/optional-bbappends/recipes-*/*/*.bbappend \
> >> ${LAYERDIR}/recipes-*/*/*.bbappend"
> >>
> >> # Several of our *.bbappends might be for layers that are not
> >> # guaranteed to be present. Don't warn or even error out because
> >> # of those.
> >> BBAPPENDS_DANGLING_WHITELIST += "${LAYERDIR}/optional-
> >> bbappends/recipes-*/*/*.bbappend"
> >
> > I've been giving this some thought. The freescale layer approach does
> > have ordering issues which I don't like. Equally, Chris' comment about
> > this is also a valid concern. Experience suggests saying the layer
> > maintainer needs to be careful doesn't work in practise.
> >
> > I'm wondering if there is a hybrid solution if we extend this syntax a
> > little, e.g.:
> >
> > BBFILES_DYNAMIC += "\
> > XXXX:${LAYERDIR}/optional-bbappends-XXX/recipes-*/*/*.bbappend
> > YYYY:${LAYERDIR}/optional-bbappends-YYY/recipes-*/*/*.bbappend
> > "
> >
> > so that the code only applies these BBFILES entries if the layer named
> > in the first parameter is present?
> >
> > This would happen at the end of parsing so ordering becomes a moot
> > point. The direction you stack BBFILES_DYANMIC in would determin
> > bbappend application order.
> >
> > How does that sound to people?
>
> That sounds reasonable to me, and has a precedent in the package_dynamic
> as well.
Agreed.
--
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
[-- Attachment #2: Type: text/html, Size: 3553 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] cooker.py: allow dangling bbappends if explicitly whitelisted
2017-06-02 12:58 ` Richard Purdie
2017-06-02 13:06 ` Patrick Ohly
2017-06-02 13:26 ` Mark Hatle
@ 2017-06-02 16:14 ` Patrick Ohly
2017-06-02 16:20 ` Mark Hatle
2017-06-07 9:03 ` [PATCH] cookerdata: Add support for BBFILES_DYNAMIC Patrick Ohly
3 siblings, 1 reply; 12+ messages in thread
From: Patrick Ohly @ 2017-06-02 16:14 UTC (permalink / raw)
To: Richard Purdie; +Cc: bitbake-devel
On Fri, 2017-06-02 at 13:58 +0100, Richard Purdie wrote:
> On Mon, 2017-05-22 at 12:50 +0200, Patrick Ohly wrote:
> > Having a .bbappend without corresponding .bb file triggers an error
> > or
> > at least warning, depending on the global
> > BB_DANGLINGAPPENDS_WARNONLY.
> >
> > Some layers (for example, meta-freescale) avoid that message by only
> > adding .bbappends to the BBFILES when the layers they apply to are
> > present. Others (like intel-iot-refkit) avoid such .bbappends by
> > falling back to global assignments with _pn-<recipe> as override.
> > Both
> > is complicated.
> >
> > Now the warning code checks BBAPPENDS_DANGLING_WHITELIST and ignores
> > all bbappends which match a file pattern in that list. This is an
> > easier way to have bbappends which may or may not apply to an
> > existing recipe.
> >
> > Example usage:
> >
> > # We have recipes-* directories, add to BBFILES
> > BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
> > ${LAYERDIR}/optional-bbappends/recipes-*/*/*.bbappend \
> > ${LAYERDIR}/recipes-*/*/*.bbappend"
> >
> > # Several of our *.bbappends might be for layers that are not
> > # guaranteed to be present. Don't warn or even error out because
> > # of those.
> > BBAPPENDS_DANGLING_WHITELIST += "${LAYERDIR}/optional-
> > bbappends/recipes-*/*/*.bbappend"
>
> I've been giving this some thought. The freescale layer approach does
> have ordering issues which I don't like. Equally, Chris' comment about
> this is also a valid concern. Experience suggests saying the layer
> maintainer needs to be careful doesn't work in practise.
>
> I'm wondering if there is a hybrid solution if we extend this syntax a
> little, e.g.:
>
> BBFILES_DYNAMIC += "\
> XXXX:${LAYERDIR}/optional-bbappends-XXX/recipes-*/*/*.bbappend
> YYYY:${LAYERDIR}/optional-bbappends-YYY/recipes-*/*/*.bbappend
> "
>
> so that the code only applies these BBFILES entries if the layer named
> in the first parameter is present?
>
> This would happen at the end of parsing so ordering becomes a moot
> point. The direction you stack BBFILES_DYANMIC in would determin
> bbappend application order.
While the usecase above was for .bbappends, would the same also make
sense for .bb files, and would that change the implementation? Perhaps
not.
The use case would be a .bb which depends on something in a layer which
may or may not be present. It's a bit harder, though, because it's not
always as clear as for the .bbappend case where something comes from
that a recipe depends on.
--
Best Regards, Patrick Ohly
The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] cooker.py: allow dangling bbappends if explicitly whitelisted
2017-06-02 16:14 ` Patrick Ohly
@ 2017-06-02 16:20 ` Mark Hatle
0 siblings, 0 replies; 12+ messages in thread
From: Mark Hatle @ 2017-06-02 16:20 UTC (permalink / raw)
To: Patrick Ohly, Richard Purdie; +Cc: bitbake-devel
On 6/2/17 11:14 AM, Patrick Ohly wrote:
> On Fri, 2017-06-02 at 13:58 +0100, Richard Purdie wrote:
>> On Mon, 2017-05-22 at 12:50 +0200, Patrick Ohly wrote:
>>> Having a .bbappend without corresponding .bb file triggers an error
>>> or
>>> at least warning, depending on the global
>>> BB_DANGLINGAPPENDS_WARNONLY.
>>>
>>> Some layers (for example, meta-freescale) avoid that message by only
>>> adding .bbappends to the BBFILES when the layers they apply to are
>>> present. Others (like intel-iot-refkit) avoid such .bbappends by
>>> falling back to global assignments with _pn-<recipe> as override.
>>> Both
>>> is complicated.
>>>
>>> Now the warning code checks BBAPPENDS_DANGLING_WHITELIST and ignores
>>> all bbappends which match a file pattern in that list. This is an
>>> easier way to have bbappends which may or may not apply to an
>>> existing recipe.
>>>
>>> Example usage:
>>>
>>> # We have recipes-* directories, add to BBFILES
>>> BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
>>> ${LAYERDIR}/optional-bbappends/recipes-*/*/*.bbappend \
>>> ${LAYERDIR}/recipes-*/*/*.bbappend"
>>>
>>> # Several of our *.bbappends might be for layers that are not
>>> # guaranteed to be present. Don't warn or even error out because
>>> # of those.
>>> BBAPPENDS_DANGLING_WHITELIST += "${LAYERDIR}/optional-
>>> bbappends/recipes-*/*/*.bbappend"
>>
>> I've been giving this some thought. The freescale layer approach does
>> have ordering issues which I don't like. Equally, Chris' comment about
>> this is also a valid concern. Experience suggests saying the layer
>> maintainer needs to be careful doesn't work in practise.
>>
>> I'm wondering if there is a hybrid solution if we extend this syntax a
>> little, e.g.:
>>
>> BBFILES_DYNAMIC += "\
>> XXXX:${LAYERDIR}/optional-bbappends-XXX/recipes-*/*/*.bbappend
>> YYYY:${LAYERDIR}/optional-bbappends-YYY/recipes-*/*/*.bbappend
>> "
>>
>> so that the code only applies these BBFILES entries if the layer named
>> in the first parameter is present?
>>
>> This would happen at the end of parsing so ordering becomes a moot
>> point. The direction you stack BBFILES_DYANMIC in would determin
>> bbappend application order.
>
> While the usecase above was for .bbappends, would the same also make
> sense for .bb files, and would that change the implementation? Perhaps
> not.
>
> The use case would be a .bb which depends on something in a layer which
> may or may not be present. It's a bit harder, though, because it's not
> always as clear as for the .bbappend case where something comes from
> that a recipe depends on.
>
My assumption is the (new) BBFILES_DYNAMIC should have the same format as the
existing BBFILES. So it will work for both bbappend and bb files.
--Mark
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] cookerdata: Add support for BBFILES_DYNAMIC
2017-06-02 12:58 ` Richard Purdie
` (2 preceding siblings ...)
2017-06-02 16:14 ` Patrick Ohly
@ 2017-06-07 9:03 ` Patrick Ohly
3 siblings, 0 replies; 12+ messages in thread
From: Patrick Ohly @ 2017-06-07 9:03 UTC (permalink / raw)
To: bitbake-devel
BBFILES_DYNAMIC can be used to activate content only when some other
layers are present. The other layers are identified by the collections
that they define.
The main use case is to avoid .bbappends without the corresponding .bb
file in layers that want to modify other layers via .bbappends without
introducing a hard dependency on those other layers. .bb files could
also be handled via BBFILES_DYNAMIC.
Entries in BBFILES_DYNAMIC must have the form <collection
name>:<filename pattern>. Example usage:
BBFILES_DYNAMIC += " \
clang-layer:${LAYERDIR}/bbappends/meta-clang/*/*/*.bbappend \
core:${LAYERDIR}/bbappends/openembedded-core/meta/*/*/*.bbappend \
"
Parsing is aborted when invalid entries are found with an error
message like this:
ERROR: BBFILES_DYNAMIC entries must be of the form <collection name>:<filename pattern>, not:
/work/my-layer/bbappends/meta-security-isafw/*/*/*.bbappend
/work/my-layer/bbappends/openembedded-core/meta/*/*/*.bbappend
Based on a patch by Richard Purdie.
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
---
lib/bb/cookerdata.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py
index 722d860..aa96f54 100644
--- a/lib/bb/cookerdata.py
+++ b/lib/bb/cookerdata.py
@@ -346,6 +346,20 @@ class CookerDataBuilder(object):
data.delVar('LAYERDIR_RE')
data.delVar('LAYERDIR')
+ bbfiles_dynamic = (data.getVar('BBFILES_DYNAMIC') or "").split()
+ collections = (data.getVar('BBFILE_COLLECTIONS') or "").split()
+ invalid = []
+ for entry in bbfiles_dynamic:
+ parts = entry.split(":", 1)
+ if len(parts) != 2:
+ invalid.append(entry)
+ continue
+ l, f = parts
+ if l in collections:
+ data.appendVar("BBFILES", " " + f)
+ if invalid:
+ bb.fatal("BBFILES_DYNAMIC entries must be of the form <collection name>:<filename pattern>, not:\n %s" % "\n ".join(invalid))
+
if not data.getVar("BBPATH"):
msg = "The BBPATH variable is not set"
if not layerconf:
base-commit: 705ab252e631903e6d2e46202b419a9e8adcd861
--
git-series 0.9.1
^ permalink raw reply related [flat|nested] 12+ messages in thread