summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/event.py
diff options
context:
space:
mode:
authorShane Wang <shane.wang@intel.com>2012-02-23 21:47:16 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-02-23 22:52:17 +0000
commit8fa33800efa530c765d85a520110285467ff29c2 (patch)
tree62cdc94429ed5772df63d0f200fdc49ccf0528a0 /bitbake/lib/bb/event.py
parentde77b9752ab2df56d87dc15ed5cd0d2cd5544dc7 (diff)
downloadpoky-8fa33800efa530c765d85a520110285467ff29c2.tar.gz
bitbake: change for adding progress bar in Hob2.
The changes include: - Clean some events in event.py - Fire essential events for Hob2 to handle with more information. - knotty changes (Bitbake rev: 9ede881620c501574f014e600cea6947ea908ac2) Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/event.py')
-rw-r--r--bitbake/lib/bb/event.py83
1 files changed, 60 insertions, 23 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 10036c05c9..bbece583d1 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -204,6 +204,27 @@ def getName(e):
204 else: 204 else:
205 return e.__name__ 205 return e.__name__
206 206
207class OperationStarted(Event):
208 """An operation has begun"""
209 def __init__(self, msg = "Operation Started"):
210 Event.__init__(self)
211 self.msg = msg
212
213class OperationCompleted(Event):
214 """An operation has completed"""
215 def __init__(self, total, msg = "Operation Completed"):
216 Event.__init__(self)
217 self.total = total
218 self.msg = msg
219
220class OperationProgress(Event):
221 """An operation is in progress"""
222 def __init__(self, current, total, msg = "Operation in Progress"):
223 Event.__init__(self)
224 self.current = current
225 self.total = total
226 self.msg = msg + ": %s/%s" % (current, total);
227
207class ConfigParsed(Event): 228class ConfigParsed(Event):
208 """Configuration Parsing Complete""" 229 """Configuration Parsing Complete"""
209 230
@@ -276,14 +297,20 @@ class BuildBase(Event):
276 297
277 298
278 299
279class BuildStarted(BuildBase): 300class BuildStarted(BuildBase, OperationStarted):
280 """bbmake build run started""" 301 """bbmake build run started"""
302 def __init__(self, n, p, failures = 0):
303 OperationStarted.__init__(self, "Building Started")
304 BuildBase.__init__(self, n, p, failures)
281 305
282 306class BuildCompleted(BuildBase, OperationCompleted):
283class BuildCompleted(BuildBase):
284 """bbmake build run completed""" 307 """bbmake build run completed"""
285 308 def __init__(self, total, n, p, failures = 0):
286 309 if not failures:
310 OperationCompleted.__init__(self, total, "Building Succeeded")
311 else:
312 OperationCompleted.__init__(self, total, "Building Failed")
313 BuildBase.__init__(self, n, p, failures)
287 314
288 315
289class NoProvider(Event): 316class NoProvider(Event):
@@ -329,17 +356,16 @@ class MultipleProviders(Event):
329 """ 356 """
330 return self._candidates 357 return self._candidates
331 358
332class ParseStarted(Event): 359class ParseStarted(OperationStarted):
333 """Recipe parsing for the runqueue has begun""" 360 """Recipe parsing for the runqueue has begun"""
334 def __init__(self, total): 361 def __init__(self, total):
335 Event.__init__(self) 362 OperationStarted.__init__(self, "Recipe parsing Started")
336 self.total = total 363 self.total = total
337 364
338class ParseCompleted(Event): 365class ParseCompleted(OperationCompleted):
339 """Recipe parsing for the runqueue has completed""" 366 """Recipe parsing for the runqueue has completed"""
340
341 def __init__(self, cached, parsed, skipped, masked, virtuals, errors, total): 367 def __init__(self, cached, parsed, skipped, masked, virtuals, errors, total):
342 Event.__init__(self) 368 OperationCompleted.__init__(self, total, "Recipe parsing Completed")
343 self.cached = cached 369 self.cached = cached
344 self.parsed = parsed 370 self.parsed = parsed
345 self.skipped = skipped 371 self.skipped = skipped
@@ -347,33 +373,44 @@ class ParseCompleted(Event):
347 self.masked = masked 373 self.masked = masked
348 self.errors = errors 374 self.errors = errors
349 self.sofar = cached + parsed 375 self.sofar = cached + parsed
350 self.total = total
351 376
352class ParseProgress(Event): 377class ParseProgress(OperationProgress):
353 """Recipe parsing progress""" 378 """Recipe parsing progress"""
379 def __init__(self, current, total):
380 OperationProgress.__init__(self, current, total, "Recipe parsing")
354 381
355 def __init__(self, current):
356 self.current = current
357 382
358class CacheLoadStarted(Event): 383class CacheLoadStarted(OperationStarted):
359 """Loading of the dependency cache has begun""" 384 """Loading of the dependency cache has begun"""
360 def __init__(self, total): 385 def __init__(self, total):
361 Event.__init__(self) 386 OperationStarted.__init__(self, "Loading cache Started")
362 self.total = total 387 self.total = total
363 388
364class CacheLoadProgress(Event): 389class CacheLoadProgress(OperationProgress):
365 """Cache loading progress""" 390 """Cache loading progress"""
366 def __init__(self, current): 391 def __init__(self, current, total):
367 Event.__init__(self) 392 OperationProgress.__init__(self, current, total, "Loading cache")
368 self.current = current
369 393
370class CacheLoadCompleted(Event): 394class CacheLoadCompleted(OperationCompleted):
371 """Cache loading is complete""" 395 """Cache loading is complete"""
372 def __init__(self, total, num_entries): 396 def __init__(self, total, num_entries):
373 Event.__init__(self) 397 OperationCompleted.__init__(self, total, "Loading cache Completed")
374 self.total = total
375 self.num_entries = num_entries 398 self.num_entries = num_entries
376 399
400class TreeDataPreparationStarted(OperationStarted):
401 """Tree data preparation started"""
402 def __init__(self):
403 OperationStarted.__init__(self, "Preparing tree data Started")
404
405class TreeDataPreparationProgress(OperationProgress):
406 """Tree data preparation is in progress"""
407 def __init__(self, current, total):
408 OperationProgress.__init__(self, current, total, "Preparing tree data")
409
410class TreeDataPreparationCompleted(OperationCompleted):
411 """Tree data preparation completed"""
412 def __init__(self, total):
413 OperationCompleted.__init__(self, total, "Preparing tree data Completed")
377 414
378class DepTreeGenerated(Event): 415class DepTreeGenerated(Event):
379 """ 416 """