summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/command.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2013-06-17 12:11:51 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-06-17 16:09:10 +0100
commit3ea9d647ec35c4d30dcaa5b58e9471b775a4716c (patch)
treee3e5022ce0e34320bd555942c418a3cb02282651 /bitbake/lib/bb/command.py
parent194b395f85dbed216b7dd51e66f8b567955307f2 (diff)
downloadopenembedded-core-contrib-3ea9d647ec35c4d30dcaa5b58e9471b775a4716c.tar.gz
bitbake: knotty, xmlrpc: add observer-only mode
I add an observer only mode for the knotty UI and the XMLRPC server that will allow the UI to register a callback with a server in order to receive events. The observer-UI is able to send read-only commands to the server, and also is able to register as an event handler. Read-only commands are the commands that do not change the state of the server and have been marked as such in the command module. The observer can switch to a full client if it calls addClient at any time, and the server has no other client running. (Bitbake rev: 4de9ee21f1fa4d04937cc7430fb1fc8b7a8f61e2) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/command.py')
-rw-r--r--bitbake/lib/bb/command.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index ab6950111f..5f696c2aee 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -59,11 +59,14 @@ class Command:
# FIXME Add lock for this
self.currentAsyncCommand = None
- def runCommand(self, commandline):
+ def runCommand(self, commandline, ro_only = False):
command = commandline.pop(0)
if hasattr(CommandsSync, 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'):
+ return None, "Not able to execute not readonly commands in readonly mode"
try:
result = command_method(self, commandline)
except CommandError as exc:
@@ -153,6 +156,7 @@ class CommandsSync:
expand = params[1]
return command.cooker.data.getVar(varname, expand)
+ getVariable.readonly = True
def setVariable(self, command, params):
"""
@@ -200,6 +204,7 @@ class CommandsSync:
Get the CPU count on the bitbake server
"""
return bb.utils.cpu_count()
+ getCpuCount.readonly = True
def matchFile(self, command, params):
fMatch = params[0]