On Sat, Mar 2, 2013 at 1:42 PM, Michał Górny <[email protected]> wrote:
> Shift the unnecessary 'private' commands from the printed commands when
> executing.
>
> That is:
>
> python_parallel_foreach_impl foo
>
> will print:
>
> * pythonX.Y: foo
>
> rather than:
>
> * pythonX.Y: _multibuild_parallel _python_multibuild_wrapper ...
> ---
> gx86/eclass/multibuild.eclass | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/gx86/eclass/multibuild.eclass b/gx86/eclass/multibuild.eclass
> index 1c9058a..1cc33a9 100644
> --- a/gx86/eclass/multibuild.eclass
> +++ b/gx86/eclass/multibuild.eclass
> @@ -118,12 +118,23 @@ multibuild_foreach_variant() {
> # redirect_alloc_fd accepts files only. so we need to open
> # a random file and then reuse the fd for logger process.
> redirect_alloc_fd log_fd /dev/null
> +
> + _multibuild_run() {
> + # find the first non-private command
> + local i=1
> + while [[ ${!i} == _* ]]; do
> + (( i += 1 ))
> + done
> +
> + einfo "${v}: running ${@:${i}}"
So this is an einfo with an assignment side-effect? Can we perhaps
make the assignment explicit?
-A
> + "${@}"
> + }
> +
> # bash can't handle ${log_fd} in redirections,
> # we need to use eval to pass fd numbers directly.
> eval "
> exec ${log_fd}> >(exec tee -a
> \"\${T}/build-\${MULTIBUILD_ID}.log\")
> - einfo \"\${v}: running \${@}\" >&${log_fd} 2>&1
> - \"\${@}\" >&${log_fd} 2>&1
> + _multibuild_run \"\${@}\" >&${log_fd} 2>&1
> lret=\${?}
> exec ${log_fd}>&-
> "
> --
> 1.8.1.4
>
>