From: "Richard Purdie" <richard.purdie@linuxfoundation.org>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
Khem Raj <raj.khem@gmail.com>,
Armin Kuster <akuster808@gmail.com>,
Jerome Neanne <jneanne@baylibre.com>,
Quentin Schulz <quentin.schulz@streamunlimited.com>
Cc: Patches and discussions about the oe-core layer
<openembedded-core@lists.openembedded.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [OE-core][PATCH v2 2/2] image.bbclass: deploy image artifacts in stages
Date: Wed, 15 Apr 2020 11:32:00 +0100 [thread overview]
Message-ID: <2ee5d8832f691c36c00fcdb31609fff3648e2673.camel@linuxfoundation.org> (raw)
In-Reply-To: <CAMRc=MdmrCSUYJXu7nhipPLLJFa6qdzD0E8Zq3S38mZKANpLUg@mail.gmail.com>
On Wed, 2020-04-15 at 12:20 +0200, Bartosz Golaszewski wrote:
> pon., 6 kwi 2020 o 19:02 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > Make each IMAGE_CMD task an sstate task with its own IMGDEPLOYDIR
> > override. This way each generated set of artifacts is deployed as soon
> > as it's ready instead of the do_image_complete task handling the entire
> > deployement. This allows us to better fine-tune dependencies e.g. we
> > can make do_image_wic depend on fitImage task which can in turn depend
> > on do_image_ext4.
> >
> > We need delete the IMGDEPLOYDIR variable from the data object passed
> > to each image task so that it gets expanded with the correct override.
> >
> > In order to make sure that tasks added to SSTATETASKS in anonymous python
> > functions are correctly setup, move the code that assigns pre- and
> > postfuncs to an event handler invoked on bb.event.RecipeTaskPreProcess
> > in sstate.bbclass. This event is fired right after the anonymous
> > functions.
> >
> > Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > ---
> > meta/classes/image.bbclass | 17 +++++++++++++++++
> > meta/classes/sstate.bbclass | 4 ++++
> > 2 files changed, 21 insertions(+)
> >
> > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> > index 07aa1f1fa5..ffd63aa82a 100644
> > --- a/meta/classes/image.bbclass
> > +++ b/meta/classes/image.bbclass
> > @@ -428,10 +428,12 @@ python () {
> > # date/time values. It will get expanded at execution time.
> > # Similarly TMPDIR since otherwise we see QA stamp comparision problems
> > # Expand PV else it can trigger get_srcrev which can fail due to these variables being unset
> > + # Delete IMGDEPLOYDIR so that each task gets its own, overriden value
> > localdata.setVar('PV', d.getVar('PV'))
> > localdata.delVar('DATETIME')
> > localdata.delVar('DATE')
> > localdata.delVar('TMPDIR')
> > + localdata.delVar('IMGDEPLOYDIR')
> > vardepsexclude = (d.getVarFlag('IMAGE_CMD_' + realt, 'vardepsexclude', True) or '').split()
> > for dep in vardepsexclude:
> > localdata.delVar(dep)
> > @@ -502,6 +504,21 @@ python () {
> >
> > bb.debug(2, "Adding task %s before %s, after %s" % (task, 'do_image_complete', after))
> > bb.build.addtask(task, 'do_image_complete', after, d)
> > +
> > + imgdeploydir = d.getVar('IMGDEPLOYDIR')
> > + task_override = task[3:].replace('_', '-') # 'do_image_ext4' becomes 'image-ext4'
> > + taskdeploydir = '{}/deploy-{}-{}'.format(os.path.dirname(imgdeploydir),
> > + d.getVar('PN'), task_override)
> > +
> > + # Each image task gets its own IMGDEPLOYDIR directory and is added to
> > + # SSTATETASKS. This way every set of artifacts gets deployed right after
> > + # the do_image_foo task completes.
> > + d.setVar('IMGDEPLOYDIR_task-{}'.format(task_override), taskdeploydir)
> > + d.appendVar('SSTATETASKS', ' {}'.format(task))
> > + d.setVarFlag(task, 'sstate-inputdirs', taskdeploydir)
> > + d.setVarFlag(task, 'sstate-outputdirs', d.getVar('DEPLOY_DIR_IMAGE'))
> > + d.setVarFlag(task, 'cleandirs', taskdeploydir)
> > + d.setVar('SSTATE_SKIP_CREATION_task-{}'.format(task_override), '1')
> > }
> >
> > #
> > diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> > index c73c3b42a7..3c71312010 100644
> > --- a/meta/classes/sstate.bbclass
> > +++ b/meta/classes/sstate.bbclass
> > @@ -138,13 +138,17 @@ python () {
> > d.setVar('SSTATE_EXTRAPATH', "${NATIVELSBSTRING}/")
> > d.setVar('BB_HASHFILENAME', "True ${SSTATE_PKGSPEC} ${SSTATE_SWSPEC}")
> > d.setVar('SSTATE_EXTRAPATHWILDCARD', "${NATIVELSBSTRING}/")
> > +}
> >
> > +python sstate_setup_tasks() {
> > unique_tasks = sorted(set((d.getVar('SSTATETASKS') or "").split()))
> > d.setVar('SSTATETASKS', " ".join(unique_tasks))
> > for task in unique_tasks:
> > d.prependVarFlag(task, 'prefuncs', "sstate_task_prefunc ")
> > d.appendVarFlag(task, 'postfuncs', " sstate_task_postfunc")
> > }
> > +addhandler sstate_setup_tasks
> > +sstate_setup_tasks[eventmask] = "bb.event.RecipeTaskPreProcess"
> >
> > def sstate_init(task, d):
> > ss = {}
> > --
> > 2.25.0
> >
>
> Gentle ping.
Gentle reminder that we're in the middle of sorting out a release. This
will not merge until after the release and I don't have the cycles for
review of this kind of change right now.
FWIW I still don't like the way this integrates into sstate and I want
to spend some time trying to find a better way. I don't have any
constructive suggestion as to what that would look like so I haven't
replied, I simply don't know and that isn't a useful answer to you.
You've also ignored my request to follow the coding style used in the
rest of the class code :(.
Cheers,
Richard
next prev parent reply other threads:[~2020-04-15 10:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-06 17:02 [OE-core][PATCH v2 0/2] introduce multi-state image deployment Bartosz Golaszewski
2020-04-06 17:02 ` [OE-core][PATCH v2 1/2] qemuboot.bbclass: don't redefine IMGDEPLOYDIR Bartosz Golaszewski
2020-04-06 17:02 ` [OE-core][PATCH v2 2/2] image.bbclass: deploy image artifacts in stages Bartosz Golaszewski
2020-04-15 10:20 ` Bartosz Golaszewski
2020-04-15 10:32 ` Richard Purdie [this message]
2020-04-15 11:14 ` Bartosz Golaszewski
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=2ee5d8832f691c36c00fcdb31609fff3648e2673.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=akuster808@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=brgl@bgdev.pl \
--cc=jneanne@baylibre.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=quentin.schulz@streamunlimited.com \
--cc=raj.khem@gmail.com \
/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