Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Stefano Tondo <stondo@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>,
	Peter Marko <peter.marko@siemens.com>,
	Stefano Tondo <stefano.tondo.ext@siemens.com>
Subject: [PATCH] sstate: do not cache the exclude patterns in the datastore
Date: Mon, 23 Nov 2026 21:36:12 +0100	[thread overview]
Message-ID: <20261123203612.867600-1-stondo@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-23 20:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261123203612.867600-1-stondo@gmail.com \
    --to=stondo@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=peter.marko@siemens.com \
    --cc=richard.purdie@linuxfoundation.org \
    --cc=stefano.tondo.ext@siemens.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