diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-12-13 20:07:11 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-14 09:54:48 +0000 |
commit | bbbb2a53d5decf3b613a92c4ff77c84bfc5d4903 (patch) | |
tree | ffa0c470564c027522bd87c02df8938bd900e671 /lib/bb/data_smart.py | |
parent | 5cfbb60833e7b12d698c1c2970c17ccf2a4971bf (diff) | |
download | bitbake-bbbb2a53d5decf3b613a92c4ff77c84bfc5d4903.tar.gz |
data_smart: support serialisation
The COW object used within VariableHistory can't be serialised itself,
but we can convert it to a dict when serializing and then back when
deserialising. This finally allows DataSmart objects to be serialized.
NOTE: "serialisation" here means pickling, not over XMLRPC or any other
transport.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/data_smart.py')
-rw-r--r-- | lib/bb/data_smart.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py index 4d0a77128..79d591a23 100644 --- a/lib/bb/data_smart.py +++ b/lib/bb/data_smart.py @@ -230,6 +230,19 @@ class VariableHistory(object): new.variables = self.variables.copy() return new + def __getstate__(self): + vardict = {} + for k, v in self.variables.iteritems(): + vardict[k] = v + return {'dataroot': self.dataroot, + 'variables': vardict} + + def __setstate__(self, state): + self.dataroot = state['dataroot'] + self.variables = COWDictBase.copy() + for k, v in state['variables'].items(): + self.variables[k] = v + def record(self, *kwonly, **loginfo): if not self.dataroot._tracking: return |