[Buildroot] [PATCH v2] utils/brmake: filter output for parallel build
Vincent Stehlé
vincent.stehle at arm.com
Tue Oct 21 16:51:26 UTC 2025
When building in parallel with per-package directories
(BR2_PER_PACKAGE_DIRECTORIES=y), brmake output is often garbled:
2025-10-08T18:39:10 >>> host-dtc 1.7.2 Building
2025-10-08T18:39:11 checking for stdint.h... >>> host-dtc 1.7.2 Installing to host directory
2025-10-08T18:39:12 checking for limits.h... >>> host-gmp 6.3.0 Installing to host directory
Remove the spurious string between the timestamp and the ">>>" marker to
fix this.
We need some extra care to preserve the preceding "term bold" special
characters sequence.
We also prevent grep and sed to buffer their output too much. This leads to
more frequent output even when we might not be connected to a terminal; for
example: when brmake's output is piped to another program or when running
in CI.
Reviewed-by: Marcus Hoffmann <buildroot at bubu1.eu>
Signed-off-by: Vincent Stehlé <vincent.stehle at arm.com>
Cc: Yann E. MORIN <yann.morin.1998 at free.fr>
---
Changes v1 -> v2:
- Add the `--unbuffered' option to sed (suggested by Marcus)
- Explain buffering a bit more in the commit message (suggested by Marcus)
Hi Marcus,
Thanks again for your interest in this patch.
I have added your reviewed-by; please let us know if your tested-by could
be added to this v2 as well.
Dear Yann,
Thank you for your interest and for sharing your brmake rewrite.
To be honest, I feel more comfortable with just this couple of modified
lines, which I think are well understood now after the discussion with
Marcus, than with the longer bash version using more "advanced" mechanisms,
like signals and coprocesses. I think I will not dare to submit this more
complex version...
Best regards,
Vincent.
utils/brmake | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/utils/brmake b/utils/brmake
index a4b9e7fa71..c29e56a9bc 100755
--- a/utils/brmake
+++ b/utils/brmake
@@ -12,7 +12,8 @@ main() {
printf "%(%Y-%m-%dT%H:%M:%S)T %s\n" -1 "${line}"
done \
|tee -a br.log \
- |grep --colour=never -E '>>>'
+ |grep --line-buffered --colour=never -E '>>>' \
+ |sed --unbuffered -E 's/^([0-9T:-]{19}) [[:print:]]*(.*>>> )/\1 \2/'
)
ret=${?}
--
2.51.0
More information about the buildroot
mailing list