Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 1/4] multibuild: print only 'public' part of command-line.
Date: Sat, 02 Mar 2013 21:42:30
Message-Id: 1362260530-26141-2-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] Further changes to multibuild.eclass by "Michał Górny"
1 Shift the unnecessary 'private' commands from the printed commands when
2 executing.
3
4 That is:
5
6 python_parallel_foreach_impl foo
7
8 will print:
9
10 * pythonX.Y: foo
11
12 rather than:
13
14 * pythonX.Y: _multibuild_parallel _python_multibuild_wrapper ...
15 ---
16 gx86/eclass/multibuild.eclass | 15 +++++++++++++--
17 1 file changed, 13 insertions(+), 2 deletions(-)
18
19 diff --git a/gx86/eclass/multibuild.eclass b/gx86/eclass/multibuild.eclass
20 index 1c9058a..1cc33a9 100644
21 --- a/gx86/eclass/multibuild.eclass
22 +++ b/gx86/eclass/multibuild.eclass
23 @@ -118,12 +118,23 @@ multibuild_foreach_variant() {
24 # redirect_alloc_fd accepts files only. so we need to open
25 # a random file and then reuse the fd for logger process.
26 redirect_alloc_fd log_fd /dev/null
27 +
28 + _multibuild_run() {
29 + # find the first non-private command
30 + local i=1
31 + while [[ ${!i} == _* ]]; do
32 + (( i += 1 ))
33 + done
34 +
35 + einfo "${v}: running ${@:${i}}"
36 + "${@}"
37 + }
38 +
39 # bash can't handle ${log_fd} in redirections,
40 # we need to use eval to pass fd numbers directly.
41 eval "
42 exec ${log_fd}> >(exec tee -a \"\${T}/build-\${MULTIBUILD_ID}.log\")
43 - einfo \"\${v}: running \${@}\" >&${log_fd} 2>&1
44 - \"\${@}\" >&${log_fd} 2>&1
45 + _multibuild_run \"\${@}\" >&${log_fd} 2>&1
46 lret=\${?}
47 exec ${log_fd}>&-
48 "
49 --
50 1.8.1.4

Replies