summaryrefslogtreecommitdiffstats
path: root/external/poky/bitbake/lib/bb/command.py
diff options
context:
space:
mode:
Diffstat (limited to 'external/poky/bitbake/lib/bb/command.py')
-rw-r--r--external/poky/bitbake/lib/bb/command.py114
1 files changed, 33 insertions, 81 deletions
diff --git a/external/poky/bitbake/lib/bb/command.py b/external/poky/bitbake/lib/bb/command.py
index 6c966e3d..6abf3866 100644
--- a/external/poky/bitbake/lib/bb/command.py
+++ b/external/poky/bitbake/lib/bb/command.py
@@ -6,18 +6,8 @@ Provide an interface to interact with the bitbake server through 'commands'
# Copyright (C) 2006-2007 Richard Purdie
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
+# SPDX-License-Identifier: GPL-2.0-only
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""
The bitbake server takes 'commands' from its UI/commandline.
@@ -75,7 +65,7 @@ class Command:
# Can run synchronous commands straight away
command_method = getattr(self.cmds_sync, command)
if ro_only:
- if not hasattr(command_method, 'readonly') or False == getattr(command_method, 'readonly'):
+ if not hasattr(command_method, 'readonly') or not getattr(command_method, 'readonly'):
return None, "Not able to execute not readonly commands in readonly mode"
try:
self.cooker.process_inotify_updates()
@@ -424,7 +414,11 @@ class CommandsSync:
getAllAppends.readonly = True
def findProviders(self, command, params):
- return command.cooker.findProviders()
+ try:
+ mc = params[0]
+ except IndexError:
+ mc = ''
+ return command.cooker.findProviders(mc)
findProviders.readonly = True
def findBestProvider(self, command, params):
@@ -456,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)
+
+ return ret
- def dataStoreConnectorGetVarHistory(self, command, params):
+ 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]
@@ -511,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)
@@ -546,8 +499,7 @@ class CommandsSync:
appends = params[1]
appendlist = params[2]
if len(params) > 3:
- config_data_dict = params[3]
- config_data = command.remotedatastores.receive_datastore(config_data_dict)
+ config_data = command.remotedatastores[params[3]]
else:
config_data = None