Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Joshua G Lock <joshua.g.lock@linux.intel.com>
To: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 05/10] swupdbundle: new class to generate virtual images for swupd-image
Date: Thu, 25 Feb 2016 08:47:35 +0000	[thread overview]
Message-ID: <1456390055.3610.6.camel@linux.intel.com> (raw)
In-Reply-To: <20160225081933.GC3868@comp-006-thk.openrnd.local>

On Thu, 2016-02-25 at 09:19 +0100, Maciej Borzecki wrote:
> On 02/24 14:52, Joshua Lock wrote:
> > 
> > Our initial strategy to generate bundles for consumption by swupd
> > is to generate images which contain the base image (os-core) plus
> > the additional contents of the bundle, then prune out the core
> > contents. By generating images in this manner we hope to accomodate
> > packages which modify the rootfs outside of installing files, i.e.
> > with postinsts.
> > 
> > To that end this class, to be used via BBCLASSEXTEND, will generate
> > virtual image recipes that add extra packages to the extended
> > image.
> > 
> > Only extensions matching entries in a SWUPD_BUNDLES variable are
> > valid and the bundle contents should be listed in a varFlag
> > matching the bundle's name on the BUNDLE_CONTENTS variable.
> > 
> > An example of usage in an image recipe follows:
> > 
> > SWUPD_BUNDLES = "foo bar"
> > BUNDLE_CONTENTS[foo] = "foo foo-bar foobaz"
> > BUNDLE_CONTENTS[bar] = "bar baz quux"
> > 
> > BBCLASSEXTEND = "swupdbundle:foo"
> > 
> > Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
> > ---
> >  meta/classes/swupdbundle.bbclass | 59
> > ++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 59 insertions(+)
> >  create mode 100644 meta/classes/swupdbundle.bbclass
> > 
> > diff --git a/meta/classes/swupdbundle.bbclass
> > b/meta/classes/swupdbundle.bbclass
> > new file mode 100644
> > index 0000000..897666d
> > --- /dev/null
> > +++ b/meta/classes/swupdbundle.bbclass
> > @@ -0,0 +1,59 @@
> > +# Our initial strategy to generate bundles for consumption by
> > swupd is to
> > +# generate images which contain the base image (os-core) plus the
> > additional
> > +# contents of the bundle, then prune out the core contents. By
> > generating
> > +# images in this manner we hope to accomodate packages which
> > modify the rootfs
> > +# outside of installing files, i.e.with postinsts.
> > +#
> > +# To that end this class, to be used via BBCLASSEXTEND, will
> > generate virtual
> > +# image recipes that add extra packages to the extended image.
> > +#
> > +# Only extensions matching entries in a SWUPD_BUNDLES variable are
> > valid and
> > +# the bundle contents should be listed in a varFlag matching the
> > bundle's name
> > +# on the BUNDLE_CONTENTS variable. i.e in foo-image.bb:
> > +#
> > +# SWUPD_BUNDLES = "foo bar"
> > +# BUNDLE_CONTENTS[foo] = "foo foo-bar foobaz"
> > +# BUNDLE_CONTENTS[bar] = "bar baz quux"
> > +# BBCLASSEXTEND = "swupdbundle:foo"
> > +
> > +python swupdbundle_virtclass_handler () {
> > +    pn = e.data.getVar("PN", True)
> > +    cls = e.data.getVar("BBEXTENDCURR", True)
> > +    bundle = e.data.getVar("BBEXTENDVARIANT", True)
> > +
> > +    if cls != 'swupdbundle':
> > +        return
> > +
> > +    if not bundle:
> > +        bb.fatal('swupdbundle must be used with a parameter i.e.
> > BBCLASSEXTEND="swupdbundle:foo"')
> > +
> > +    # Rename the virtual recipe to create the desired image bundle
> > variant.
> > +    e.data.setVar("PN_BASE", pn)
> > +    pn = pn + '-' + bundle
> > +    e.data.setVar("PN", pn)
> > +    e.data.setVar("BUNDLE_NAME", bundle)
> > +
> > +    bundles = (e.data.getVar('SWUPD_BUNDLES', True) or "").split()
> > +    if not bundles:
> > +        bb.fatal('SWUPD_BUNDLES is not defined, this variable
> > should list bundles for the image.')
> > +
> > +    curr_install = (e.data.getVar('IMAGE_INSTALL', True) or
> > "").split()
> > +
> > +    def get_bundle_contents(bndl):
> > +        contents = e.data.getVarFlag('BUNDLE_CONTENTS', bndl,
> > True)
> > +        if contents:
> > +            return contents.split()
> > +        else:
> > +            bb.fatal('BUNDLE_CONTENTS[%s] is not set, this should
> > list the packages to be included in the bundle.' % bndl)
> > +
> > +    if bundle == 'mega':
> > +        for bndl in bundles:
> > +            curr_install += get_bundle_contents(bndl)
> Bundle named 'mega' seems to be very specific (a bundle of bundles)
> but
> is not documented as a reserved name.

Good point, I'll be sure to document that. I'll also add some code to
raise an error if one of SWUPD_BUNDLES (user-defined bundles) is mega.

Thanks for the review.

Regards,

Joshua

> > 
> > +    else:
> > +        curr_install += get_bundle_contents(bundle)
> > +
> > +    e.data.setVar('IMAGE_INSTALL', ' '.join(curr_install))
> > +}
> > +
> > +addhandler swupdbundle_virtclass_handler
> > +swupdbundle_virtclass_handler[eventmask] =
> > "bb.event.RecipePreFinalise"
> > --
> > 2.5.0
> > 
> > --
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core
> --
> Maciej Borzęcki
> Senior Software Developer at Open-RnD Sp. z o.o., Poland


  reply	other threads:[~2016-02-25  8:47 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 14:52 [PATCH 00/10] Integrate swupd software updater Joshua Lock
2016-02-24 14:52 ` [PATCH 01/10] rsync: add native variant Joshua Lock
2016-02-24 14:52 ` [PATCH 02/10] swupd-server: initial recipe 2.53 Joshua Lock
2016-02-25  8:11   ` Maciej Borzecki
2016-02-25  8:51     ` Joshua G Lock
2016-02-24 14:52 ` [PATCH 03/10] hardlink: add new recipe Joshua Lock
2016-02-24 21:00   ` Burton, Ross
2016-02-24 22:57   ` Andre McCurdy
2016-02-25  8:48     ` Joshua G Lock
2016-02-25 17:13   ` Mark Hatle
2016-02-25 21:40     ` Joshua G Lock
2016-02-25 21:57       ` Mark Hatle
2016-02-24 14:52 ` [PATCH 04/10] swupd-client: Add recipe Joshua Lock
2016-02-25  8:07   ` Maciej Borzecki
2016-02-25  8:50     ` Joshua G Lock
2016-02-24 14:52 ` [PATCH 05/10] swupdbundle: new class to generate virtual images for swupd-image Joshua Lock
2016-02-25  8:19   ` Maciej Borzecki
2016-02-25  8:47     ` Joshua G Lock [this message]
2016-02-25 17:06   ` Patrick Ohly
2016-03-01 13:45     ` Joshua G Lock
2016-02-24 14:52 ` [PATCH 06/10] swupd-image.bbclass: initial class to support swupd updater Joshua Lock
2016-02-24 14:52 ` [PATCH 07/10] oe-swupd-helpers: provide swupd-client required helper scripts and units Joshua Lock
2016-02-24 14:52 ` [PATCH 08/10] swupd-client: RDEPENDS on oe-swupd-helpers Joshua Lock
2016-02-24 14:52 ` [PATCH 09/10] swupd-client: enable native builds Joshua Lock
2016-02-24 14:52 ` [PATCH 10/10] os-release: sanitise VERSION_ID field Joshua Lock
2016-02-24 15:37 ` [PATCH 00/10] Integrate swupd software updater Patrick Ohly
2016-02-24 16:14   ` Joshua G Lock
     [not found]   ` <1456330147.5333.14.camel@intel.com>
2016-02-24 18:49     ` Patrick Ohly
2016-03-01 16:18       ` Joshua G Lock
2016-02-24 16:06 ` Trevor Woerner
2016-02-24 16:35   ` Philip Balister
2016-02-24 18:36     ` Maciej Borzecki
2016-02-24 19:51     ` Paul Eggleton
2016-02-24 20:40       ` Philip Balister
2016-02-25 21:42         ` Joshua G Lock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456390055.3610.6.camel@linux.intel.com \
    --to=joshua.g.lock@linux.intel.com \
    --cc=maciej.borzecki@open-rnd.pl \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox