qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Juan Quintela <quintela@redhat.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] configure: Don't exit until all errors have been detected
Date: Thu, 21 May 2015 12:53:58 +0100	[thread overview]
Message-ID: <CAFEAcA86CbhMzPARbPDt-_xmggsHm_cgH_5HL8DVCMZY2-=n6w@mail.gmail.com> (raw)
In-Reply-To: <1431088821-27609-1-git-send-email-quintela@redhat.com>

On 8 May 2015 at 13:40, Juan Quintela <quintela@redhat.com> wrote:
> Currently, it exits until each error, so if you are installing on a new
> machine, it requires lots of configure runs until you get all the
> dependencies that you need.  With this change, it shows all the errors
> with the selected configured options.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  configure | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index b18aa9e..1d7966b 100755
> --- a/configure
> +++ b/configure
> @@ -38,6 +38,8 @@ printf " '%s'" "$0" "$@" >> config.log
>  echo >> config.log
>  echo "#" >> config.log
>
> +has_errors="no"
> +
>  error_exit() {
>      echo
>      echo "ERROR: $1"
> @@ -46,7 +48,7 @@ error_exit() {
>          shift
>      done
>      echo
> -    exit 1
> +    has_errors="yes"
>  }

This will cause problems in some cases which assume that
they're protected by an error_exit, or which at least
will cause a lot of spurious errors later on:

 * python version check assumes python exists
 * you really want to bail out early if the C compiler
   test fails
 * not having pkg-config is going to cause a lot of
   follow-on errors

Also it makes the function name pretty misleading.
I would suggest changing this function to just error,
and having error_exit for the few cases where we really
do want to bail out early.

> +
> +if [ "x$has_errors" == "xyes" ]; then

The POSIX shell string equality operator is "=".
"==" is a bashism and won't work on other shells.
Also, you don't need the 'x' here, so
    if [ "$has_errors" = "yes" ]; then
will do.

> +    echo "There are errors with this configuration.  Exiting."
> +    exit 1;
> +fi

As per discussion on IRC, this should go further up.

thanks
-- PMM

      reply	other threads:[~2015-05-21 11:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08 12:40 [Qemu-devel] [PATCH] configure: Don't exit until all errors have been detected Juan Quintela
2015-05-21 11:53 ` Peter Maydell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFEAcA86CbhMzPARbPDt-_xmggsHm_cgH_5HL8DVCMZY2-=n6w@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).