diff options
author | Shane Wang <shane.wang@intel.com> | 2012-02-23 21:47:16 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-02-23 22:52:17 +0000 |
commit | 8fa33800efa530c765d85a520110285467ff29c2 (patch) | |
tree | 62cdc94429ed5772df63d0f200fdc49ccf0528a0 /bitbake/lib/bb/event.py | |
parent | de77b9752ab2df56d87dc15ed5cd0d2cd5544dc7 (diff) | |
download | poky-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.py | 83 |
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 | ||
207 | class OperationStarted(Event): | ||
208 | """An operation has begun""" | ||
209 | def __init__(self, msg = "Operation Started"): | ||
210 | Event.__init__(self) | ||
211 | self.msg = msg | ||
212 | |||
213 | class 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 | |||
220 | class 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 | |||
207 | class ConfigParsed(Event): | 228 | class 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 | ||
279 | class BuildStarted(BuildBase): | 300 | class 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 | 306 | class BuildCompleted(BuildBase, OperationCompleted): | |
283 | class 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 | ||
289 | class NoProvider(Event): | 316 | class NoProvider(Event): |
@@ -329,17 +356,16 @@ class MultipleProviders(Event): | |||
329 | """ | 356 | """ |
330 | return self._candidates | 357 | return self._candidates |
331 | 358 | ||
332 | class ParseStarted(Event): | 359 | class 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 | ||
338 | class ParseCompleted(Event): | 365 | class 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 | ||
352 | class ParseProgress(Event): | 377 | class 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 | ||
358 | class CacheLoadStarted(Event): | 383 | class 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 | ||
364 | class CacheLoadProgress(Event): | 389 | class 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 | ||
370 | class CacheLoadCompleted(Event): | 394 | class 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 | ||
400 | class TreeDataPreparationStarted(OperationStarted): | ||
401 | """Tree data preparation started""" | ||
402 | def __init__(self): | ||
403 | OperationStarted.__init__(self, "Preparing tree data Started") | ||
404 | |||
405 | class 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 | |||
410 | class TreeDataPreparationCompleted(OperationCompleted): | ||
411 | """Tree data preparation completed""" | ||
412 | def __init__(self, total): | ||
413 | OperationCompleted.__init__(self, total, "Preparing tree data Completed") | ||
377 | 414 | ||
378 | class DepTreeGenerated(Event): | 415 | class DepTreeGenerated(Event): |
379 | """ | 416 | """ |