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)
downloadpoky-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:
59 # FIXME Add lock for this 59 # FIXME Add lock for this
60 self.currentAsyncCommand = None 60 self.currentAsyncCommand = None
61 61
62 def runCommand(self, commandline): 62 def runCommand(self, commandline, ro_only = False):
63 command = commandline.pop(0) 63 command = commandline.pop(0)
64 if hasattr(CommandsSync, command): 64 if hasattr(CommandsSync, command):
65 # Can run synchronous commands straight away 65 # Can run synchronous commands straight away
66 command_method = getattr(self.cmds_sync, command) 66 command_method = getattr(self.cmds_sync, command)
67 if ro_only:
68 if not hasattr(command_method, 'readonly') or False == getattr(command_method, 'readonly'):
69 return None, "Not able to execute not readonly commands in readonly mode"
67 try: 70 try:
68 result = command_method(self, commandline) 71 result = command_method(self, commandline)
69 except CommandError as exc: 72 except CommandError as exc:
@@ -153,6 +156,7 @@ class CommandsSync:
153 expand = params[1] 156 expand = params[1]
154 157
155 return command.cooker.data.getVar(varname, expand) 158 return command.cooker.data.getVar(varname, expand)
159 getVariable.readonly = True
156 160
157 def setVariable(self, command, params): 161 def setVariable(self, command, params):
158 """ 162 """
@@ -200,6 +204,7 @@ class CommandsSync:
200 Get the CPU count on the bitbake server 204 Get the CPU count on the bitbake server
201 """ 205 """
202 return bb.utils.cpu_count() 206 return bb.utils.cpu_count()
207 getCpuCount.readonly = True
203 208
204 def matchFile(self, command, params): 209 def matchFile(self, command, params):
205 fMatch = params[0] 210 fMatch = params[0]