summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/command.py
diff options
context:
space:
mode:
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]