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.py39
1 files changed, 31 insertions, 8 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 1fcb9bf14c..59a979ee90 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -24,6 +24,7 @@ import io
24import bb.event 24import bb.event
25import bb.cooker 25import bb.cooker
26import bb.remotedata 26import bb.remotedata
27import bb.parse
27 28
28class DataStoreConnectionHandle(object): 29class DataStoreConnectionHandle(object):
29 def __init__(self, dsindex=0): 30 def __init__(self, dsindex=0):
@@ -108,7 +109,7 @@ class Command:
108 109
109 def runAsyncCommand(self, _, process_server, halt): 110 def runAsyncCommand(self, _, process_server, halt):
110 try: 111 try:
111 if self.cooker.state in (bb.cooker.state.error, bb.cooker.state.shutdown, bb.cooker.state.forceshutdown): 112 if self.cooker.state in (bb.cooker.State.ERROR, bb.cooker.State.SHUTDOWN, bb.cooker.State.FORCE_SHUTDOWN):
112 # updateCache will trigger a shutdown of the parser 113 # updateCache will trigger a shutdown of the parser
113 # and then raise BBHandledException triggering an exit 114 # and then raise BBHandledException triggering an exit
114 self.cooker.updateCache() 115 self.cooker.updateCache()
@@ -118,7 +119,7 @@ class Command:
118 (command, options) = cmd 119 (command, options) = cmd
119 commandmethod = getattr(CommandsAsync, command) 120 commandmethod = getattr(CommandsAsync, command)
120 needcache = getattr( commandmethod, "needcache" ) 121 needcache = getattr( commandmethod, "needcache" )
121 if needcache and self.cooker.state != bb.cooker.state.running: 122 if needcache and self.cooker.state != bb.cooker.State.RUNNING:
122 self.cooker.updateCache() 123 self.cooker.updateCache()
123 return True 124 return True
124 else: 125 else:
@@ -142,14 +143,14 @@ class Command:
142 return bb.server.process.idleFinish(traceback.format_exc()) 143 return bb.server.process.idleFinish(traceback.format_exc())
143 144
144 def finishAsyncCommand(self, msg=None, code=None): 145 def finishAsyncCommand(self, msg=None, code=None):
146 self.cooker.finishcommand()
147 self.process_server.clear_async_cmd()
145 if msg or msg == "": 148 if msg or msg == "":
146 bb.event.fire(CommandFailed(msg), self.cooker.data) 149 bb.event.fire(CommandFailed(msg), self.cooker.data)
147 elif code: 150 elif code:
148 bb.event.fire(CommandExit(code), self.cooker.data) 151 bb.event.fire(CommandExit(code), self.cooker.data)
149 else: 152 else:
150 bb.event.fire(CommandCompleted(), self.cooker.data) 153 bb.event.fire(CommandCompleted(), self.cooker.data)
151 self.cooker.finishcommand()
152 self.process_server.clear_async_cmd()
153 154
154 def reset(self): 155 def reset(self):
155 if self.remotedatastores: 156 if self.remotedatastores:
@@ -310,7 +311,7 @@ class CommandsSync:
310 def revalidateCaches(self, command, params): 311 def revalidateCaches(self, command, params):
311 """Called by UI clients when metadata may have changed""" 312 """Called by UI clients when metadata may have changed"""
312 command.cooker.revalidateCaches() 313 command.cooker.revalidateCaches()
313 parseConfiguration.needconfig = False 314 revalidateCaches.needconfig = False
314 315
315 def getRecipes(self, command, params): 316 def getRecipes(self, command, params):
316 try: 317 try:
@@ -420,15 +421,30 @@ class CommandsSync:
420 return command.cooker.recipecaches[mc].pkg_dp 421 return command.cooker.recipecaches[mc].pkg_dp
421 getDefaultPreference.readonly = True 422 getDefaultPreference.readonly = True
422 423
424
423 def getSkippedRecipes(self, command, params): 425 def getSkippedRecipes(self, command, params):
426 """
427 Get the map of skipped recipes for the specified multiconfig/mc name (`params[0]`).
428
429 Invoked by `bb.tinfoil.Tinfoil.get_skipped_recipes`
430
431 :param command: Internally used parameter.
432 :param params: Parameter array. params[0] is multiconfig/mc name. If not given, then default mc '' is assumed.
433 :return: Dict whose keys are virtualfns and values are `bb.cooker.SkippedPackage`
434 """
435 try:
436 mc = params[0]
437 except IndexError:
438 mc = ''
439
424 # Return list sorted by reverse priority order 440 # Return list sorted by reverse priority order
425 import bb.cache 441 import bb.cache
426 def sortkey(x): 442 def sortkey(x):
427 vfn, _ = x 443 vfn, _ = x
428 realfn, _, mc = bb.cache.virtualfn2realfn(vfn) 444 realfn, _, item_mc = bb.cache.virtualfn2realfn(vfn)
429 return (-command.cooker.collections[mc].calc_bbfile_priority(realfn)[0], vfn) 445 return -command.cooker.collections[item_mc].calc_bbfile_priority(realfn)[0], vfn
430 446
431 skipdict = OrderedDict(sorted(command.cooker.skiplist.items(), key=sortkey)) 447 skipdict = OrderedDict(sorted(command.cooker.skiplist_by_mc[mc].items(), key=sortkey))
432 return list(skipdict.items()) 448 return list(skipdict.items())
433 getSkippedRecipes.readonly = True 449 getSkippedRecipes.readonly = True
434 450
@@ -582,6 +598,13 @@ class CommandsSync:
582 return DataStoreConnectionHandle(idx) 598 return DataStoreConnectionHandle(idx)
583 parseRecipeFile.readonly = True 599 parseRecipeFile.readonly = True
584 600
601 def finalizeData(self, command, params):
602 newdata = command.cooker.data.createCopy()
603 bb.data.expandKeys(newdata)
604 bb.parse.ast.runAnonFuncs(newdata)
605 idx = command.remotedatastores.store(newdata)
606 return DataStoreConnectionHandle(idx)
607
585class CommandsAsync: 608class CommandsAsync:
586 """ 609 """
587 A class of asynchronous commands 610 A class of asynchronous commands