From d53958766e2c766b95b3947f69b64c409ed433d8 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 23 Mar 2020 12:43:25 +0000 Subject: bitbake: tinfoil: Simplify remote datastore connections The current approach to remote datastores used in tinfoil is breaking. For example, adding a devupstream extension to a recipe with a git upstream, making it the preferred version and then running "devtool modify" on it causes get_srcrev() circular dependency issues. The problem is the override handling in the datastore is broken. This gets broken since remotedata:recieve_datastore() sets d.dict but doesn't update d.overridedata (or d.inchistory or d.varhistory). We could play whack-a-mole but the current implementation seems to be flawed to me. It also doesn't cover, or only partially covers some datastore operations and each needs new dedicated command API. Instead, step back and reimplement the way the datastore connector works. With this change, the datastore is either remote or local but the data is not spread on two sides of the connection. All the API is proxied over the connection by a single function for the datastore (and two to support variable history and include history). This code does not support using the datastore as a parameter to any data store functions. We did have one case of that but its just bad code and can be replaced. The result is something which is much simpler and less invasive to the datastore code itself, meaning its behaviour should be much more consistent. The existing tests for the remote data no longer make any sense and are removed. The one bug this code would have is if key/value pairs are returned over the IPC and those values contained a DataSmart object since we don't recurse into return values to find such things. Nothing appears to do that currently so lets worry about it if its ever an issue. This change should simplfy a ton of other issues and avoid a ton of other bugs so is a huge net gain. Tested with bitbake's and OE's selftests. (Bitbake rev: 85e03a64dd0a4ebe71009ec4bdf4192c04a9786e) Signed-off-by: Richard Purdie --- bitbake/lib/bb/data_smart.py | 53 +++----------------------------------------- 1 file changed, 3 insertions(+), 50 deletions(-) (limited to 'bitbake/lib/bb/data_smart.py') diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index b2dc9d9fd5..70257ab7f8 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -107,10 +107,6 @@ class VariableParse: else: code = match.group()[3:-1] - if "_remote_data" in self.d: - connector = self.d["_remote_data"] - return connector.expandPythonRef(self.varname, code, self.d) - if self.varname: varname = 'Var <%s>' % self.varname else: @@ -268,12 +264,7 @@ class VariableHistory(object): self.variables[newvar].append(i.copy()) def variable(self, var): - remote_connector = self.dataroot.getVar('_remote_data', False) - if remote_connector: - varhistory = remote_connector.getVarHistory(var) - else: - varhistory = [] - + varhistory = [] if var in self.variables: varhistory.extend(self.variables[var]) return varhistory @@ -471,10 +462,6 @@ class DataSmart(MutableMapping): if var in dest: return dest[var], self.overridedata.get(var, None) - if "_remote_data" in dest: - connector = dest["_remote_data"]["_content"] - return connector.getVar(var) - if "_data" not in dest: break dest = dest["_data"] @@ -499,12 +486,6 @@ class DataSmart(MutableMapping): if 'parsing' in loginfo: parsing=True - if '_remote_data' in self.dict: - connector = self.dict["_remote_data"]["_content"] - res = connector.setVar(var, value) - if not res: - return - if 'op' not in loginfo: loginfo['op'] = "set" @@ -612,12 +593,6 @@ class DataSmart(MutableMapping): bb.warn("Calling renameVar with equivalent keys (%s) is invalid" % key) return - 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: self.varhistory.rename_variable_hist(key, newkey) @@ -663,11 +638,6 @@ class DataSmart(MutableMapping): def delVar(self, var, **loginfo): self.expand_cache = {} - 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' @@ -695,11 +665,6 @@ class DataSmart(MutableMapping): def setVarFlag(self, var, flag, value, **loginfo): self.expand_cache = {} - if '_remote_data' in self.dict: - connector = self.dict["_remote_data"]["_content"] - res = connector.setVarFlag(var, flag, value) - if not res: - return if 'op' not in loginfo: loginfo['op'] = "set" @@ -850,11 +815,6 @@ class DataSmart(MutableMapping): def delVarFlag(self, var, flag, **loginfo): self.expand_cache = {} - if '_remote_data' in self.dict: - connector = self.dict["_remote_data"]["_content"] - res = connector.delVarFlag(var, flag) - if not res: - return local_var, _ = self._findVar(var) if not local_var: @@ -972,7 +932,7 @@ class DataSmart(MutableMapping): def localkeys(self): for key in self.dict: - if key not in ['_data', '_remote_data']: + if key not in ['_data']: yield key def __iter__(self): @@ -981,7 +941,7 @@ class DataSmart(MutableMapping): def keylist(d): klist = set() for key in d: - if key in ["_data", "_remote_data"]: + if key in ["_data"]: continue if key in deleted: continue @@ -995,13 +955,6 @@ class DataSmart(MutableMapping): if "_data" in d: klist |= keylist(d["_data"]) - if "_remote_data" in d: - connector = d["_remote_data"]["_content"] - for key in connector.getKeys(): - if key in deleted: - continue - klist.add(key) - return klist self.need_overrides() -- cgit v1.2.3-54-g00ecf