public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Fix problem with devtool and BBCLASSEXTENDed recipes
@ 2016-09-17  1:18 Peter Kjellerstedt
  2016-09-17  1:18 ` [PATCH 1/1] externalsrc.bbclass: Make reparsing work for " Peter Kjellerstedt
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Kjellerstedt @ 2016-09-17  1:18 UTC (permalink / raw)
  To: openembedded-core

Is no one using devtool with BBCLASSEXTENDed recipes? Because when I
tried that today I noticed that after having done "devtool modify -x
foo-native" the recipe would not rebuild after having changed the
source code (the way it does for non-native recipes).

As far as I can tell the problem is that externalsrc.bbclass sets
BB_DONT_CACHE inside an anonymous Python function after having checked
if EXTERNALSRC is set. However, for BBCLASSEXTENDed recipes
BB_DONT_CACHE needs to be set for the base recipe rather than the
current variant. Why this is, I have no idea.

First I thought of unconditionally setting BB_DONT_CACHE in the
externalsrc bbclass, but then I realized that people may be used to,
e.g., inherit externalsrc in their local.conf and that would
effectively cause every recipe to be reparsed every time bitbake is
executed...

Eventually I managed to implement a solution that seems to work and
only sets BB_DONT_CACHE as necessary. It may not be kosher as it looks
at overridden variants of EXTERNALSRC, but it was the best I could
come up with.

I know too little of the recipe parsing internals to be able to tell
whether the current behavior is working as intended or if it is a bug
that BB_DONT_CACHE must be set for the base recipe. I leave that for
someone more knowledgeable in the parsing internals to investigate.

//Peter

The following changes since commit 5414b80e8df11188d8e67a37185305c34ea084bd:

  bitbake: cooker: check if target contains task (2016-09-16 15:24:03 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib pkj/externalsrc_dont_cache
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/externalsrc_dont_cache

Peter Kjellerstedt (1):
  externalsrc.bbclass: Make reparsing work for BBCLASSEXTENDed recipes

 meta/classes/externalsrc.bbclass | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

-- 
2.9.0



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] externalsrc.bbclass: Make reparsing work for BBCLASSEXTENDed recipes
  2016-09-17  1:18 [PATCH 0/1] Fix problem with devtool and BBCLASSEXTENDed recipes Peter Kjellerstedt
@ 2016-09-17  1:18 ` Peter Kjellerstedt
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Kjellerstedt @ 2016-09-17  1:18 UTC (permalink / raw)
  To: openembedded-core

To make sure changes to any source files are detected when externalsrc
is used, it sets BB_DONT_CACHE to force the recipe to be reparsed
every time. Previously, this was done conditionally based on whether
EXTERNALSRC was set. This worked fine for building the base recipe.
But if one tried to build, e.g., a native version of it (provided via
BBCLASSEXTEND), the recipe would not be reparsed as expected.

To solve the above problem, BB_DONT_CACHE is now set for the base
recipe if EXTERNALSRC is set for it or any of it derivatives.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 meta/classes/externalsrc.bbclass | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index b7140a3..5c65d2b 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -29,6 +29,23 @@ EXTERNALSRC_SYMLINKS ?= "oe-workdir:${WORKDIR} oe-logs:${T}"
 
 python () {
     externalsrc = d.getVar('EXTERNALSRC', True)
+
+    # If this is the base recipe and EXTERNALSRC is set for it or any of its
+    # derivatives, then enable BB_DONT_CACHE to force the recipe to always be
+    # re-parsed so that the file-checksums function for do_compile is run every
+    # time.
+    bpn = d.getVar('BPN', True)
+    if bpn == d.getVar('PN', True):
+        classextend = (d.getVar('BBCLASSEXTEND', True) or '').split()
+        if (externalsrc or
+                ('native' in classextend and
+                 d.getVar('EXTERNALSRC_pn-%s-native' % bpn, True)) or
+                ('nativesdk' in classextend and
+                 d.getVar('EXTERNALSRC_pn-nativesdk-%s' % bpn, True)) or
+                ('cross' in classextend and
+                 d.getVar('EXTERNALSRC_pn-%s-cross' % bpn, True))):
+            d.setVar('BB_DONT_CACHE', '1')
+
     if externalsrc:
         d.setVar('S', externalsrc)
         externalsrcbuild = d.getVar('EXTERNALSRC_BUILD', True)
@@ -85,9 +102,6 @@ python () {
         d.prependVarFlag('do_compile', 'prefuncs', "externalsrc_compile_prefunc ")
         d.prependVarFlag('do_configure', 'prefuncs', "externalsrc_configure_prefunc ")
 
-        # Force the recipe to be always re-parsed so that the file_checksums
-        # function is run every time
-        d.setVar('BB_DONT_CACHE', '1')
         d.setVarFlag('do_compile', 'file-checksums', '${@srctree_hash_files(d)}')
 
         # We don't want the workdir to go away
-- 
2.9.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-17  1:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-17  1:18 [PATCH 0/1] Fix problem with devtool and BBCLASSEXTENDed recipes Peter Kjellerstedt
2016-09-17  1:18 ` [PATCH 1/1] externalsrc.bbclass: Make reparsing work for " Peter Kjellerstedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox