From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: Laszlo Ersek <lersek@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] roms/edk2-build.sh: Allow to run edk2-build.sh from command line
Date: Fri, 14 Jun 2019 12:16:16 +0200 [thread overview]
Message-ID: <7c44bcb6-1c72-e327-9091-394e6abfb51e@redhat.com> (raw)
In-Reply-To: <20190613175435.6575-1-philmd@redhat.com>
Cc'ing Eric :)
On 6/13/19 7:54 PM, Philippe Mathieu-Daudé wrote:
> The edk2-build.sh script set the 'nounset' option:
>
> BASH(1)
>
> set [arg ...]
>
> -u Treat unset variables and parameters other than the
> special parameters "@" and "*" as an error when
> performing parameter expansion. If expansion is
> attempted on an unset variable or parameter, the shell
> prints an error message, and, if not interactive,
> exits with a non-zero status.
>
> When running this script out of 'make', we get:
>
> $ cd roms
> $ ./edk2-build.sh aarch64 --arch=AARCH64 --platform=ArmVirtPkg/ArmVirtQemu.dsc > /dev/null
> ./edk2-build.sh: line 46: MAKEFLAGS: unbound variable
>
> Fix this by checking the variable is defined before using it,
> else use a default value.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> roms/edk2-build.sh | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/roms/edk2-build.sh b/roms/edk2-build.sh
> index 4f46f8a6a2..5390228b4e 100755
> --- a/roms/edk2-build.sh
> +++ b/roms/edk2-build.sh
> @@ -43,7 +43,13 @@ fi
> # any), for the edk2 "build" utility.
> source ../edk2-funcs.sh
> edk2_toolchain=$(qemu_edk2_get_toolchain "$emulation_target")
> -edk2_thread_count=$(qemu_edk2_get_thread_count "$MAKEFLAGS")
> +if [ -v MAKEFLAGS ]; then
> + edk2_thread_count=$(qemu_edk2_get_thread_count "$MAKEFLAGS")
> +else
> + # We are not running within 'make', let the edk2 "build" utility to fetch
> + # the logical CPU count with Python's multiprocessing.cpu_count() method.
> + edk2_thread_count=0
> +fi
> qemu_edk2_set_cross_env "$emulation_target"
>
> # Build the platform firmware.
>
next prev parent reply other threads:[~2019-06-14 10:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-13 17:54 [Qemu-devel] [PATCH] roms/edk2-build.sh: Allow to run edk2-build.sh from command line Philippe Mathieu-Daudé
2019-06-14 10:16 ` Philippe Mathieu-Daudé [this message]
2019-06-14 13:29 ` Eric Blake
2019-06-14 13:55 ` Philippe Mathieu-Daudé
2019-06-14 17:35 ` Laszlo Ersek
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=7c44bcb6-1c72-e327-9091-394e6abfb51e@redhat.com \
--to=philmd@redhat.com \
--cc=lersek@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).