From 3ea9d647ec35c4d30dcaa5b58e9471b775a4716c Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Mon, 17 Jun 2013 12:11:51 +0100 Subject: 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 Signed-off-by: Richard Purdie --- bitbake/lib/bb/command.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'bitbake/lib/bb/command.py') 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] -- cgit v1.2.3-54-g00ecf