bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] bootstrap: use a more consistent error reporting scheme.


From: Jim Meyering
Subject: Re: [PATCH] bootstrap: use a more consistent error reporting scheme.
Date: Fri, 06 Jul 2012 15:25:14 +0200

Akim Demaille wrote:
> Le 6 juil. 2012 à 14:44, Jim Meyering a écrit :
>
>> No, but if you think it's better, somehow...
>> I meant that warnf would be a very thin wrapper around printf:
>>
>>    $ printf '%s\n' a b c
>>    a
>>    b
>>    c
>>
>>> Or should warnf expect a single %s
>>
>> or multiple %-directives:
>>
>>    $ printf '%s - %s\n' a b c d
>>    a - b
>>    c - d
>
> Ah, I was not aware of this feature, thanks!
> Now I see what you mean (thanks to Stefano too :).
>
> How about this?
>
> Subject: [PATCH] bootstrap: let warn be alike tests/init.sh's warn_

Thanks.

Nit #1:

  s/alike/like/

(both here and in ChangeLog)

> Reported by Jim Meyering.
> * build-aux/bootstrap (warn): Remove, replaced by...
> (warnf_, warn_): these.
> Adjust callers.
> Shorten messages that no longer fit in 80 columns.
> ---
>  ChangeLog           |  7 +++++++
>  build-aux/bootstrap | 41 ++++++++++++++++++++++++++---------------
>  2 files changed, 33 insertions(+), 15 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 785f92f..85d8e4d 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,5 +1,12 @@
>  2012-07-06  Akim Demaille  <address@hidden>
>
> +     bootstrap: let warn be alike tests/init.sh's warn_
> +     Reported by Jim Meyering.
> +     * build-aux/bootstrap (warn): Remove, replaced by...
> +     (warnf_, warn_): these.
> +     Adjust callers.
> +     Shorten messages that no longer fit in 80 columns.
> +
...
> +  warnf_format_=$1
> +  shift
> +  printf "$warnf_format_" "$@" | sed "s,^,$me: ," >&2

As Stefano says, you can avoid the fork/sed.

> +# warn_ WORD1...
> +warn_ ()
> +{
> +  # If IFS does not start with ' ', set it and emit the warning in a 
> subshell.
> +  case $IFS in
> +    ' '*) warnf_ '%s\n' "$*";;
> +    *)    (IFS=' '; warn_ "$@");;
> +  esac
>  }
>
> -die() { warn "$@"; exit 1; }
> +# die WORD1...
> +die() { warn_ "$@"; exit 1; }
>
>  # Configuration.
>
> @@ -335,8 +346,7 @@ grep '^[   ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' 
> configure.ac \
>  grep '^[      ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
>      >/dev/null && found_aux_dir=yes
>  test $found_aux_dir = yes \
> -  || die "expected line not found in configure.ac. Add the following:" \
> -         "  AC_CONFIG_AUX_DIR([$build_aux])"
> +  || die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])', add it"

s/,/;/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]