Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] sstate: do not cache the exclude patterns in the datastore
@ 2026-11-23 20:36 Stefano Tondo
  0 siblings, 0 replies; only message in thread
From: Stefano Tondo @ 2026-11-23 20:36 UTC (permalink / raw)
  To: openembedded-core; +Cc: Richard Purdie, Peter Marko, Stefano Tondo

From: Stefano Tondo <stefano.tondo.ext@siemens.com>

setscene_depvalid() stores the compiled patterns of
SSTATE_EXCLUDEDEPS_SYSROOT in d as _SSTATE_EXCLUDEDEPS_SYSROOT. When
bitbake calls BB_SETSCENE_DEPVALID from the runqueue, d is the cooker
datastore. Nothing removes the variable, so a memory resident server
keeps it until the configuration is parsed again.

The value is a list of tuples of compiled regular expressions. If data
tracking is enabled while setscene_depvalid() runs, the variable
history records the list. At the start of the next build, the event
log writer cannot serialize it to JSON and the build fails with:

  TypeError: Object of type Pattern is not JSON serializable

Compile the patterns in a local variable instead. They are compiled
once per call and only when the function needs them. The results of
setscene_depvalid() do not change.

Signed-off-by: Stefano Tondo <stefano.tondo.ext@siemens.com>
---
 meta/classes-global/sstate.bbclass | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
index c6d9459182..c35824bc25 100644
--- a/meta/classes-global/sstate.bbclass
+++ b/meta/classes-global/sstate.bbclass
@@ -1106,7 +1106,7 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
         bb.parse.siggen.checkhashes(sq_data, missed, found, d)
 
     return found
-setscene_depvalid[vardepsexclude] = "SSTATE_EXCLUDEDEPS_SYSROOT _SSTATE_EXCLUDEDEPS_SYSROOT"
+setscene_depvalid[vardepsexclude] = "SSTATE_EXCLUDEDEPS_SYSROOT"
 
 BB_SETSCENE_DEPVALID = "setscene_depvalid"
 
@@ -1160,6 +1160,7 @@ def setscene_depvalid(task, taskdependees, notneeded, d, log=None):
         return True
 
     spdx_deps = []
+    excludedeps = None
 
     for dep in taskdependees:
         logit("  considering dependency: %s" % (str(taskdependees[dep])), log)
@@ -1187,13 +1188,12 @@ def setscene_depvalid(task, taskdependees, notneeded, d, log=None):
             # them in.
             # See also http://lists.openembedded.org/pipermail/openembedded-core/2018-January/146324.html
             not_needed = False
-            excludedeps = d.getVar('_SSTATE_EXCLUDEDEPS_SYSROOT')
             if excludedeps is None:
-                # Cache the regular expressions for speed
+                # Do not store the compiled expressions in d: it is the cooker
+                # datastore, which is kept across builds
                 excludedeps = []
                 for excl in (d.getVar('SSTATE_EXCLUDEDEPS_SYSROOT') or "").split():
                     excludedeps.append((re.compile(excl.split('->', 1)[0]), re.compile(excl.split('->', 1)[1])))
-                d.setVar('_SSTATE_EXCLUDEDEPS_SYSROOT', excludedeps)
             for excl in excludedeps:
                 if excl[0].match(taskdependees[dep][0]):
                     if excl[1].match(taskdependees[task][0]):
-- 
2.56.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23 20:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 20:36 [PATCH] sstate: do not cache the exclude patterns in the datastore Stefano Tondo

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