* base.bbclass: Implement PACKAGECONFIG
@ 2011-10-06 14:18 Richard Purdie
2011-10-06 14:24 ` Martin Jansa
2011-10-06 14:46 ` Koen Kooi
0 siblings, 2 replies; 5+ messages in thread
From: Richard Purdie @ 2011-10-06 14:18 UTC (permalink / raw)
To: openembedded-core
These enabled options to be specified in the form:
PACKAGECONFIG ?? = "<default options>"
PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends"
So that DEPENDS, RDEPENDS_${PN} and EXTRA_OECONF can be automatically
built from specific options. Those options can easily be customised
by the distro config or the user.
Based on some ideas from Chris Elston <celston@katalix.com> but with
an improved easier to use one line interface.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 7cd6efa..f539744 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -291,6 +291,44 @@ do_build () {
python () {
import exceptions, string, re
+ # Handle PACKAGECONFIG
+ #
+ # These take the form:
+ #
+ # PACKAGECONFIG ?? = "<default options>"
+ # PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends"
+ pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split()
+ if pkgconfig:
+ def appendVar(varname, appends):
+ if not appends:
+ return
+ varname = bb.data.expand(varname, d)
+ content = d.getVar(varname, False) or ""
+ content = content + " " + " ".join(appends)
+ d.setVar(varname, content)
+
+ extradeps = []
+ extrardeps = []
+ extraconf = []
+ for flag, flagval in (d.getVarFlags("PACKAGECONFIG") or {}).items():
+ if flag == "defaultval":
+ continue
+ items = flagval.split(",")
+ if len(items) == 3:
+ enable, disable, depend = items
+ rdepend = ""
+ elif len(items) == 4:
+ enable, disable, depend, rdepend = items
+ if flag in pkgconfig:
+ extradeps.append(depend)
+ extrardeps.append(rdepend)
+ extraconf.append(enable)
+ else:
+ extraconf.append(disable)
+ appendVar('DEPENDS', extradeps)
+ appendVar('RDEPENDS_${PN}', extrardeps)
+ appendVar('EXTRA_OECONF', extraconf)
+
# If PRINC is set, try and increase the PR value by the amount specified
princ = bb.data.getVar('PRINC', d, True)
if princ:
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: base.bbclass: Implement PACKAGECONFIG
2011-10-06 14:18 base.bbclass: Implement PACKAGECONFIG Richard Purdie
@ 2011-10-06 14:24 ` Martin Jansa
2011-10-06 14:56 ` Richard Purdie
2011-10-06 14:46 ` Koen Kooi
1 sibling, 1 reply; 5+ messages in thread
From: Martin Jansa @ 2011-10-06 14:24 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
[-- Attachment #1: Type: text/plain, Size: 3201 bytes --]
On Thu, Oct 06, 2011 at 03:18:27PM +0100, Richard Purdie wrote:
> These enabled options to be specified in the form:
>
> PACKAGECONFIG ?? = "<default options>"
> PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends"
>
> So that DEPENDS, RDEPENDS_${PN} and EXTRA_OECONF can be automatically
> built from specific options. Those options can easily be customised
> by the distro config or the user.
>
> Based on some ideas from Chris Elston <celston@katalix.com> but with
> an improved easier to use one line interface.
1) How can user check on target if his package was built with foo enabled?
- is there some plan to keep this in ipk/deb metadata?
2) Is it possible to force some PACKAGECONFIG enable/disabled from
DEPENDS/RDEPENDS, ie bar_1.0.bb with foo enabled, depends not only on
abc recipe but needs abc also with foo enabled.
Regards,
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index 7cd6efa..f539744 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -291,6 +291,44 @@ do_build () {
> python () {
> import exceptions, string, re
>
> + # Handle PACKAGECONFIG
> + #
> + # These take the form:
> + #
> + # PACKAGECONFIG ?? = "<default options>"
> + # PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends"
> + pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split()
> + if pkgconfig:
> + def appendVar(varname, appends):
> + if not appends:
> + return
> + varname = bb.data.expand(varname, d)
> + content = d.getVar(varname, False) or ""
> + content = content + " " + " ".join(appends)
> + d.setVar(varname, content)
> +
> + extradeps = []
> + extrardeps = []
> + extraconf = []
> + for flag, flagval in (d.getVarFlags("PACKAGECONFIG") or {}).items():
> + if flag == "defaultval":
> + continue
> + items = flagval.split(",")
> + if len(items) == 3:
> + enable, disable, depend = items
> + rdepend = ""
> + elif len(items) == 4:
> + enable, disable, depend, rdepend = items
> + if flag in pkgconfig:
> + extradeps.append(depend)
> + extrardeps.append(rdepend)
> + extraconf.append(enable)
> + else:
> + extraconf.append(disable)
> + appendVar('DEPENDS', extradeps)
> + appendVar('RDEPENDS_${PN}', extrardeps)
> + appendVar('EXTRA_OECONF', extraconf)
> +
> # If PRINC is set, try and increase the PR value by the amount specified
> princ = bb.data.getVar('PRINC', d, True)
> if princ:
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
--
Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: base.bbclass: Implement PACKAGECONFIG
2011-10-06 14:18 base.bbclass: Implement PACKAGECONFIG Richard Purdie
2011-10-06 14:24 ` Martin Jansa
@ 2011-10-06 14:46 ` Koen Kooi
2011-10-06 15:55 ` Richard Purdie
1 sibling, 1 reply; 5+ messages in thread
From: Koen Kooi @ 2011-10-06 14:46 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
Op 6 okt. 2011, om 16:18 heeft Richard Purdie het volgende geschreven:
> These enabled options to be specified in the form:
>
> PACKAGECONFIG ?? = "<default options>"
> PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends"
>
> So that DEPENDS, RDEPENDS_${PN} and EXTRA_OECONF can be automatically
> built from specific options. Those options can easily be customised
> by the distro config or the user.
What if I want it in RDEPENDS_some-other-subpackage?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: base.bbclass: Implement PACKAGECONFIG
2011-10-06 14:24 ` Martin Jansa
@ 2011-10-06 14:56 ` Richard Purdie
0 siblings, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2011-10-06 14:56 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Thu, 2011-10-06 at 16:24 +0200, Martin Jansa wrote:
> On Thu, Oct 06, 2011 at 03:18:27PM +0100, Richard Purdie wrote:
> > These enabled options to be specified in the form:
> >
> > PACKAGECONFIG ?? = "<default options>"
> > PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends"
> >
> > So that DEPENDS, RDEPENDS_${PN} and EXTRA_OECONF can be automatically
> > built from specific options. Those options can easily be customised
> > by the distro config or the user.
> >
> > Based on some ideas from Chris Elston <celston@katalix.com> but with
> > an improved easier to use one line interface.
>
> 1) How can user check on target if his package was built with foo enabled?
> - is there some plan to keep this in ipk/deb metadata?
No plan. I'll state very clearly here for the record:
THESE OPTIONS SHOULD ONLY BE USED WITH ONE SETTING FOR A GIVEN DISTRO
(otherwise the package feeds would be inconsistent).
There is no realistic way we can do anything else. We're giving users a
smoking gun here, if they chose to shoot themselves with it, that is
their own problem.
There are a lot of good reasons people may want to configure things, I
don't think it acceptable to make it difficult but it does mean people
need to take a certain about of responsibility.
> 2) Is it possible to force some PACKAGECONFIG enable/disabled from
> DEPENDS/RDEPENDS, ie bar_1.0.bb with foo enabled, depends not only on
> abc recipe but needs abc also with foo enabled.
No. Distros (or the user) are going to be responsible for setting up a
consistent set of PACKAGECONFIG options.
Cheers,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: base.bbclass: Implement PACKAGECONFIG
2011-10-06 14:46 ` Koen Kooi
@ 2011-10-06 15:55 ` Richard Purdie
0 siblings, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2011-10-06 15:55 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Thu, 2011-10-06 at 16:46 +0200, Koen Kooi wrote:
> Op 6 okt. 2011, om 16:18 heeft Richard Purdie het volgende geschreven:
>
> > These enabled options to be specified in the form:
> >
> > PACKAGECONFIG ?? = "<default options>"
> > PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends"
> >
> > So that DEPENDS, RDEPENDS_${PN} and EXTRA_OECONF can be automatically
> > built from specific options. Those options can easily be customised
> > by the distro config or the user.
>
> What if I want it in RDEPENDS_some-other-subpackage?
As yet to code doesn't support it but it could be extended to quite
easily.
There are several things in that function I don't like, I found at least
one bitbake bug (exposure of the defaultval flag) and I think bitbake
itself should have some kind of appendVar() function...
So consider that code a starting point, not a finished end result :)
Cheers,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-06 16:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-06 14:18 base.bbclass: Implement PACKAGECONFIG Richard Purdie
2011-10-06 14:24 ` Martin Jansa
2011-10-06 14:56 ` Richard Purdie
2011-10-06 14:46 ` Koen Kooi
2011-10-06 15:55 ` Richard Purdie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox