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 12:25:07 +0000 |
| commit | 7229250411e7517cdf9e464d7f6033b155811bd8 (patch) | |
| tree | 1234c51773084be06bcce6ff567a24ec636fd43e /bitbake/lib/bb/data_smart.py | |
| parent | 797a8ee040e5f5eca1973478daddb3c18fef8c5e (diff) | |
| download | poky-7229250411e7517cdf9e464d7f6033b155811bd8.tar.gz | |
bitbake: 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.
(Bitbake rev: bbbb2a53d5decf3b613a92c4ff77c84bfc5d4903)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/data_smart.py')
| -rw-r--r-- | bitbake/lib/bb/data_smart.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 4d0a771283..79d591a237 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
| @@ -230,6 +230,19 @@ class VariableHistory(object): | |||
| 230 | new.variables = self.variables.copy() | 230 | new.variables = self.variables.copy() |
| 231 | return new | 231 | return new |
| 232 | 232 | ||
| 233 | def __getstate__(self): | ||
| 234 | vardict = {} | ||
| 235 | for k, v in self.variables.iteritems(): | ||
| 236 | vardict[k] = v | ||
| 237 | return {'dataroot': self.dataroot, | ||
| 238 | 'variables': vardict} | ||
| 239 | |||
| 240 | def __setstate__(self, state): | ||
| 241 | self.dataroot = state['dataroot'] | ||
| 242 | self.variables = COWDictBase.copy() | ||
| 243 | for k, v in state['variables'].items(): | ||
| 244 | self.variables[k] = v | ||
| 245 | |||
| 233 | def record(self, *kwonly, **loginfo): | 246 | def record(self, *kwonly, **loginfo): |
| 234 | if not self.dataroot._tracking: | 247 | if not self.dataroot._tracking: |
| 235 | return | 248 | return |
