diff options
Diffstat (limited to 'lib/bb/command.py')
-rw-r--r-- | lib/bb/command.py | 91 |
1 files changed, 25 insertions, 66 deletions
diff --git a/lib/bb/command.py b/lib/bb/command.py index b38c151b3..287995093 100644 --- a/lib/bb/command.py +++ b/lib/bb/command.py @@ -450,54 +450,38 @@ class CommandsSync: return all_p, best getRuntimeProviders.readonly = True - def dataStoreConnectorFindVar(self, command, params): + def dataStoreConnectorCmd(self, command, params): dsindex = params[0] - name = params[1] - datastore = command.remotedatastores[dsindex] - value, overridedata = datastore._findVar(name) - - if value: - content = value.get('_content', None) - if isinstance(content, bb.data_smart.DataSmart): - # Value is a datastore (e.g. BB_ORIGENV) - need to handle this carefully - idx = command.remotedatastores.check_store(content, True) - return {'_content': DataStoreConnectionHandle(idx), - '_connector_origtype': 'DataStoreConnectionHandle', - '_connector_overrides': overridedata} - elif isinstance(content, set): - return {'_content': list(content), - '_connector_origtype': 'set', - '_connector_overrides': overridedata} - else: - value['_connector_overrides'] = overridedata - else: - value = {} - value['_connector_overrides'] = overridedata - return value - dataStoreConnectorFindVar.readonly = True + method = params[1] + args = params[2] + kwargs = params[3] - def dataStoreConnectorGetKeys(self, command, params): - dsindex = params[0] - datastore = command.remotedatastores[dsindex] - return list(datastore.keys()) - dataStoreConnectorGetKeys.readonly = True + d = command.remotedatastores[dsindex] + ret = getattr(d, method)(*args, **kwargs) + + if isinstance(ret, bb.data_smart.DataSmart): + idx = command.remotedatastores.store(ret) + return DataStoreConnectionHandle(idx) - def dataStoreConnectorGetVarHistory(self, command, params): + return ret + + def dataStoreConnectorVarHistCmd(self, command, params): dsindex = params[0] - name = params[1] - datastore = command.remotedatastores[dsindex] - return datastore.varhistory.variable(name) - dataStoreConnectorGetVarHistory.readonly = True + method = params[1] + args = params[2] + kwargs = params[3] - def dataStoreConnectorExpandPythonRef(self, command, params): - config_data_dict = params[0] - varname = params[1] - expr = params[2] + d = command.remotedatastores[dsindex].varhistory + return getattr(d, method)(*args, **kwargs) - config_data = command.remotedatastores.receive_datastore(config_data_dict) + def dataStoreConnectorIncHistCmd(self, command, params): + dsindex = params[0] + method = params[1] + args = params[2] + kwargs = params[3] - varparse = bb.data_smart.VariableParse(varname, config_data) - return varparse.python_sub(expr) + d = command.remotedatastores[dsindex].inchistory + return getattr(d, method)(*args, **kwargs) def dataStoreConnectorRelease(self, command, params): dsindex = params[0] @@ -505,31 +489,6 @@ class CommandsSync: raise CommandError('dataStoreConnectorRelease: invalid index %d' % dsindex) command.remotedatastores.release(dsindex) - def dataStoreConnectorSetVarFlag(self, command, params): - dsindex = params[0] - name = params[1] - flag = params[2] - value = params[3] - datastore = command.remotedatastores[dsindex] - datastore.setVarFlag(name, flag, value) - - def dataStoreConnectorDelVar(self, command, params): - dsindex = params[0] - name = params[1] - datastore = command.remotedatastores[dsindex] - if len(params) > 2: - flag = params[2] - datastore.delVarFlag(name, flag) - else: - datastore.delVar(name) - - def dataStoreConnectorRenameVar(self, command, params): - dsindex = params[0] - name = params[1] - newname = params[2] - datastore = command.remotedatastores[dsindex] - datastore.renameVar(name, newname) - def parseRecipeFile(self, command, params): """ Parse the specified recipe file (with or without bbappends) |