summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorChris Laplante <chris.laplante@agilent.com>2019-06-07 14:24:02 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-11 13:27:19 +0100
commit575ea5532f80883f8ee20dd1e78f699e8dccafc5 (patch)
tree56d73fb298b6452772c372ce557e5fae86073dd6 /bitbake
parent8c15a93553cbfd7c9ee0676076a3506a75616857 (diff)
downloadpoky-575ea5532f80883f8ee20dd1e78f699e8dccafc5.tar.gz
bitbake: build: extract progress handler creation logic into its own method
(Bitbake rev: a841efa50d3aaf7c57446806327b2b687371cb29) Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/build.py27
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
323set -e 323set -e
324''' 324'''
325 325
326def 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
326def exec_func_shell(func, d, runfile, cwd=None): 341def 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):