diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2017-03-20 17:05:53 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-21 21:01:56 +0000 |
commit | 282dc0719d22a39df746eea762ebe05c66aa8f8a (patch) | |
tree | 7e410fa0b1873107e44128c2a6a325c68efa3edf /lib/bb/data_smart.py | |
parent | 4f9d6f060ed247fb6fa2f45668a892a1788d3f91 (diff) | |
download | bitbake-282dc0719d22a39df746eea762ebe05c66aa8f8a.tar.gz |
data_smart: implement missing remote datastore operations
Enable the following operations from a remote datastore to affect the
other end:
* setVarFlag()
* delVar()
* delVarFlag()
* renameVar()
In practice I don't expect these to be used much, but they should be
present so that the implementation is at least reasonably filled out
and that the tests pass.
Also add tests for the interface, mostly by subclassing the existing
local test classes so that they are using a remote datastore. (These
don't actually test remote usage via tinfoil, just that the
datastore's interface can be used.)
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 | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py index 5777d545a..d6dd698ef 100644 --- a/lib/bb/data_smart.py +++ b/lib/bb/data_smart.py @@ -609,6 +609,12 @@ class DataSmart(MutableMapping): """ Rename the variable key to newkey """ + if '_remote_data' in self.dict: + connector = self.dict["_remote_data"]["_content"] + res = connector.renameVar(key, newkey) + if not res: + return + val = self.getVar(key, 0, parsing=True) if val is not None: loginfo['variable'] = newkey @@ -652,6 +658,12 @@ class DataSmart(MutableMapping): self.setVar(var + "_prepend", value, ignore=True, parsing=True) def delVar(self, var, **loginfo): + if '_remote_data' in self.dict: + connector = self.dict["_remote_data"]["_content"] + res = connector.delVar(var) + if not res: + return + loginfo['detail'] = "" loginfo['op'] = 'del' self.varhistory.record(**loginfo) @@ -678,6 +690,12 @@ class DataSmart(MutableMapping): override = None def setVarFlag(self, var, flag, value, **loginfo): + if '_remote_data' in self.dict: + connector = self.dict["_remote_data"]["_content"] + res = connector.setVarFlag(var, flag, value) + if not res: + return + self.expand_cache = {} if 'op' not in loginfo: loginfo['op'] = "set" @@ -796,6 +814,12 @@ class DataSmart(MutableMapping): return value def delVarFlag(self, var, flag, **loginfo): + if '_remote_data' in self.dict: + connector = self.dict["_remote_data"]["_content"] + res = connector.delVarFlag(var, flag) + if not res: + return + self.expand_cache = {} local_var, _ = self._findVar(var) if not local_var: @@ -938,7 +962,10 @@ class DataSmart(MutableMapping): if "_remote_data" in d: connector = d["_remote_data"]["_content"] - klist |= connector.getKeys() + for key in connector.getKeys(): + if key in deleted: + continue + klist.add(key) return klist |