diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-03-23 12:43:25 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-03-24 22:01:03 +0000 |
commit | d53958766e2c766b95b3947f69b64c409ed433d8 (patch) | |
tree | 45e943ca7b1cce938d730cf17cdbb4e472082258 /bitbake/lib/bb/data_smart.py | |
parent | 89705a60f3b566743703c3a7597ccc4507293dd9 (diff) | |
download | poky-d53958766e2c766b95b3947f69b64c409ed433d8.tar.gz |
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 <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/data_smart.py')
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 53 |
1 files changed, 3 insertions, 50 deletions
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: | |||
107 | else: | 107 | else: |
108 | code = match.group()[3:-1] | 108 | code = match.group()[3:-1] |
109 | 109 | ||
110 | if "_remote_data" in self.d: | ||
111 | connector = self.d["_remote_data"] | ||
112 | return connector.expandPythonRef(self.varname, code, self.d) | ||
113 | |||
114 | if self.varname: | 110 | if self.varname: |
115 | varname = 'Var <%s>' % self.varname | 111 | varname = 'Var <%s>' % self.varname |
116 | else: | 112 | else: |
@@ -268,12 +264,7 @@ class VariableHistory(object): | |||
268 | self.variables[newvar].append(i.copy()) | 264 | self.variables[newvar].append(i.copy()) |
269 | 265 | ||
270 | def variable(self, var): | 266 | def variable(self, var): |
271 | remote_connector = self.dataroot.getVar('_remote_data', False) | 267 | varhistory = [] |
272 | if remote_connector: | ||
273 | varhistory = remote_connector.getVarHistory(var) | ||
274 | else: | ||
275 | varhistory = [] | ||
276 | |||
277 | if var in self.variables: | 268 | if var in self.variables: |
278 | varhistory.extend(self.variables[var]) | 269 | varhistory.extend(self.variables[var]) |
279 | return varhistory | 270 | return varhistory |
@@ -471,10 +462,6 @@ class DataSmart(MutableMapping): | |||
471 | if var in dest: | 462 | if var in dest: |
472 | return dest[var], self.overridedata.get(var, None) | 463 | return dest[var], self.overridedata.get(var, None) |
473 | 464 | ||
474 | if "_remote_data" in dest: | ||
475 | connector = dest["_remote_data"]["_content"] | ||
476 | return connector.getVar(var) | ||
477 | |||
478 | if "_data" not in dest: | 465 | if "_data" not in dest: |
479 | break | 466 | break |
480 | dest = dest["_data"] | 467 | dest = dest["_data"] |
@@ -499,12 +486,6 @@ class DataSmart(MutableMapping): | |||
499 | if 'parsing' in loginfo: | 486 | if 'parsing' in loginfo: |
500 | parsing=True | 487 | parsing=True |
501 | 488 | ||
502 | if '_remote_data' in self.dict: | ||
503 | connector = self.dict["_remote_data"]["_content"] | ||
504 | res = connector.setVar(var, value) | ||
505 | if not res: | ||
506 | return | ||
507 | |||
508 | if 'op' not in loginfo: | 489 | if 'op' not in loginfo: |
509 | loginfo['op'] = "set" | 490 | loginfo['op'] = "set" |
510 | 491 | ||
@@ -612,12 +593,6 @@ class DataSmart(MutableMapping): | |||
612 | bb.warn("Calling renameVar with equivalent keys (%s) is invalid" % key) | 593 | bb.warn("Calling renameVar with equivalent keys (%s) is invalid" % key) |
613 | return | 594 | return |
614 | 595 | ||
615 | if '_remote_data' in self.dict: | ||
616 | connector = self.dict["_remote_data"]["_content"] | ||
617 | res = connector.renameVar(key, newkey) | ||
618 | if not res: | ||
619 | return | ||
620 | |||
621 | val = self.getVar(key, 0, parsing=True) | 596 | val = self.getVar(key, 0, parsing=True) |
622 | if val is not None: | 597 | if val is not None: |
623 | self.varhistory.rename_variable_hist(key, newkey) | 598 | self.varhistory.rename_variable_hist(key, newkey) |
@@ -663,11 +638,6 @@ class DataSmart(MutableMapping): | |||
663 | 638 | ||
664 | def delVar(self, var, **loginfo): | 639 | def delVar(self, var, **loginfo): |
665 | self.expand_cache = {} | 640 | self.expand_cache = {} |
666 | if '_remote_data' in self.dict: | ||
667 | connector = self.dict["_remote_data"]["_content"] | ||
668 | res = connector.delVar(var) | ||
669 | if not res: | ||
670 | return | ||
671 | 641 | ||
672 | loginfo['detail'] = "" | 642 | loginfo['detail'] = "" |
673 | loginfo['op'] = 'del' | 643 | loginfo['op'] = 'del' |
@@ -695,11 +665,6 @@ class DataSmart(MutableMapping): | |||
695 | 665 | ||
696 | def setVarFlag(self, var, flag, value, **loginfo): | 666 | def setVarFlag(self, var, flag, value, **loginfo): |
697 | self.expand_cache = {} | 667 | self.expand_cache = {} |
698 | if '_remote_data' in self.dict: | ||
699 | connector = self.dict["_remote_data"]["_content"] | ||
700 | res = connector.setVarFlag(var, flag, value) | ||
701 | if not res: | ||
702 | return | ||
703 | 668 | ||
704 | if 'op' not in loginfo: | 669 | if 'op' not in loginfo: |
705 | loginfo['op'] = "set" | 670 | loginfo['op'] = "set" |
@@ -850,11 +815,6 @@ class DataSmart(MutableMapping): | |||
850 | 815 | ||
851 | def delVarFlag(self, var, flag, **loginfo): | 816 | def delVarFlag(self, var, flag, **loginfo): |
852 | self.expand_cache = {} | 817 | self.expand_cache = {} |
853 | if '_remote_data' in self.dict: | ||
854 | connector = self.dict["_remote_data"]["_content"] | ||
855 | res = connector.delVarFlag(var, flag) | ||
856 | if not res: | ||
857 | return | ||
858 | 818 | ||
859 | local_var, _ = self._findVar(var) | 819 | local_var, _ = self._findVar(var) |
860 | if not local_var: | 820 | if not local_var: |
@@ -972,7 +932,7 @@ class DataSmart(MutableMapping): | |||
972 | 932 | ||
973 | def localkeys(self): | 933 | def localkeys(self): |
974 | for key in self.dict: | 934 | for key in self.dict: |
975 | if key not in ['_data', '_remote_data']: | 935 | if key not in ['_data']: |
976 | yield key | 936 | yield key |
977 | 937 | ||
978 | def __iter__(self): | 938 | def __iter__(self): |
@@ -981,7 +941,7 @@ class DataSmart(MutableMapping): | |||
981 | def keylist(d): | 941 | def keylist(d): |
982 | klist = set() | 942 | klist = set() |
983 | for key in d: | 943 | for key in d: |
984 | if key in ["_data", "_remote_data"]: | 944 | if key in ["_data"]: |
985 | continue | 945 | continue |
986 | if key in deleted: | 946 | if key in deleted: |
987 | continue | 947 | continue |
@@ -995,13 +955,6 @@ class DataSmart(MutableMapping): | |||
995 | if "_data" in d: | 955 | if "_data" in d: |
996 | klist |= keylist(d["_data"]) | 956 | klist |= keylist(d["_data"]) |
997 | 957 | ||
998 | if "_remote_data" in d: | ||
999 | connector = d["_remote_data"]["_content"] | ||
1000 | for key in connector.getKeys(): | ||
1001 | if key in deleted: | ||
1002 | continue | ||
1003 | klist.add(key) | ||
1004 | |||
1005 | return klist | 958 | return klist |
1006 | 959 | ||
1007 | self.need_overrides() | 960 | self.need_overrides() |