summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/command.py13
-rw-r--r--bitbake/lib/bb/cooker.py27
2 files changed, 28 insertions, 12 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 """
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index f0f9c66f4e..fb38289397 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1445,6 +1445,21 @@ class BBCooker:
1445 if timestamp: 1445 if timestamp:
1446 return timestr 1446 return timestr
1447 1447
1448 def updateCacheSync(self):
1449 if self.state == state.running:
1450 return
1451
1452 # reload files for which we got notifications
1453 for p in self.inotify_modified_files:
1454 bb.parse.update_cache(p)
1455 self.inotify_modified_files = []
1456
1457 if not self.baseconfig_valid:
1458 logger.debug(1, "Reloading base configuration data")
1459 self.initConfigurationData()
1460 self.baseconfig_valid = True
1461 self.parsecache_valid = False
1462
1448 # This is called for all async commands when self.state != running 1463 # This is called for all async commands when self.state != running
1449 def updateCache(self): 1464 def updateCache(self):
1450 if self.state == state.running: 1465 if self.state == state.running:
@@ -1456,17 +1471,7 @@ class BBCooker:
1456 raise bb.BBHandledException() 1471 raise bb.BBHandledException()
1457 1472
1458 if self.state != state.parsing: 1473 if self.state != state.parsing:
1459 1474 self.updateCacheSync()
1460 # reload files for which we got notifications
1461 for p in self.inotify_modified_files:
1462 bb.parse.update_cache(p)
1463 self.inotify_modified_files = []
1464
1465 if not self.baseconfig_valid:
1466 logger.debug(1, "Reloading base configuration data")
1467 self.initConfigurationData()
1468 self.baseconfig_valid = True
1469 self.parsecache_valid = False
1470 1475
1471 if self.state != state.parsing and not self.parsecache_valid: 1476 if self.state != state.parsing and not self.parsecache_valid:
1472 self.parseConfiguration () 1477 self.parseConfiguration ()