Patchwork [05/12] volatiles.bbclass: add recipe

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date Jan. 24, 2013, 8:16 a.m.
Message ID <c60b41bd635d38aa01ffdd5c6221fd1a9c34b68f.1359014474.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/43253/
State New
Headers show

Comments

Qi.Chen@windriver.com - Jan. 24, 2013, 8:16 a.m.
From: Chen Qi <Qi.Chen@windriver.com>

All recipes that need to tweak their directories need to inherit this
class and set VOLATILE_DIR, VOLATILE_LINK and VOLATILE_PKGS.

[YOCTO #3406]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/classes/volatiles.bbclass |   11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 meta/classes/volatiles.bbclass
Martin Jansa - Jan. 24, 2013, 10:31 a.m.
On Thu, Jan 24, 2013 at 04:16:45PM +0800, Qi.Chen@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
> 
> All recipes that need to tweak their directories need to inherit this
> class and set VOLATILE_DIR, VOLATILE_LINK and VOLATILE_PKGS.
> 
> [YOCTO #3406]
> 
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>  meta/classes/volatiles.bbclass |   11 +++++++++++
>  1 file changed, 11 insertions(+)
>  create mode 100644 meta/classes/volatiles.bbclass
> 
> diff --git a/meta/classes/volatiles.bbclass b/meta/classes/volatiles.bbclass
> new file mode 100644
> index 0000000..f27e598
> --- /dev/null
> +++ b/meta/classes/volatiles.bbclass
> @@ -0,0 +1,11 @@
> +# This bbclass is for read-only-rootfs support. All recipes that may tweak their
> +# own directories in order to run correctly in a read-only rootfs enviroment
> +# should inherit this class and set VOLATILE_DIR, VOLATILE_LINK, VOLATILE_PKGS.
> +
> +# For each package, the net result is a read-only specific conf file generated
> +# and packaged, which has the name of readonly-${VOLATILESPN}.
> +
> +# All these config files are then parsed by populate-volatile.sh to create proper
> +# directories and links.
> +
> +inherit ${@base_contains('DISTRO_FEATURES','sysvinit','volatiles_sysvinit','',d)}

Does "inherit " work?

I mean empty inherit when DISTRO_FEATURES don't contain sysvinit? IIRC
it will fail to parse.

Cheers,

> -- 
> 1.7.9.5
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Richard Purdie - Jan. 24, 2013, 11:37 a.m.
On Thu, 2013-01-24 at 11:31 +0100, Martin Jansa wrote:
> On Thu, Jan 24, 2013 at 04:16:45PM +0800, Qi.Chen@windriver.com wrote:
> > From: Chen Qi <Qi.Chen@windriver.com>
> > 
> > All recipes that need to tweak their directories need to inherit this
> > class and set VOLATILE_DIR, VOLATILE_LINK and VOLATILE_PKGS.
> > 
> > [YOCTO #3406]
> > 
> > Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> > ---
> >  meta/classes/volatiles.bbclass |   11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >  create mode 100644 meta/classes/volatiles.bbclass
> > 
> > diff --git a/meta/classes/volatiles.bbclass b/meta/classes/volatiles.bbclass
> > new file mode 100644
> > index 0000000..f27e598
> > --- /dev/null
> > +++ b/meta/classes/volatiles.bbclass
> > @@ -0,0 +1,11 @@
> > +# This bbclass is for read-only-rootfs support. All recipes that may tweak their
> > +# own directories in order to run correctly in a read-only rootfs enviroment
> > +# should inherit this class and set VOLATILE_DIR, VOLATILE_LINK, VOLATILE_PKGS.
> > +
> > +# For each package, the net result is a read-only specific conf file generated
> > +# and packaged, which has the name of readonly-${VOLATILESPN}.
> > +
> > +# All these config files are then parsed by populate-volatile.sh to create proper
> > +# directories and links.
> > +
> > +inherit ${@base_contains('DISTRO_FEATURES','sysvinit','volatiles_sysvinit','',d)}
> 
> Does "inherit " work?
> 
> I mean empty inherit when DISTRO_FEATURES don't contain sysvinit? IIRC
> it will fail to parse.

The above syntax does now work. A plain "inherit " won't but something
with an expression in does get handled correctly. It did not used to
work with older bitbake versions.

Cheers,

Richard
Ross Burton - Jan. 24, 2013, 11:45 a.m.
On 24 January 2013 11:37, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>> > +inherit ${@base_contains('DISTRO_FEATURES','sysvinit','volatiles_sysvinit','',d)}
>>
>> Does "inherit " work?
>>
>> I mean empty inherit when DISTRO_FEATURES don't contain sysvinit? IIRC
>> it will fail to parse.
>
> The above syntax does now work. A plain "inherit " won't but something
> with an expression in does get handled correctly. It did not used to
> work with older bitbake versions.

The syntax works but that expression won't. If sysvinit was backfilled
(pending patch from Marcin) because the distribution didn't pick
sysvinit or systemd explicitly, the backfill happens after this
expression is parsed.

I'm testing a change where these tests happen against
DISTRO_FEATURES_INITMAN instead now.

Ross
Qi.Chen@windriver.com - Jan. 25, 2013, 8:58 a.m.
On 01/24/2013 07:45 PM, Burton, Ross wrote:
> On 24 January 2013 11:37, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
>>>> +inherit ${@base_contains('DISTRO_FEATURES','sysvinit','volatiles_sysvinit','',d)}
>>> Does "inherit " work?
>>>
>>> I mean empty inherit when DISTRO_FEATURES don't contain sysvinit? IIRC
>>> it will fail to parse.
>> The above syntax does now work. A plain "inherit " won't but something
>> with an expression in does get handled correctly. It did not used to
>> work with older bitbake versions.
> The syntax works but that expression won't. If sysvinit was backfilled
> (pending patch from Marcin) because the distribution didn't pick
> sysvinit or systemd explicitly, the backfill happens after this
> expression is parsed.
>
> I'm testing a change where these tests happen against
> DISTRO_FEATURES_INITMAN instead now.
>
> Ross
>
> _

It seems that the backfill happens *before* this expression is parsed.

I tested it with DISTRO_FEATURES explicitly set in local.conf (basically 
the default value, except that it contains no init manager). It worked 
out well.

#
DISTRO ?= "poky"
DISTRO_FEATURES_LIBC_DEFAULT = "ipv4 ipv6 libc-backtrace libc-big-macros 
libc-bsd libc-cxx-tests libc-catgets libc-charsets libc-crypt \
                     libc-crypt-ufc libc-db-aliases libc-envz libc-fcvt 
libc-fmtmsg libc-fstab libc-ftraverse \
                     libc-getlogin libc-idn libc-inet-anl libc-libm 
libc-libm-big libc-locales libc-locale-code \
                     libc-memusage libc-nis libc-nsswitch libc-rcmd 
libc-rtld-debug libc-spawn libc-streams libc-sunrpc \
                     libc-utmp libc-utmpx libc-wordexp 
libc-posix-clang-wchar libc-posix-regexp libc-posix-regexp-glibc \
                     libc-posix-wchar-io"
DISTRO_FEATURES_LIBC = "${DISTRO_FEATURES_LIBC_DEFAULT}"
DISTRO_FEATURES_LIBC_class-nativesdk = "${DISTRO_FEATURES_LIBC_DEFAULT}"
DISTRO_FEATURES = "alsa argp bluetooth ext2 irda largefile pcmcia 
usbgadget usbhost wifi xattr nfs zeroconf pci 3g x11 
${DISTRO_FEATURES_LIBC}"


I also added the following lines to volatiles.bbclass to examine the 
DISTRO_FEATURES when parsing the volatiles.bbclass.

+python __anonymous() {
+    bb.error("DISTRO_FEATURES: %s" % d.getVar('DISTRO_FEATURES', True))
+}
+
  inherit 
${@base_contains('DISTRO_FEATURES','sysvinit','volatiles_sysvinit','',d)}

And the DISTRO_FEATURES contains 'sysvinit'.

ERROR: DISTRO_FEATURES: alsa argp bluetooth ext2 irda largefile pcmcia 
usbgadget usbhost wifi xattr nfs zeroconf pci 3g x11 ipv4 ipv6 
libc-backtrace libc-big-macros libc-bsd libc-cxx-tests libc-catgets 
libc-charsets libc-crypt libc-crypt-ufc libc-db-aliases libc-envz 
libc-fcvt libc-fmtmsg libc-fstab libc-ftraverse libc-getlogin libc-idn 
libc-inet-anl libc-libm libc-libm-big libc-locales libc-locale-code 
libc-memusage libc-nis libc-nsswitch libc-rcmd libc-rtld-debug 
libc-spawn libc-streams libc-sunrpc libc-utmp libc-utmpx libc-wordexp 
libc-posix-clang-wchar libc-posix-regexp libc-posix-regexp-glibc 
libc-posix-wchar-io pulseaudio sysvinit largefile opengl multiarch

Best Regards,
Chen Qi

> ______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
>
Ross Burton - Jan. 25, 2013, 2:05 p.m.
On 25 January 2013 08:58, ChenQi <Qi.Chen@windriver.com> wrote:
> It seems that the backfill happens *before* this expression is parsed.

Yes, because of these two patches that I reviewed and submitted yesterday:

commit 4db8a3daafdedf39e081f4f6130f6cdcde03ed62
Author: Richard Purdie <richard.purdie@linuxfoundation.org>
Date:   Thu Jan 24 17:52:56 2013 +0000

    base: make feature backfilling happen earlier

commit c98363450fc4ccab82b34a37a95bd172cf6e115f
Author: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Date:   Thu Jan 24 17:52:55 2013 +0000

    bitbake.conf: unbreak all builds with custom DISTRO_FEATURES

Ross
Qi.Chen@windriver.com - Jan. 28, 2013, 3:32 a.m.
On 01/25/2013 10:05 PM, Burton, Ross wrote:
> On 25 January 2013 08:58, ChenQi <Qi.Chen@windriver.com> wrote:
>> It seems that the backfill happens *before* this expression is parsed.
> Yes, because of these two patches that I reviewed and submitted yesterday:
>
> commit 4db8a3daafdedf39e081f4f6130f6cdcde03ed62
> Author: Richard Purdie <richard.purdie@linuxfoundation.org>
> Date:   Thu Jan 24 17:52:56 2013 +0000
>
>      base: make feature backfilling happen earlier
>
> commit c98363450fc4ccab82b34a37a95bd172cf6e115f
> Author: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
> Date:   Thu Jan 24 17:52:55 2013 +0000
>
>      bitbake.conf: unbreak all builds with custom DISTRO_FEATURES
>
> Ross
>
>
Ah... Yes.

Thanks for making things clear for me :)

Best Regards,
Chen Qi

Patch

diff --git a/meta/classes/volatiles.bbclass b/meta/classes/volatiles.bbclass
new file mode 100644
index 0000000..f27e598
--- /dev/null
+++ b/meta/classes/volatiles.bbclass
@@ -0,0 +1,11 @@ 
+# This bbclass is for read-only-rootfs support. All recipes that may tweak their
+# own directories in order to run correctly in a read-only rootfs enviroment
+# should inherit this class and set VOLATILE_DIR, VOLATILE_LINK, VOLATILE_PKGS.
+
+# For each package, the net result is a read-only specific conf file generated
+# and packaged, which has the name of readonly-${VOLATILESPN}.
+
+# All these config files are then parsed by populate-volatile.sh to create proper
+# directories and links.
+
+inherit ${@base_contains('DISTRO_FEATURES','sysvinit','volatiles_sysvinit','',d)}