summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/remotedata.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/bitbake/lib/bb/remotedata.py b/bitbake/lib/bb/remotedata.py
index 932ee430ea..68ecffc198 100644
--- a/bitbake/lib/bb/remotedata.py
+++ b/bitbake/lib/bb/remotedata.py
@@ -72,3 +72,45 @@ class RemoteDatastores:
72 if idx in self.locked: 72 if idx in self.locked:
73 raise Exception('Tried to release locked datastore %d' % idx) 73 raise Exception('Tried to release locked datastore %d' % idx)
74 del self.datastores[idx] 74 del self.datastores[idx]
75
76 def receive_datastore(self, remote_data):
77 """Receive a datastore object sent from the client (as prepared by transmit_datastore())"""
78 dct = dict(remote_data)
79 d = bb.data_smart.DataSmart()
80 d.dict = dct
81 while True:
82 if '_remote_data' in dct:
83 dsindex = dct['_remote_data']['_content']
84 del dct['_remote_data']
85 if dsindex is None:
86 dct['_data'] = self.cooker.data.dict
87 else:
88 dct['_data'] = self.datastores[dsindex].dict
89 break
90 elif '_data' in dct:
91 idct = dict(dct['_data'])
92 dct['_data'] = idct
93 dct = idct
94 else:
95 break
96 return d
97
98 @staticmethod
99 def transmit_datastore(d):
100 """Prepare a datastore object for sending over IPC from the client end"""
101 # FIXME content might be a dict, need to turn that into a list as well
102 def copy_dicts(dct):
103 if '_remote_data' in dct:
104 dsindex = dct['_remote_data']['_content'].dsindex
105 newdct = dct.copy()
106 newdct['_remote_data'] = {'_content': dsindex}
107 return list(newdct.items())
108 elif '_data' in dct:
109 newdct = dct.copy()
110 newdata = copy_dicts(dct['_data'])
111 if newdata:
112 newdct['_data'] = newdata
113 return list(newdct.items())
114 return None
115 main_dict = copy_dicts(d.dict)
116 return main_dict