summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/command.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-17 12:12:19 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-19 18:05:45 +0100
commit37a2c062a5919473157e236fbb19a1eafba00f8e (patch)
tree2d4a8f8a5df6ca6463558ab0841637e1e070e726 /bitbake/lib/bb/command.py
parent6e5ac6ba8e229b5f8963efdce23072cf3b2b6dfc (diff)
downloadpoky-37a2c062a5919473157e236fbb19a1eafba00f8e.tar.gz
bitbake: command: ensure sync commands that read configuration see updates
Add a means of ensuring that synchronous commands that read the results of the configuration trigger a reparse of the configuration if any underlying files have changed. (Bitbake rev: aaf3cc024315450c1674819edf2a4e5cdf293f35) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Paul Eggleton <paul.eggleton@linux.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.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index a7cac97e2d..398c1d6a6e 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -68,6 +68,8 @@ class Command:
68 if not hasattr(command_method, 'readonly') or False == getattr(command_method, 'readonly'): 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" 69 return None, "Not able to execute not readonly commands in readonly mode"
70 try: 70 try:
71 if getattr(command_method, 'needconfig', False):
72 self.cooker.updateCacheSync()
71 result = command_method(self, commandline) 73 result = command_method(self, commandline)
72 except CommandError as exc: 74 except CommandError as exc:
73 return None, exc.args[0] 75 return None, exc.args[0]
@@ -204,6 +206,7 @@ class CommandsSync:
204 postfiles = params[1].split() 206 postfiles = params[1].split()
205 command.cooker.configuration.prefile = prefiles 207 command.cooker.configuration.prefile = prefiles
206 command.cooker.configuration.postfile = postfiles 208 command.cooker.configuration.postfile = postfiles
209 setPrePostConfFiles.needconfig = False
207 210
208 def getCpuCount(self, command, params): 211 def getCpuCount(self, command, params):
209 """ 212 """
@@ -211,10 +214,12 @@ class CommandsSync:
211 """ 214 """
212 return bb.utils.cpu_count() 215 return bb.utils.cpu_count()
213 getCpuCount.readonly = True 216 getCpuCount.readonly = True
217 getCpuCount.needconfig = False
214 218
215 def matchFile(self, command, params): 219 def matchFile(self, command, params):
216 fMatch = params[0] 220 fMatch = params[0]
217 return command.cooker.matchFile(fMatch) 221 return command.cooker.matchFile(fMatch)
222 matchFile.needconfig = False
218 223
219 def generateNewImage(self, command, params): 224 def generateNewImage(self, command, params):
220 image = params[0] 225 image = params[0]
@@ -228,6 +233,7 @@ class CommandsSync:
228 def ensureDir(self, command, params): 233 def ensureDir(self, command, params):
229 directory = params[0] 234 directory = params[0]
230 bb.utils.mkdirhier(directory) 235 bb.utils.mkdirhier(directory)
236 ensureDir.needconfig = False
231 237
232 def setVarFile(self, command, params): 238 def setVarFile(self, command, params):
233 """ 239 """
@@ -238,6 +244,7 @@ class CommandsSync:
238 default_file = params[2] 244 default_file = params[2]
239 op = params[3] 245 op = params[3]
240 command.cooker.modifyConfigurationVar(var, val, default_file, op) 246 command.cooker.modifyConfigurationVar(var, val, default_file, op)
247 setVarFile.needconfig = False
241 248
242 def removeVarFile(self, command, params): 249 def removeVarFile(self, command, params):
243 """ 250 """
@@ -245,6 +252,7 @@ class CommandsSync:
245 """ 252 """
246 var = params[0] 253 var = params[0]
247 command.cooker.removeConfigurationVar(var) 254 command.cooker.removeConfigurationVar(var)
255 removeVarFile.needconfig = False
248 256
249 def createConfigFile(self, command, params): 257 def createConfigFile(self, command, params):
250 """ 258 """
@@ -252,6 +260,7 @@ class CommandsSync:
252 """ 260 """
253 name = params[0] 261 name = params[0]
254 command.cooker.createConfigFile(name) 262 command.cooker.createConfigFile(name)
263 createConfigFile.needconfig = False
255 264
256 def setEventMask(self, command, params): 265 def setEventMask(self, command, params):
257 handlerNum = params[0] 266 handlerNum = params[0]
@@ -259,6 +268,7 @@ class CommandsSync:
259 debug_domains = params[2] 268 debug_domains = params[2]
260 mask = params[3] 269 mask = params[3]
261 return bb.event.set_UIHmask(handlerNum, llevel, debug_domains, mask) 270 return bb.event.set_UIHmask(handlerNum, llevel, debug_domains, mask)
271 setEventMask.needconfig = False
262 272
263 def setFeatures(self, command, params): 273 def setFeatures(self, command, params):
264 """ 274 """
@@ -266,7 +276,7 @@ class CommandsSync:
266 """ 276 """
267 features = params[0] 277 features = params[0]
268 command.cooker.setFeatures(features) 278 command.cooker.setFeatures(features)
269 279 setFeatures.needconfig = False
270 # although we change the internal state of the cooker, this is transparent since 280 # although we change the internal state of the cooker, this is transparent since
271 # we always take and leave the cooker in state.initial 281 # we always take and leave the cooker in state.initial
272 setFeatures.readonly = True 282 setFeatures.readonly = True
@@ -275,6 +285,7 @@ class CommandsSync:
275 options = params[0] 285 options = params[0]
276 environment = params[1] 286 environment = params[1]
277 command.cooker.updateConfigOpts(options, environment) 287 command.cooker.updateConfigOpts(options, environment)
288 updateConfig.needconfig = False
278 289
279class CommandsAsync: 290class CommandsAsync:
280 """ 291 """