summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/data_smart.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-03-20 17:05:53 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-22 11:35:22 +0000
commit5b1807021e932b1150095f3d1744d8411a28a1f0 (patch)
treeb949a92af026dfb0334be4fa627c48920538fa42 /bitbake/lib/bb/data_smart.py
parent99414bdb1c64f7f03e12c347cc16c43c2fa336b2 (diff)
downloadpoky-5b1807021e932b1150095f3d1744d8411a28a1f0.tar.gz
bitbake: 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.) (Bitbake rev: 282dc0719d22a39df746eea762ebe05c66aa8f8a) 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.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 5777d545a8..d6dd698eff 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -609,6 +609,12 @@ class DataSmart(MutableMapping):
609 """ 609 """
610 Rename the variable key to newkey 610 Rename the variable key to newkey
611 """ 611 """
612 if '_remote_data' in self.dict:
613 connector = self.dict["_remote_data"]["_content"]
614 res = connector.renameVar(key, newkey)
615 if not res:
616 return
617
612 val = self.getVar(key, 0, parsing=True) 618 val = self.getVar(key, 0, parsing=True)
613 if val is not None: 619 if val is not None:
614 loginfo['variable'] = newkey 620 loginfo['variable'] = newkey
@@ -652,6 +658,12 @@ class DataSmart(MutableMapping):
652 self.setVar(var + "_prepend", value, ignore=True, parsing=True) 658 self.setVar(var + "_prepend", value, ignore=True, parsing=True)
653 659
654 def delVar(self, var, **loginfo): 660 def delVar(self, var, **loginfo):
661 if '_remote_data' in self.dict:
662 connector = self.dict["_remote_data"]["_content"]
663 res = connector.delVar(var)
664 if not res:
665 return
666
655 loginfo['detail'] = "" 667 loginfo['detail'] = ""
656 loginfo['op'] = 'del' 668 loginfo['op'] = 'del'
657 self.varhistory.record(**loginfo) 669 self.varhistory.record(**loginfo)
@@ -678,6 +690,12 @@ class DataSmart(MutableMapping):
678 override = None 690 override = None
679 691
680 def setVarFlag(self, var, flag, value, **loginfo): 692 def setVarFlag(self, var, flag, value, **loginfo):
693 if '_remote_data' in self.dict:
694 connector = self.dict["_remote_data"]["_content"]
695 res = connector.setVarFlag(var, flag, value)
696 if not res:
697 return
698
681 self.expand_cache = {} 699 self.expand_cache = {}
682 if 'op' not in loginfo: 700 if 'op' not in loginfo:
683 loginfo['op'] = "set" 701 loginfo['op'] = "set"
@@ -796,6 +814,12 @@ class DataSmart(MutableMapping):
796 return value 814 return value
797 815
798 def delVarFlag(self, var, flag, **loginfo): 816 def delVarFlag(self, var, flag, **loginfo):
817 if '_remote_data' in self.dict:
818 connector = self.dict["_remote_data"]["_content"]
819 res = connector.delVarFlag(var, flag)
820 if not res:
821 return
822
799 self.expand_cache = {} 823 self.expand_cache = {}
800 local_var, _ = self._findVar(var) 824 local_var, _ = self._findVar(var)
801 if not local_var: 825 if not local_var:
@@ -938,7 +962,10 @@ class DataSmart(MutableMapping):
938 962
939 if "_remote_data" in d: 963 if "_remote_data" in d:
940 connector = d["_remote_data"]["_content"] 964 connector = d["_remote_data"]["_content"]
941 klist |= connector.getKeys() 965 for key in connector.getKeys():
966 if key in deleted:
967 continue
968 klist.add(key)
942 969
943 return klist 970 return klist
944 971