sstate: do not cache the exclude patterns in the datastore
PATCH 1/1 sstate: do not cache the exclude patterns in the datastore
From: Stefano Tondo <[email protected]>
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.
--- meta/classes-global/sstate.bbclass | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
meta/classes-global/sstate.bbclass +4 -4
@@ -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]):
Signature · 1 line
2.56.1