Gentoo Archives: gentoo-dev

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

Replies