public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] OvmfPkg/build.sh: Parse qemu version in more cases
@ 2017-03-16 17:52 Jordan Justen
  2017-03-16 17:58 ` Laszlo Ersek
  0 siblings, 1 reply; 2+ messages in thread
From: Jordan Justen @ 2017-03-16 17:52 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jordan Justen, Laszlo Ersek

Since qemu v2.7.0, the pkgversion appears to have a bug:

$ ./configure --target-list=x86_64-softmmu --with-pkgversion=foo

Results in this output:

$ x86_64-softmmu/qemu-system-x86_64 -version
QEMU emulator version 2.8.90(foo)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers

This appears to have been introduced in:

67a1de0d19 Makefile: Derive "PKGVERSION" from "git describe" by default

The previous commit (077de81a4c) produces this output:

$ x86_64-softmmu/qemu-system-x86_64 -version
QEMU emulator version 2.6.50 (foo), Copyright (c) 2003-2008 Fabrice Bellard

Now the script use grep with '-o' to return only the matched text.

grep -E is also used with a simple regex to extract only the digits of
the version.

qemu-bug: https://bugs.launchpad.net/bugs/1673373

Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
---
 OvmfPkg/build.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/build.sh b/OvmfPkg/build.sh
index b6e936056c..f1acd55883 100755
--- a/OvmfPkg/build.sh
+++ b/OvmfPkg/build.sh
@@ -223,7 +223,9 @@ if [ -z "$PLATFORMFILE" ]; then
 fi
 
 if [[ "$RUN_QEMU" == "yes" ]]; then
-  qemu_version=$($QEMU_COMMAND -version 2>&1 | tail -1 | awk '{print $4}')
+  qemu_version=$($QEMU_COMMAND -version 2>&1 | \
+                   grep -o -E 'version [0-9]+\.[0-9]+\.[0-9]+' | \
+                     awk '{print $2}')
   case $qemu_version in
     1.[6-9].*|1.[1-9][0-9].*|2.*.*)
       ENABLE_FLASH=yes
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] OvmfPkg/build.sh: Parse qemu version in more cases
  2017-03-16 17:52 [PATCH] OvmfPkg/build.sh: Parse qemu version in more cases Jordan Justen
@ 2017-03-16 17:58 ` Laszlo Ersek
  0 siblings, 0 replies; 2+ messages in thread
From: Laszlo Ersek @ 2017-03-16 17:58 UTC (permalink / raw)
  To: Jordan Justen, edk2-devel

On 03/16/17 18:52, Jordan Justen wrote:
> Since qemu v2.7.0, the pkgversion appears to have a bug:
> 
> $ ./configure --target-list=x86_64-softmmu --with-pkgversion=foo
> 
> Results in this output:
> 
> $ x86_64-softmmu/qemu-system-x86_64 -version
> QEMU emulator version 2.8.90(foo)
> Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
> 
> This appears to have been introduced in:
> 
> 67a1de0d19 Makefile: Derive "PKGVERSION" from "git describe" by default
> 
> The previous commit (077de81a4c) produces this output:
> 
> $ x86_64-softmmu/qemu-system-x86_64 -version
> QEMU emulator version 2.6.50 (foo), Copyright (c) 2003-2008 Fabrice Bellard
> 
> Now the script use grep with '-o' to return only the matched text.
> 
> grep -E is also used with a simple regex to extract only the digits of
> the version.
> 
> qemu-bug: https://bugs.launchpad.net/bugs/1673373
> 
> Cc: Laszlo Ersek <lersek@redhat.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
> ---
>  OvmfPkg/build.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/OvmfPkg/build.sh b/OvmfPkg/build.sh
> index b6e936056c..f1acd55883 100755
> --- a/OvmfPkg/build.sh
> +++ b/OvmfPkg/build.sh
> @@ -223,7 +223,9 @@ if [ -z "$PLATFORMFILE" ]; then
>  fi
>  
>  if [[ "$RUN_QEMU" == "yes" ]]; then
> -  qemu_version=$($QEMU_COMMAND -version 2>&1 | tail -1 | awk '{print $4}')
> +  qemu_version=$($QEMU_COMMAND -version 2>&1 | \
> +                   grep -o -E 'version [0-9]+\.[0-9]+\.[0-9]+' | \
> +                     awk '{print $2}')
>    case $qemu_version in
>      1.[6-9].*|1.[1-9][0-9].*|2.*.*)
>        ENABLE_FLASH=yes
> 

Reviewed-by: Laszlo Ersek <lersek@redhat.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-16 17:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-16 17:52 [PATCH] OvmfPkg/build.sh: Parse qemu version in more cases Jordan Justen
2017-03-16 17:58 ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox