[bitbake-devel] [PATCH] ui/uihelper: Keep track of task numbers

Richard Purdie richard.purdie at linuxfoundation.org
Sat Nov 26 13:44:25 UTC 2011


Add code so the uihelper keeps track of how may tasks we've run and
how many tasks there are in total so UIs don't have to track
this information themselves.

Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
diff --git a/bitbake/lib/bb/ui/uihelper.py b/bitbake/lib/bb/ui/uihelper.py
index 617d60d..a73bfbe 100644
--- a/bitbake/lib/bb/ui/uihelper.py
+++ b/bitbake/lib/bb/ui/uihelper.py
@@ -24,6 +24,8 @@ class BBUIHelper:
         self.needUpdate = False
         self.running_tasks = {}
         self.failed_tasks = []
+        self.tasknumber_current = 0
+        self.tasknumber_total = 0
 
     def eventHandler(self, event):
         if isinstance(event, bb.build.TaskStarted):
@@ -36,6 +38,9 @@ class BBUIHelper:
             del self.running_tasks[event.pid]
             self.failed_tasks.append( { 'title' : "%s %s" % (event._package, event._task)})
             self.needUpdate = True
+        if isinstance(event, bb.runqueue.runQueueTaskStarted):
+            self.tasknumber_current = event.stats.completed + event.stats.active + event.stats.failed + 1
+            self.tasknumber_total = event.stats.total
 
     def getTasks(self):
         self.needUpdate = False






More information about the bitbake-devel mailing list