diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-04-16 15:45:06 +0100 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2022-06-16 15:49:18 +0200 |
commit | 716e1e246f52b1535846cb18bda4428e99f4c937 (patch) | |
tree | 15253751b8f2c9bd6714f51879e2f607cb51e705 | |
parent | ee96e8f6e6f7706da3059020b17b06cb19af8ace (diff) | |
download | bitbake-contrib-716e1e246f52b1535846cb18bda4428e99f4c937.tar.gz |
tinfoil/data_smart: Allow variable history emit() to function remotely
We can't access the emit() function of varhistory currently as the datastore parameter
isn't handled correctly, nor is the output stream. Add a custom wrapper for this
function which handles the two details correctly.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/bb/command.py | 12 | ||||
-rw-r--r-- | lib/bb/tinfoil.py | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/bb/command.py b/lib/bb/command.py index dd77cdd6e..f530cf844 100644 --- a/lib/bb/command.py +++ b/lib/bb/command.py @@ -20,6 +20,7 @@ Commands are queued in a CommandQueue from collections import OrderedDict, defaultdict +import io import bb.event import bb.cooker import bb.remotedata @@ -500,6 +501,17 @@ class CommandsSync: d = command.remotedatastores[dsindex].varhistory return getattr(d, method)(*args, **kwargs) + def dataStoreConnectorVarHistCmdEmit(self, command, params): + dsindex = params[0] + var = params[1] + oval = params[2] + val = params[3] + d = command.remotedatastores[params[4]] + + o = io.StringIO() + command.remotedatastores[dsindex].varhistory.emit(var, oval, val, o, d) + return o.getvalue() + def dataStoreConnectorIncHistCmd(self, command, params): dsindex = params[0] method = params[1] diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py index 763c32981..8a2fd89dc 100644 --- a/lib/bb/tinfoil.py +++ b/lib/bb/tinfoil.py @@ -52,6 +52,10 @@ class TinfoilDataStoreConnectorVarHistory: def remoteCommand(self, cmd, *args, **kwargs): return self.tinfoil.run_command('dataStoreConnectorVarHistCmd', self.dsindex, cmd, args, kwargs) + def emit(self, var, oval, val, o, d): + ret = self.tinfoil.run_command('dataStoreConnectorVarHistCmdEmit', self.dsindex, var, oval, val, d.dsindex) + o.write(ret) + def __getattr__(self, name): if not hasattr(bb.data_smart.VariableHistory, name): raise AttributeError("VariableHistory has no such method %s" % name) |