diff options
| -rw-r--r-- | bitbake/lib/bb/build.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index dae42ac47d..a0a764a7cb 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
| @@ -323,6 +323,21 @@ trap 'bb_exit_handler' 0 | |||
| 323 | set -e | 323 | set -e |
| 324 | ''' | 324 | ''' |
| 325 | 325 | ||
| 326 | def create_progress_handler(func, progress, logfile, d): | ||
| 327 | if progress == 'percent': | ||
| 328 | # Use default regex | ||
| 329 | return bb.progress.BasicProgressHandler(d, outfile=logfile) | ||
| 330 | elif progress.startswith('percent:'): | ||
| 331 | # Use specified regex | ||
| 332 | return bb.progress.BasicProgressHandler(d, regex=progress.split(':', 1)[1], outfile=logfile) | ||
| 333 | elif progress.startswith('outof:'): | ||
| 334 | # Use specified regex | ||
| 335 | return bb.progress.OutOfProgressHandler(d, regex=progress.split(':', 1)[1], outfile=logfile) | ||
| 336 | else: | ||
| 337 | bb.warn('%s: invalid task progress varflag value "%s", ignoring' % (func, progress)) | ||
| 338 | |||
| 339 | return logfile | ||
| 340 | |||
| 326 | def exec_func_shell(func, d, runfile, cwd=None): | 341 | def exec_func_shell(func, d, runfile, cwd=None): |
| 327 | """Execute a shell function from the metadata | 342 | """Execute a shell function from the metadata |
| 328 | 343 | ||
| @@ -366,17 +381,7 @@ exit $ret | |||
| 366 | 381 | ||
| 367 | progress = d.getVarFlag(func, 'progress') | 382 | progress = d.getVarFlag(func, 'progress') |
| 368 | if progress: | 383 | if progress: |
| 369 | if progress == 'percent': | 384 | logfile = create_progress_handler(func, progress, logfile, d) |
| 370 | # Use default regex | ||
| 371 | logfile = bb.progress.BasicProgressHandler(d, outfile=logfile) | ||
| 372 | elif progress.startswith('percent:'): | ||
| 373 | # Use specified regex | ||
| 374 | logfile = bb.progress.BasicProgressHandler(d, regex=progress.split(':', 1)[1], outfile=logfile) | ||
| 375 | elif progress.startswith('outof:'): | ||
| 376 | # Use specified regex | ||
| 377 | logfile = bb.progress.OutOfProgressHandler(d, regex=progress.split(':', 1)[1], outfile=logfile) | ||
| 378 | else: | ||
| 379 | bb.warn('%s: invalid task progress varflag value "%s", ignoring' % (func, progress)) | ||
| 380 | 385 | ||
| 381 | fifobuffer = bytearray() | 386 | fifobuffer = bytearray() |
| 382 | def readfifo(data): | 387 | def readfifo(data): |
