Hello community,

here is the log from the commit of package qemu for openSUSE:Factory checked in 
at 2018-01-28 00:39:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/qemu (Old)
 and      /work/SRC/openSUSE:Factory/.qemu.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "qemu"

Sun Jan 28 00:39:00 2018 rev:134 rq:569858 version:2.11.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/qemu/qemu-linux-user.changes     2018-01-16 
09:35:49.620065810 +0100
+++ /work/SRC/openSUSE:Factory/.qemu.new/qemu-linux-user.changes        
2018-01-28 00:39:04.806483777 +0100
@@ -1,0 +2,24 @@
+Thu Jan 25 22:52:09 UTC 2018 - [email protected]
+
+- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.11
+* Patches dropped:
+  0032-scripts-avoid-usr-bin-python-refere.patch
+* Patches renamed:
+  0033-Switch-order-of-libraries-for-mpath.patch
+  -> 0032-Switch-order-of-libraries-for-mpath.patch
+  0034-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch
+  -> 0033-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch
+* Patches added:
+  0034-qapi-use-items-values-intead-of-ite.patch
+  0035-qapi-Use-OrderedDict-from-standard-.patch
+  0036-qapi-adapt-to-moved-location-of-Str.patch
+  0037-qapi-Adapt-to-moved-location-of-mak.patch
+  0038-qapi-remove-q-arg-to-diff-when-comp.patch
+  0039-qapi-ensure-stable-sort-ordering-wh.patch
+  0040-qapi-force-a-UTF-8-locale-for-runni.patch
+  0041-scripts-ensure-signrom-treats-data-.patch
+  0042-configure-allow-use-of-python-3.patch
+  0043-input-add-missing-JIS-keys-to-virti.patch
+  0044-Make-installed-scripts-explicitly-p.patch
+
+-------------------------------------------------------------------
--- /work/SRC/openSUSE:Factory/qemu/qemu-testsuite.changes      2018-01-16 
09:35:50.912005362 +0100
+++ /work/SRC/openSUSE:Factory/.qemu.new/qemu-testsuite.changes 2018-01-28 
00:39:04.858481355 +0100
@@ -1,0 +2,46 @@
+Fri Jan 26 11:49:03 UTC 2018 - [email protected]
+
+- Modify BuildRequires python references 
+- seabios also needed tweaks for python2 vs python3
+* Patches added:
+  seabios-use-python2-explicitly-as-needed.patch
+  seabios-switch-to-python3-as-needed.patch
+
+-------------------------------------------------------------------
+Thu Jan 25 22:52:06 UTC 2018 - [email protected]
+
+- Try to get our story right wrt python2 vs python3 (bsc#1077564)
+* Get rid of use of #!/usr/bin/env python in scripts we install
+* include proposed upstream build system changes needed for building
+  with python2 or python3 
+* Patches dropped:
+  0032-scripts-avoid-usr-bin-python-refere.patch
+* Patches renamed:
+  0033-Switch-order-of-libraries-for-mpath.patch
+  -> 0032-Switch-order-of-libraries-for-mpath.patch
+  0034-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch
+  -> 0033-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch
+* Patches added:
+  0034-qapi-use-items-values-intead-of-ite.patch
+  0035-qapi-Use-OrderedDict-from-standard-.patch
+  0036-qapi-adapt-to-moved-location-of-Str.patch
+  0037-qapi-Adapt-to-moved-location-of-mak.patch
+  0038-qapi-remove-q-arg-to-diff-when-comp.patch
+  0039-qapi-ensure-stable-sort-ordering-wh.patch
+  0040-qapi-force-a-UTF-8-locale-for-runni.patch
+  0041-scripts-ensure-signrom-treats-data-.patch
+  0042-configure-allow-use-of-python-3.patch
+  0043-input-add-missing-JIS-keys-to-virti.patch
+  0044-Make-installed-scripts-explicitly-p.patch
+  Make-installed-scripts-explicitly-python3.patch
+  ui-keycodemapdb-Add-missing-QKeyCode-val.patch
+  ui-keycodemapdb-Fix-compat-with-py3-dict.patch
+- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.11
+
+-------------------------------------------------------------------
+Fri Jan 12 23:05:17 UTC 2018 - [email protected]
+
+- Fix packaging dependencies (coreutils) for qemu-ksm package
+  (bsc#1040202)
+
+-------------------------------------------------------------------
qemu.changes: same change

Old:
----
  0032-scripts-avoid-usr-bin-python-refere.patch
  0033-Switch-order-of-libraries-for-mpath.patch
  0034-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch

New:
----
  0032-Switch-order-of-libraries-for-mpath.patch
  0033-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch
  0034-qapi-use-items-values-intead-of-ite.patch
  0035-qapi-Use-OrderedDict-from-standard-.patch
  0036-qapi-adapt-to-moved-location-of-Str.patch
  0037-qapi-Adapt-to-moved-location-of-mak.patch
  0038-qapi-remove-q-arg-to-diff-when-comp.patch
  0039-qapi-ensure-stable-sort-ordering-wh.patch
  0040-qapi-force-a-UTF-8-locale-for-runni.patch
  0041-scripts-ensure-signrom-treats-data-.patch
  0042-configure-allow-use-of-python-3.patch
  0043-input-add-missing-JIS-keys-to-virti.patch
  0044-Make-installed-scripts-explicitly-p.patch
  Make-installed-scripts-explicitly-python3.patch
  seabios-switch-to-python3-as-needed.patch
  seabios-use-python2-explicitly-as-needed.patch
  ui-keycodemapdb-Add-missing-QKeyCode-val.patch
  ui-keycodemapdb-Fix-compat-with-py3-dict.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ qemu-linux-user.spec ++++++
--- /var/tmp/diff_new_pack.lEh6vd/_old  2018-01-28 00:39:07.410362474 +0100
+++ /var/tmp/diff_new_pack.lEh6vd/_new  2018-01-28 00:39:07.414362287 +0100
@@ -57,9 +57,19 @@
 Patch0029:      0029-test-string-input-visitor-Add-uint6.patch
 Patch0030:      0030-tests-Add-QOM-property-unit-tests.patch
 Patch0031:      0031-tests-Add-scsi-disk-test.patch
-Patch0032:      0032-scripts-avoid-usr-bin-python-refere.patch
-Patch0033:      0033-Switch-order-of-libraries-for-mpath.patch
-Patch0034:      0034-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch
+Patch0032:      0032-Switch-order-of-libraries-for-mpath.patch
+Patch0033:      0033-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch
+Patch0034:      0034-qapi-use-items-values-intead-of-ite.patch
+Patch0035:      0035-qapi-Use-OrderedDict-from-standard-.patch
+Patch0036:      0036-qapi-adapt-to-moved-location-of-Str.patch
+Patch0037:      0037-qapi-Adapt-to-moved-location-of-mak.patch
+Patch0038:      0038-qapi-remove-q-arg-to-diff-when-comp.patch
+Patch0039:      0039-qapi-ensure-stable-sort-ordering-wh.patch
+Patch0040:      0040-qapi-force-a-UTF-8-locale-for-runni.patch
+Patch0041:      0041-scripts-ensure-signrom-treats-data-.patch
+Patch0042:      0042-configure-allow-use-of-python-3.patch
+Patch0043:      0043-input-add-missing-JIS-keys-to-virti.patch
+Patch0044:      0044-Make-installed-scripts-explicitly-p.patch
 # Please do not add QEMU patches manually here.
 # Run update_git.sh to regenerate this queue.
 Source400:      update_git.sh
@@ -123,6 +133,16 @@
 %patch0032 -p1
 %patch0033 -p1
 %patch0034 -p1
+%patch0035 -p1
+%patch0036 -p1
+%patch0037 -p1
+%patch0038 -p1
+%patch0039 -p1
+%patch0040 -p1
+%patch0041 -p1
+%patch0042 -p1
+%patch0043 -p1
+%patch0044 -p1
 
 %build
 ./configure \
@@ -131,6 +151,11 @@
        --libdir=%_libdir \
        --libexecdir=%_libexecdir \
        --localstatedir=%_localstatedir \
+%if 0%{?suse_version} > 1320
+        --python=%_bindir/python3 \
+%else
+        --python=%_bindir/python \
+%endif
        --extra-cflags="%{optflags}" \
        --disable-stack-protector \
        --disable-strip \

++++++ qemu-testsuite.spec ++++++
--- /var/tmp/diff_new_pack.lEh6vd/_old  2018-01-28 00:39:07.442360983 +0100
+++ /var/tmp/diff_new_pack.lEh6vd/_new  2018-01-28 00:39:07.450360610 +0100
@@ -161,29 +161,49 @@
 Patch0029:      0029-test-string-input-visitor-Add-uint6.patch
 Patch0030:      0030-tests-Add-QOM-property-unit-tests.patch
 Patch0031:      0031-tests-Add-scsi-disk-test.patch
-Patch0032:      0032-scripts-avoid-usr-bin-python-refere.patch
-Patch0033:      0033-Switch-order-of-libraries-for-mpath.patch
-Patch0034:      0034-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch
+Patch0032:      0032-Switch-order-of-libraries-for-mpath.patch
+Patch0033:      0033-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch
+Patch0034:      0034-qapi-use-items-values-intead-of-ite.patch
+Patch0035:      0035-qapi-Use-OrderedDict-from-standard-.patch
+Patch0036:      0036-qapi-adapt-to-moved-location-of-Str.patch
+Patch0037:      0037-qapi-Adapt-to-moved-location-of-mak.patch
+Patch0038:      0038-qapi-remove-q-arg-to-diff-when-comp.patch
+Patch0039:      0039-qapi-ensure-stable-sort-ordering-wh.patch
+Patch0040:      0040-qapi-force-a-UTF-8-locale-for-runni.patch
+Patch0041:      0041-scripts-ensure-signrom-treats-data-.patch
+Patch0042:      0042-configure-allow-use-of-python-3.patch
+Patch0043:      0043-input-add-missing-JIS-keys-to-virti.patch
+Patch0044:      0044-Make-installed-scripts-explicitly-p.patch
 # Please do not add QEMU patches manually here.
 # Run update_git.sh to regenerate this queue.
 
-# SeaBIOS / SeaVGABIOS (Currently no patches)
+# If for any reason we have base QEMU patches which are conditionally applied,
+# include them here
+Patch1000:      Make-installed-scripts-explicitly-python3.patch
+
+# SeaBIOS / SeaVGABIOS
+Patch1100:      seabios-use-python2-explicitly-as-needed.patch
+Patch1101:      seabios-switch-to-python3-as-needed.patch
 
 # ipxe
 # PATCH-FIX-OPENSUSE ipxe-stable-buildid.patch [email protected] -- 
reproducible builds
-Patch1100:      ipxe-stable-buildid.patch
-Patch1101:      ipxe-use-gcc6-for-more-compact-code.patch
+Patch1200:      ipxe-stable-buildid.patch
+Patch1201:      ipxe-use-gcc6-for-more-compact-code.patch
 
 # sgabios
 # PATCH-FIX-OPENSUSE sgabios-stable-buildid.patch [email protected] -- 
reproducible builds
-Patch1200:      sgabios-stable-buildid.patch
+Patch1300:      sgabios-stable-buildid.patch
 
 # SLOF (Currently no patches)
 
 # skiboot
-Patch1400:      skiboot-GCC7-fixes-for-Wimplicit-fallthr.patch
-Patch1401:      skiboot-libc-stdio-vsnprintf.c-add-expli.patch
-Patch1402:      skiboot-build-LDFLAGS-pass-pie-flag-explicitly-to-ld.patch
+Patch1500:      skiboot-GCC7-fixes-for-Wimplicit-fallthr.patch
+Patch1501:      skiboot-libc-stdio-vsnprintf.c-add-expli.patch
+Patch1502:      skiboot-build-LDFLAGS-pass-pie-flag-explicitly-to-ld.patch
+
+# ui/keycodemapdb
+Patch1600:      ui-keycodemapdb-Add-missing-QKeyCode-val.patch
+Patch1601:      ui-keycodemapdb-Fix-compat-with-py3-dict.patch
 
 # this is to make lint happy
 Source300:      qemu-rpmlintrc
@@ -298,7 +318,11 @@
 %endif
 BuildRequires:  pkgconfig
 BuildRequires:  pwdutils
-BuildRequires:  python
+%if 0%{?suse_version} > 1320
+BuildRequires:  python3-base
+%else
+BuildRequires:  python-base
+%endif
 %if 0%{?suse_version} >= 1315
 BuildRequires:  rdma-core-devel
 %endif
@@ -732,6 +756,8 @@
 %package ksm
 Summary:        Kernel Samepage Merging services
 Group:          System/Emulators/PC
+Requires(pre):  coreutils
+Requires(post): coreutils
 
 %description ksm
 Kernel Samepage Merging (KSM) is a memory-saving de-duplication feature, that
@@ -778,25 +804,51 @@
 %patch0032 -p1
 %patch0033 -p1
 %patch0034 -p1
+%patch0035 -p1
+%patch0036 -p1
+%patch0037 -p1
+%patch0038 -p1
+%patch0039 -p1
+%patch0040 -p1
+%patch0041 -p1
+%patch0042 -p1
+%patch0043 -p1
+%patch0044 -p1
 
-pushd roms/ipxe
+%if 0%{?suse_version} > 1320
+%patch1000 -p1
+%endif
+
+pushd roms/seabios
 %patch1100 -p1
-%if 0%{?suse_version} <= 1320
+%if 0%{?suse_version} > 1320
 %patch1101 -p1
 %endif
 popd
 
-pushd roms/sgabios
+pushd roms/ipxe
 %patch1200 -p1
+%if 0%{?suse_version} <= 1320
+%patch1201 -p1
+%endif
+popd
+
+pushd roms/sgabios
+%patch1300 -p1
 popd
 
 pushd roms/SLOF
 popd
 
 pushd roms/skiboot
-%patch1400 -p1
-%patch1401 -p1
-%patch1402 -p1
+%patch1500 -p1
+%patch1501 -p1
+%patch1502 -p1
+popd
+
+pushd ui/keycodemapdb
+%patch1600 -p1
+%patch1601 -p1
 popd
 
 # as a safeguard, delete the firmware files that we intend to build
@@ -815,6 +867,11 @@
        --localstatedir=%_localstatedir \
        --docdir=%_docdir/%name \
        --firmwarepath=%_datadir/%name \
+%if 0%{?suse_version} > 1320
+        --python=%_bindir/python3 \
+%else
+        --python=%_bindir/python2 \
+%endif
        --extra-cflags="%{optflags}" \
        --disable-stack-protector \
        --disable-strip \

++++++ qemu.spec ++++++
--- /var/tmp/diff_new_pack.lEh6vd/_old  2018-01-28 00:39:07.478359306 +0100
+++ /var/tmp/diff_new_pack.lEh6vd/_new  2018-01-28 00:39:07.482359120 +0100
@@ -161,29 +161,49 @@
 Patch0029:      0029-test-string-input-visitor-Add-uint6.patch
 Patch0030:      0030-tests-Add-QOM-property-unit-tests.patch
 Patch0031:      0031-tests-Add-scsi-disk-test.patch
-Patch0032:      0032-scripts-avoid-usr-bin-python-refere.patch
-Patch0033:      0033-Switch-order-of-libraries-for-mpath.patch
-Patch0034:      0034-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch
+Patch0032:      0032-Switch-order-of-libraries-for-mpath.patch
+Patch0033:      0033-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch
+Patch0034:      0034-qapi-use-items-values-intead-of-ite.patch
+Patch0035:      0035-qapi-Use-OrderedDict-from-standard-.patch
+Patch0036:      0036-qapi-adapt-to-moved-location-of-Str.patch
+Patch0037:      0037-qapi-Adapt-to-moved-location-of-mak.patch
+Patch0038:      0038-qapi-remove-q-arg-to-diff-when-comp.patch
+Patch0039:      0039-qapi-ensure-stable-sort-ordering-wh.patch
+Patch0040:      0040-qapi-force-a-UTF-8-locale-for-runni.patch
+Patch0041:      0041-scripts-ensure-signrom-treats-data-.patch
+Patch0042:      0042-configure-allow-use-of-python-3.patch
+Patch0043:      0043-input-add-missing-JIS-keys-to-virti.patch
+Patch0044:      0044-Make-installed-scripts-explicitly-p.patch
 # Please do not add QEMU patches manually here.
 # Run update_git.sh to regenerate this queue.
 
-# SeaBIOS / SeaVGABIOS (Currently no patches)
+# If for any reason we have base QEMU patches which are conditionally applied,
+# include them here
+Patch1000:      Make-installed-scripts-explicitly-python3.patch
+
+# SeaBIOS / SeaVGABIOS
+Patch1100:      seabios-use-python2-explicitly-as-needed.patch
+Patch1101:      seabios-switch-to-python3-as-needed.patch
 
 # ipxe
 # PATCH-FIX-OPENSUSE ipxe-stable-buildid.patch [email protected] -- 
reproducible builds
-Patch1100:      ipxe-stable-buildid.patch
-Patch1101:      ipxe-use-gcc6-for-more-compact-code.patch
+Patch1200:      ipxe-stable-buildid.patch
+Patch1201:      ipxe-use-gcc6-for-more-compact-code.patch
 
 # sgabios
 # PATCH-FIX-OPENSUSE sgabios-stable-buildid.patch [email protected] -- 
reproducible builds
-Patch1200:      sgabios-stable-buildid.patch
+Patch1300:      sgabios-stable-buildid.patch
 
 # SLOF (Currently no patches)
 
 # skiboot
-Patch1400:      skiboot-GCC7-fixes-for-Wimplicit-fallthr.patch
-Patch1401:      skiboot-libc-stdio-vsnprintf.c-add-expli.patch
-Patch1402:      skiboot-build-LDFLAGS-pass-pie-flag-explicitly-to-ld.patch
+Patch1500:      skiboot-GCC7-fixes-for-Wimplicit-fallthr.patch
+Patch1501:      skiboot-libc-stdio-vsnprintf.c-add-expli.patch
+Patch1502:      skiboot-build-LDFLAGS-pass-pie-flag-explicitly-to-ld.patch
+
+# ui/keycodemapdb
+Patch1600:      ui-keycodemapdb-Add-missing-QKeyCode-val.patch
+Patch1601:      ui-keycodemapdb-Fix-compat-with-py3-dict.patch
 
 # this is to make lint happy
 Source300:      qemu-rpmlintrc
@@ -298,7 +318,11 @@
 %endif
 BuildRequires:  pkgconfig
 BuildRequires:  pwdutils
-BuildRequires:  python
+%if 0%{?suse_version} > 1320
+BuildRequires:  python3-base
+%else
+BuildRequires:  python-base
+%endif
 %if 0%{?suse_version} >= 1315
 BuildRequires:  rdma-core-devel
 %endif
@@ -732,6 +756,8 @@
 %package ksm
 Summary:        Kernel Samepage Merging services
 Group:          System/Emulators/PC
+Requires(pre):  coreutils
+Requires(post): coreutils
 
 %description ksm
 Kernel Samepage Merging (KSM) is a memory-saving de-duplication feature, that
@@ -778,25 +804,51 @@
 %patch0032 -p1
 %patch0033 -p1
 %patch0034 -p1
+%patch0035 -p1
+%patch0036 -p1
+%patch0037 -p1
+%patch0038 -p1
+%patch0039 -p1
+%patch0040 -p1
+%patch0041 -p1
+%patch0042 -p1
+%patch0043 -p1
+%patch0044 -p1
 
-pushd roms/ipxe
+%if 0%{?suse_version} > 1320
+%patch1000 -p1
+%endif
+
+pushd roms/seabios
 %patch1100 -p1
-%if 0%{?suse_version} <= 1320
+%if 0%{?suse_version} > 1320
 %patch1101 -p1
 %endif
 popd
 
-pushd roms/sgabios
+pushd roms/ipxe
 %patch1200 -p1
+%if 0%{?suse_version} <= 1320
+%patch1201 -p1
+%endif
+popd
+
+pushd roms/sgabios
+%patch1300 -p1
 popd
 
 pushd roms/SLOF
 popd
 
 pushd roms/skiboot
-%patch1400 -p1
-%patch1401 -p1
-%patch1402 -p1
+%patch1500 -p1
+%patch1501 -p1
+%patch1502 -p1
+popd
+
+pushd ui/keycodemapdb
+%patch1600 -p1
+%patch1601 -p1
 popd
 
 # as a safeguard, delete the firmware files that we intend to build
@@ -815,6 +867,11 @@
        --localstatedir=%_localstatedir \
        --docdir=%_docdir/%name \
        --firmwarepath=%_datadir/%name \
+%if 0%{?suse_version} > 1320
+        --python=%_bindir/python3 \
+%else
+        --python=%_bindir/python2 \
+%endif
        --extra-cflags="%{optflags}" \
        --disable-stack-protector \
        --disable-strip \

++++++ 0033-Switch-order-of-libraries-for-mpath.patch -> 
0032-Switch-order-of-libraries-for-mpath.patch ++++++
--- 
/work/SRC/openSUSE:Factory/qemu/0033-Switch-order-of-libraries-for-mpath.patch  
    2017-12-21 11:23:07.609736825 +0100
+++ 
/work/SRC/openSUSE:Factory/.qemu.new/0032-Switch-order-of-libraries-for-mpath.patch
 2018-01-28 00:39:02.062611602 +0100
@@ -1,4 +1,4 @@
-From dc5a5c0f142eb0176824a440de94b77544ce2fdc Mon Sep 17 00:00:00 2001
+From da5c27969ecbaf94d9615a2bff11447e479382a7 Mon Sep 17 00:00:00 2001
 From: Bruce Rogers <[email protected]>
 Date: Fri, 3 Nov 2017 11:12:40 -0600
 Subject: [PATCH] Switch order of libraries for mpath support

++++++ 0034-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch -> 
0033-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch ++++++
--- 
/work/SRC/openSUSE:Factory/qemu/0034-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch  
    2018-01-16 09:35:48.972096127 +0100
+++ 
/work/SRC/openSUSE:Factory/.qemu.new/0033-i386-kvm-MSR_IA32_SPEC_CTRL-and-MSR.patch
 2018-01-28 00:39:02.450593527 +0100
@@ -1,4 +1,4 @@
-From 5db61cfacabb4d9b385a2c7a4d7a7a9e25e0a91a Mon Sep 17 00:00:00 2001
+From 386bbf8992317f3106d45dbfdb4b577029e9091f Mon Sep 17 00:00:00 2001
 From: Wei Wang <[email protected]>
 Date: Tue, 7 Nov 2017 16:39:49 +0800
 Subject: [PATCH] i386/kvm: MSR_IA32_SPEC_CTRL and MSR_IA32_PRED_CMD

++++++ 0034-qapi-use-items-values-intead-of-ite.patch ++++++
>From 613ea1552bdffe9d3d913df26922a4edb4afa56d Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <[email protected]>
Date: Mon, 15 Jan 2018 17:02:31 +0000
Subject: [PATCH] qapi: use items()/values() intead of iteritems()/itervalues()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The iteritems()/itervalues() methods are gone in py3, but the
items()/values() methods are still around. The latter are less
efficient than the former in py2, but this has unmeasurably
small impact on QEMU build time, so taking portability over
efficiency is a net win.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
---
 scripts/qapi.py                | 24 ++++++++++++------------
 scripts/qapi2texi.py           | 11 ++++++-----
 tests/qapi-schema/test-qapi.py | 37 +++++++++++++++++++------------------
 3 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/scripts/qapi.py b/scripts/qapi.py
index 62dc52ed6e..d5ac21ad35 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -11,6 +11,7 @@
 # This work is licensed under the terms of the GNU GPL, version 2.
 # See the COPYING file in the top-level directory.
 
+from __future__ import print_function
 import errno
 import getopt
 import os
@@ -252,7 +253,7 @@ class QAPIDoc(object):
                                "'Returns:' is only valid for commands")
 
     def check(self):
-        bogus = [name for name, section in self.args.iteritems()
+        bogus = [name for name, section in self.args.items()
                  if not section.member]
         if bogus:
             raise QAPISemError(
@@ -308,7 +309,7 @@ class QAPISchemaParser(object):
                 if not isinstance(pragma, dict):
                     raise QAPISemError(
                         info, "Value of 'pragma' must be a dictionary")
-                for name, value in pragma.iteritems():
+                for name, value in pragma.items():
                     self._pragma(name, value, info)
             else:
                 expr_elem = {'expr': expr,
@@ -1476,7 +1477,7 @@ class QAPISchema(object):
             self._def_exprs()
             self.check()
         except QAPIError as err:
-            print >>sys.stderr, err
+            print(err, file=sys.stderr)
             exit(1)
 
     def _def_entity(self, ent):
@@ -1574,7 +1575,7 @@ class QAPISchema(object):
 
     def _make_members(self, data, info):
         return [self._make_member(key, value, info)
-                for (key, value) in data.iteritems()]
+                for (key, value) in data.items()]
 
     def _def_struct_type(self, expr, info, doc):
         name = expr['struct']
@@ -1606,11 +1607,11 @@ class QAPISchema(object):
                 name, info, doc, 'base', self._make_members(base, info)))
         if tag_name:
             variants = [self._make_variant(key, value)
-                        for (key, value) in data.iteritems()]
+                        for (key, value) in data.items()]
             members = []
         else:
             variants = [self._make_simple_variant(key, value, info)
-                        for (key, value) in data.iteritems()]
+                        for (key, value) in data.items()]
             typ = self._make_implicit_enum_type(name, info,
                                                 [v.name for v in variants])
             tag_member = QAPISchemaObjectTypeMember('type', typ, False)
@@ -1625,7 +1626,7 @@ class QAPISchema(object):
         name = expr['alternate']
         data = expr['data']
         variants = [self._make_variant(key, value)
-                    for (key, value) in data.iteritems()]
+                    for (key, value) in data.items()]
         tag_member = QAPISchemaObjectTypeMember('type', 'QType', False)
         self._def_entity(
             QAPISchemaAlternateType(name, info, doc,
@@ -1940,7 +1941,7 @@ def parse_command_line(extra_options='', 
extra_long_options=[]):
                                        ['source', 'header', 'prefix=',
                                         'output-dir='] + extra_long_options)
     except getopt.GetoptError as err:
-        print >>sys.stderr, "%s: %s" % (sys.argv[0], str(err))
+        print("%s: %s" % (sys.argv[0], str(err)), file=sys.stderr)
         sys.exit(1)
 
     output_dir = ''
@@ -1954,9 +1955,8 @@ def parse_command_line(extra_options='', 
extra_long_options=[]):
         if o in ('-p', '--prefix'):
             match = re.match(r'([A-Za-z_.-][A-Za-z0-9_.-]*)?', a)
             if match.end() != len(a):
-                print >>sys.stderr, \
-                    "%s: 'funny character '%s' in argument of --prefix" \
-                    % (sys.argv[0], a[match.end()])
+                print("%s: 'funny character '%s' in argument of --prefix" \
+                      % (sys.argv[0], a[match.end()]), file=sys.stderr)
                 sys.exit(1)
             prefix = a
         elif o in ('-o', '--output-dir'):
@@ -1973,7 +1973,7 @@ def parse_command_line(extra_options='', 
extra_long_options=[]):
         do_h = True
 
     if len(args) != 1:
-        print >>sys.stderr, "%s: need exactly one argument" % sys.argv[0]
+        print("%s: need exactly one argument" % sys.argv[0], file=sys.stderr)
         sys.exit(1)
     fname = args[0]
 
diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py
index a317526e51..a61e88934b 100755
--- a/scripts/qapi2texi.py
+++ b/scripts/qapi2texi.py
@@ -4,6 +4,7 @@
 # This work is licensed under the terms of the GNU LGPL, version 2+.
 # See the COPYING file in the top-level directory.
 """This script produces the documentation of a qapi schema in texinfo format"""
+from __future__ import print_function
 import re
 import sys
 
@@ -147,7 +148,7 @@ def texi_member(member, suffix=''):
 def texi_members(doc, what, base, variants, member_func):
     """Format the table of members"""
     items = ''
-    for section in doc.args.itervalues():
+    for section in doc.args.values():
         # TODO Drop fallbacks when undocumented members are outlawed
         if section.content:
             desc = texi_format(str(section))
@@ -285,15 +286,15 @@ def texi_schema(schema):
 def main(argv):
     """Takes schema argument, prints result to stdout"""
     if len(argv) != 2:
-        print >>sys.stderr, "%s: need exactly 1 argument: SCHEMA" % argv[0]
+        print("%s: need exactly 1 argument: SCHEMA" % argv[0], file=sys.stderr)
         sys.exit(1)
 
     schema = qapi.QAPISchema(argv[1])
     if not qapi.doc_required:
-        print >>sys.stderr, ("%s: need pragma 'doc-required' "
-                             "to generate documentation" % argv[0])
+        print("%s: need pragma 'doc-required' "
+               "to generate documentation" % argv[0], file=sys.stderr)
         sys.exit(1)
-    print texi_schema(schema)
+    print(texi_schema(schema))
 
 
 if __name__ == '__main__':
diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py
index c7724d3437..9bbe35daf0 100644
--- a/tests/qapi-schema/test-qapi.py
+++ b/tests/qapi-schema/test-qapi.py
@@ -10,6 +10,7 @@
 # See the COPYING file in the top-level directory.
 #
 
+from __future__ import print_function
 from qapi import *
 from pprint import pprint
 import os
@@ -18,51 +19,51 @@ import sys
 
 class QAPISchemaTestVisitor(QAPISchemaVisitor):
     def visit_enum_type(self, name, info, values, prefix):
-        print 'enum %s %s' % (name, values)
+        print('enum %s %s' % (name, values))
         if prefix:
-            print '    prefix %s' % prefix
+            print('    prefix %s' % prefix)
 
     def visit_object_type(self, name, info, base, members, variants):
-        print 'object %s' % name
+        print('object %s' % name)
         if base:
-            print '    base %s' % base.name
+            print('    base %s' % base.name)
         for m in members:
-            print '    member %s: %s optional=%s' % \
-                (m.name, m.type.name, m.optional)
+            print('    member %s: %s optional=%s' % \
+                (m.name, m.type.name, m.optional))
         self._print_variants(variants)
 
     def visit_alternate_type(self, name, info, variants):
-        print 'alternate %s' % name
+        print('alternate %s' % name)
         self._print_variants(variants)
 
     def visit_command(self, name, info, arg_type, ret_type,
                       gen, success_response, boxed):
-        print 'command %s %s -> %s' % \
+        print('command %s %s -> %s' % \)
             (name, arg_type and arg_type.name, ret_type and ret_type.name)
-        print '   gen=%s success_response=%s boxed=%s' % \
+        print('   gen=%s success_response=%s boxed=%s' % \)
             (gen, success_response, boxed)
 
     def visit_event(self, name, info, arg_type, boxed):
-        print 'event %s %s' % (name, arg_type and arg_type.name)
-        print '   boxed=%s' % boxed
+        print('event %s %s' % (name, arg_type and arg_type.name))
+        print('   boxed=%s' % boxed)
 
     @staticmethod
     def _print_variants(variants):
         if variants:
-            print '    tag %s' % variants.tag_member.name
+            print('    tag %s' % variants.tag_member.name)
             for v in variants.variants:
-                print '    case %s: %s' % (v.name, v.type.name)
+                print('    case %s: %s' % (v.name, v.type.name))
 
 schema = QAPISchema(sys.argv[1])
 schema.visit(QAPISchemaTestVisitor())
 
 for doc in schema.docs:
     if doc.symbol:
-        print 'doc symbol=%s' % doc.symbol
+        print('doc symbol=%s' % doc.symbol)
     else:
-        print 'doc freeform'
-    print '    body=\n%s' % doc.body
+        print('doc freeform')
+    print('    body=\n%s' % doc.body)
     for arg, section in doc.args.iteritems():
-        print '    arg=%s\n%s' % (arg, section)
+        print('    arg=%s\n%s' % (arg, section))
     for section in doc.sections:
-        print '    section=%s\n%s' % (section.name, section)
+        print('    section=%s\n%s' % (section.name, section))
++++++ 0035-qapi-Use-OrderedDict-from-standard-.patch ++++++
>From 020f50663afabc52c305a3956def8c94af7b5531 Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <[email protected]>
Date: Mon, 15 Jan 2018 17:39:47 -0700
Subject: [PATCH] qapi: Use OrderedDict from standard library if available
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The OrderedDict class appeared in the 'collections' module
from python 2.7 onwards, so use that in preference to our
local backport if available.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
---
 scripts/qapi.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/qapi.py b/scripts/qapi.py
index d5ac21ad35..dba6cd6779 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -18,7 +18,10 @@ import os
 import re
 import string
 import sys
-from ordereddict import OrderedDict
+try:
+    from collections import OrderedDict
+except:
+    from ordereddict import OrderedDict
 
 builtin_types = {
     'null':     'QTYPE_QNULL',
++++++ 0036-qapi-adapt-to-moved-location-of-Str.patch ++++++
>From 63783441945c3c156bb6acfaac0ace8055c74c52 Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <[email protected]>
Date: Mon, 15 Jan 2018 17:40:05 -0700
Subject: [PATCH] qapi: adapt to moved location of StringIO module in py3
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
---
 scripts/qapi.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/qapi.py b/scripts/qapi.py
index dba6cd6779..7882ae77fb 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -22,6 +22,10 @@ try:
     from collections import OrderedDict
 except:
     from ordereddict import OrderedDict
+try:
+    from StringIO import StringIO
+except ImportError:
+    from io import StringIO
 
 builtin_types = {
     'null':     'QTYPE_QNULL',
@@ -2004,8 +2008,7 @@ def open_output(output_dir, do_c, do_h, prefix, c_file, 
h_file,
         if really:
             return open(name, opt)
         else:
-            import StringIO
-            return StringIO.StringIO()
+            return StringIO()
 
     fdef = maybe_open(do_c, c_file, 'w')
     fdecl = maybe_open(do_h, h_file, 'w')
++++++ 0037-qapi-Adapt-to-moved-location-of-mak.patch ++++++
>From 9bf5e7d570de8a98434e3c51d8e60fe6fab02f5c Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <[email protected]>
Date: Mon, 15 Jan 2018 17:40:16 -0700
Subject: [PATCH] qapi: Adapt to moved location of 'maketrans' function in py3

Signed-off-by: Daniel P. Berrange <[email protected]>
---
 scripts/qapi.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/qapi.py b/scripts/qapi.py
index 7882ae77fb..88e854edec 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1743,7 +1743,10 @@ def c_enum_const(type_name, const_name, prefix=None):
         type_name = prefix
     return camel_to_upper(type_name) + '_' + c_name(const_name, False).upper()
 
-c_name_trans = string.maketrans('.-', '__')
+if hasattr(str, 'maketrans'):
+    c_name_trans = str.maketrans('.-', '__')
+else:
+    c_name_trans = string.maketrans('.-', '__')
 
 
 # Map @name to a valid C identifier.
++++++ 0038-qapi-remove-q-arg-to-diff-when-comp.patch ++++++
>From 0f22752bba33bdffc996ce119d6ec20faad20637 Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <[email protected]>
Date: Mon, 15 Jan 2018 17:40:25 -0700
Subject: [PATCH] qapi: remove '-q' arg to diff when comparing QAPI output

When the qapi schema tests fail they merely print that the expected
output didn't match the actual output. This is largely useless when
trying diagnose what went wrong. Removing the '-q' arg to diff
means that it is still silent on successful tests, but when it
fails we'll see details of the incorrect output.

Signed-off-by: Daniel P. Berrange <[email protected]>
---
 tests/Makefile.include | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 199b7bbddd..f4a05a82c1 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -909,10 +909,10 @@ $(patsubst %, check-%, $(check-qapi-schema-y)): 
check-%.json: $(SRC_PATH)/%.json
                $^ >$*.test.out 2>$*.test.err; \
                echo $$? >$*.test.exit, \
                "TEST","$*.out")
-       @diff -q $(SRC_PATH)/$*.out $*.test.out
+       @diff $(SRC_PATH)/$*.out $*.test.out
        @# Sanitize error messages (make them independent of build directory)
-       @perl -p -e 's|\Q$(SRC_PATH)\E/||g' $*.test.err | diff -q 
$(SRC_PATH)/$*.err -
-       @diff -q $(SRC_PATH)/$*.exit $*.test.exit
+       @perl -p -e 's|\Q$(SRC_PATH)\E/||g' $*.test.err | diff 
$(SRC_PATH)/$*.err -
+       @diff $(SRC_PATH)/$*.exit $*.test.exit
 
 .PHONY: check-tests/qapi-schema/doc-good.texi
 check-tests/qapi-schema/doc-good.texi: tests/qapi-schema/doc-good.test.texi
++++++ 0039-qapi-ensure-stable-sort-ordering-wh.patch ++++++
>From 24a63e2bd19a5294ed9a8793663e8f62e5e0029a Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <[email protected]>
Date: Mon, 15 Jan 2018 17:40:33 -0700
Subject: [PATCH] qapi: ensure stable sort ordering when checking QAPI entities
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Some early python 3.x versions will have different default
ordering when calling the 'values()' method on a dict, compared
to python 2.x and later 3.x versions. Explicitly sort the items
to get a stable ordering.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
---
 scripts/qapi.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/qapi.py b/scripts/qapi.py
index 88e854edec..94d52f7eb5 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1687,7 +1687,7 @@ class QAPISchema(object):
                 assert False
 
     def check(self):
-        for ent in self._entity_dict.values():
+        for (name, ent) in sorted(self._entity_dict.items()):
             ent.check(self)
 
     def visit(self, visitor):
++++++ 0040-qapi-force-a-UTF-8-locale-for-runni.patch ++++++
>From f9d26c21e4bdf6c82e1b9346fa9c416c71b827e5 Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <[email protected]>
Date: Mon, 15 Jan 2018 17:40:41 -0700
Subject: [PATCH] qapi: force a UTF-8 locale for running Python

Python2 did not validate locale correctness when reading input data, so
would happily read UTF-8 data in non-UTF-8 locales. Python3 is strict so
if you try to read UTF-8 data in the C locale, it will raise an error
for any UTF-8 bytes that aren't representable in 7-bit ascii encoding.
e.g.

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 54: 
ordinal not in range(128)
Traceback (most recent call last):
  File "/tmp/qemu-test/src/scripts/qapi-commands.py", line 317, in <module>
    schema = QAPISchema(input_file)
  File "/tmp/qemu-test/src/scripts/qapi.py", line 1468, in __init__
    parser = QAPISchemaParser(open(fname, 'r'))
  File "/tmp/qemu-test/src/scripts/qapi.py", line 301, in __init__
    previously_included)
  File "/tmp/qemu-test/src/scripts/qapi.py", line 348, in _include
    exprs_include = QAPISchemaParser(fobj, previously_included, info)
  File "/tmp/qemu-test/src/scripts/qapi.py", line 271, in __init__
    self.src = fp.read()
  File "/usr/lib64/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]

Many distros support a new C.UTF-8 locale that is like the C locale,
but with UTF-8 instead of 7-bit ASCII. That is not entirely portable
though, so this patch instead forces the en_US.UTF-8 locale, which
is pretty similar but more widely available.

We set LANG, rather than only LC_CTYPE, since generated source ought
to be independant of all of the user's locale settings.

This patch only forces UTF-8 for QAPI scripts, since that is the one
showing the immediate error under Python3 with C locale, but potentially
we ought to force this for all python scripts used in the build process.

Signed-off-by: Daniel P. Berrange <[email protected]>
---
 Makefile | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 4be3366e27..8b6dee004e 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,8 @@ ifneq ($(wildcard config-host.mak),)
 all:
 include config-host.mak
 
+PYTHON_UTF8 = LANG=en_US.UTF-8 $(PYTHON)
+
 git-submodule-update:
 
 .PHONY: git-submodule-update
@@ -467,17 +469,17 @@ qapi-py = $(SRC_PATH)/scripts/qapi.py 
$(SRC_PATH)/scripts/ordereddict.py
 
 qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
 $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
-       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
+       $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-types.py \
                $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
                "GEN","$@")
 qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
 $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
-       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
+       $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-visit.py \
                $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
                "GEN","$@")
 qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
 $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py 
$(qapi-py)
-       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
+       $(call quiet-command,$(PYTHON_UTF8) 
$(SRC_PATH)/scripts/qapi-commands.py \
                $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
                "GEN","$@")
 
@@ -498,27 +500,27 @@ qapi-modules = $(SRC_PATH)/qapi-schema.json 
$(SRC_PATH)/qapi/common.json \
 
 qapi-types.c qapi-types.h :\
 $(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
-       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
+       $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-types.py \
                $(gen-out-type) -o "." -b $<, \
                "GEN","$@")
 qapi-visit.c qapi-visit.h :\
 $(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
-       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
+       $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-visit.py \
                $(gen-out-type) -o "." -b $<, \
                "GEN","$@")
 qapi-event.c qapi-event.h :\
 $(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
-       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \
+       $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-event.py \
                $(gen-out-type) -o "." $<, \
                "GEN","$@")
 qmp-commands.h qmp-marshal.c :\
 $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
-       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
+       $(call quiet-command,$(PYTHON_UTF8) 
$(SRC_PATH)/scripts/qapi-commands.py \
                $(gen-out-type) -o "." $<, \
                "GEN","$@")
 qmp-introspect.h qmp-introspect.c :\
 $(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
-       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \
+       $(call quiet-command,$(PYTHON_UTF8) 
$(SRC_PATH)/scripts/qapi-introspect.py \
                $(gen-out-type) -o "." $<, \
                "GEN","$@")
 
@@ -788,10 +790,10 @@ qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx 
$(SRC_PATH)/scripts/hxtool
 docs/interop/qemu-qmp-qapi.texi docs/interop/qemu-ga-qapi.texi: 
$(SRC_PATH)/scripts/qapi2texi.py $(qapi-py)
 
 docs/interop/qemu-qmp-qapi.texi: $(qapi-modules)
-       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > 
$@,"GEN","$@")
+       $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi2texi.py $< 
> $@,"GEN","$@")
 
 docs/interop/qemu-ga-qapi.texi: $(SRC_PATH)/qga/qapi-schema.json
-       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > 
$@,"GEN","$@")
+       $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi2texi.py $< 
> $@,"GEN","$@")
 
 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi 
qemu-monitor-info.texi
 qemu.1: qemu-option-trace.texi
++++++ 0041-scripts-ensure-signrom-treats-data-.patch ++++++
>From e7be302421da46c1282c6ff592c87a5268e7f05a Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <[email protected]>
Date: Mon, 15 Jan 2018 17:40:47 -0700
Subject: [PATCH] scripts: ensure signrom treats data as bytes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
---
 scripts/signrom.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/signrom.py b/scripts/signrom.py
index d1dabe0240..0497a1c32e 100644
--- a/scripts/signrom.py
+++ b/scripts/signrom.py
@@ -18,7 +18,7 @@ fin = open(sys.argv[1], 'rb')
 fout = open(sys.argv[2], 'wb')
 
 magic = fin.read(2)
-if magic != '\x55\xaa':
+if magic != b'\x55\xaa':
     sys.exit("%s: option ROM does not begin with magic 55 aa" % sys.argv[1])
 
 size_byte = ord(fin.read(1))
@@ -33,7 +33,7 @@ elif len(data) < size:
     # Add padding if necessary, rounding the whole input to a multiple of
     # 512 bytes according to the third byte of the input.
     # size-1 because a final byte is added below to store the checksum.
-    data = data.ljust(size-1, '\0')
+    data = data.ljust(size-1, b'\0')
 else:
     if ord(data[-1:]) != 0:
         sys.stderr.write('WARNING: ROM includes nonzero checksum\n')
++++++ 0042-configure-allow-use-of-python-3.patch ++++++
>From b4a1eeb9e139d9e20a19b4c2aea3d69bef7a8fec Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <[email protected]>
Date: Mon, 15 Jan 2018 17:40:53 -0700
Subject: [PATCH] configure: allow use of python 3

Signed-off-by: Daniel P. Berrange <[email protected]>
---
 configure | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 01e1d15fa4..46e2853ee3 100755
--- a/configure
+++ b/configure
@@ -1573,9 +1573,8 @@ fi
 
 # Note that if the Python conditional here evaluates True we will exit
 # with status 1 which is a shell 'false' value.
-if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or 
sys.version_info >= (3,))'; then
-  error_exit "Cannot use '$python', Python 2.6 or later is required." \
-      "Note that Python 3 or later is not yet supported." \
+if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6))'; then
+  error_exit "Cannot use '$python', Python 2 >= 2.6 or Python 3 is required." \
       "Use --python=/path/to/python to specify a supported Python."
 fi
 
++++++ 0043-input-add-missing-JIS-keys-to-virti.patch ++++++
>From 3279607f70ff31e79924ff86c82fdca1da49c28e Mon Sep 17 00:00:00 2001
From: Miika S <[email protected]>
Date: Tue, 16 Jan 2018 13:46:04 -0700
Subject: [PATCH] input: add missing JIS keys to virtio input

keycodemapdb updated to add the QKeyCodes muhenkan and katakanahiragana

Signed-off-by: Miika S <[email protected]>
---
 hw/input/virtio-input-hid.c | 7 +++++++
 qapi/ui.json                | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c
index e78faec0b1..9628d289f9 100644
--- a/hw/input/virtio-input-hid.c
+++ b/hw/input/virtio-input-hid.c
@@ -139,6 +139,13 @@ static const unsigned int keymap_qcode[Q_KEY_CODE__MAX] = {
     [Q_KEY_CODE_META_L]              = KEY_LEFTMETA,
     [Q_KEY_CODE_META_R]              = KEY_RIGHTMETA,
     [Q_KEY_CODE_MENU]                = KEY_MENU,
+
+    [Q_KEY_CODE_MUHENKAN]            = KEY_MUHENKAN,
+    [Q_KEY_CODE_HENKAN]              = KEY_HENKAN,
+    [Q_KEY_CODE_KATAKANAHIRAGANA]    = KEY_KATAKANAHIRAGANA,
+    [Q_KEY_CODE_COMPOSE]             = KEY_COMPOSE,
+    [Q_KEY_CODE_RO]                  = KEY_RO,
+    [Q_KEY_CODE_YEN]                 = KEY_YEN,
 };
 
 static const unsigned int keymap_button[INPUT_BUTTON__MAX] = {
diff --git a/qapi/ui.json b/qapi/ui.json
index 07b468f625..d6679aa8f5 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -748,6 +748,9 @@
 # @ac_bookmarks: since 2.10
 # altgr, altgr_r: dropped in 2.10
 #
+# @muhenkan: since 2.12
+# @katakanahiragana: since 2.12
+#
 # 'sysrq' was mistakenly added to hack around the fact that
 # the ps2 driver was not generating correct scancodes sequences
 # when 'alt+print' was pressed. This flaw is now fixed and the
@@ -775,7 +778,7 @@
             'left', 'up', 'down', 'right', 'insert', 'delete', 'stop', 'again',
             'props', 'undo', 'front', 'copy', 'open', 'paste', 'find', 'cut',
             'lf', 'help', 'meta_l', 'meta_r', 'compose', 'pause',
-            'ro', 'hiragana', 'henkan', 'yen',
+            'ro', 'hiragana', 'henkan', 'yen', 'muhenkan', 'katakanahiragana',
             'kp_comma', 'kp_equals', 'power', 'sleep', 'wake',
             'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute',
             'volumeup', 'volumedown', 'mediaselect',
++++++ 0044-Make-installed-scripts-explicitly-p.patch ++++++
>From b55eb09255a4ad8e0053d9cb7c393162d7fc3bae Mon Sep 17 00:00:00 2001
From: Bruce Rogers <[email protected]>
Date: Thu, 25 Jan 2018 14:16:10 -0700
Subject: [PATCH] Make installed scripts explicitly python2

Signed-off-by: Bruce Rogers <[email protected]>
---
 scripts/analyze-migration.py      | 2 +-
 scripts/vmstate-static-checker.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
index 14553876a2..a512ddc552 100755
--- a/scripts/analyze-migration.py
+++ b/scripts/analyze-migration.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
 #
 #  Migration Stream Analyzer
 #
diff --git a/scripts/vmstate-static-checker.py 
b/scripts/vmstate-static-checker.py
index bcef7ee28e..45ae2df2cf 100755
--- a/scripts/vmstate-static-checker.py
+++ b/scripts/vmstate-static-checker.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 #
 # Compares vmstate information stored in JSON format, obtained from
 # the -dump-vmstate QEMU command.
++++++ Make-installed-scripts-explicitly-python3.patch ++++++
>From f633201a0f40958641f5ff3352b637bd2fa16922 Mon Sep 17 00:00:00 2001
From: Bruce Rogers <[email protected]>
Date: Thu, 25 Jan 2018 14:26:04 -0700
Subject: [PATCH] Make installed scripts explicitly python3

Signed-off-by: Bruce Rogers <[email protected]>
---
 scripts/analyze-migration.py      | 18 ++++----
 scripts/vmstate-static-checker.py | 94 +++++++++++++++++++--------------------
 2 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
index a512ddc552..d2e4cb9f8a 100755
--- a/scripts/analyze-migration.py
+++ b/scripts/analyze-migration.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
 #
 #  Migration Stream Analyzer
 #
@@ -162,7 +162,7 @@ class RamSection(object):
                     len = self.file.read64()
                     self.sizeinfo[self.name] = '0x%016x' % len
                     if self.write_memory:
-                        print self.name
+                        print(self.name)
                         mkdir_p('./' + os.path.dirname(self.name))
                         f = open('./' + self.name, "wb")
                         f.truncate(0)
@@ -359,7 +359,7 @@ class VMSDFieldStruct(VMSDFieldGeneric):
             array_len = field.pop('array_len')
             field['index'] = 0
             new_fields.append(field)
-            for i in xrange(1, array_len):
+            for i in range(1, array_len):
                 c = field.copy()
                 c['index'] = i
                 new_fields.append(c)
@@ -426,7 +426,7 @@ class VMSDFieldStruct(VMSDFieldGeneric):
 
     def getDictOrderedDict(self, dict):
         r = collections.OrderedDict()
-        for (key, value) in dict.items():
+        for (key, value) in list(dict.items()):
             r[key] = self.getDictItem(value)
         return r
 
@@ -558,7 +558,7 @@ class MigrationDump(object):
 
     def getDict(self):
         r = collections.OrderedDict()
-        for (key, value) in self.sections.items():
+        for (key, value) in list(self.sections.items()):
            key = "%s (%d)" % ( value.section_key[0], key )
            r[key] = value.getDict()
         return r
@@ -584,7 +584,7 @@ if args.extract:
     dump = MigrationDump(args.file)
 
     dump.read(desc_only = True)
-    print "desc.json"
+    print("desc.json")
     f = open("desc.json", "wb")
     f.truncate()
     f.write(jsonenc.encode(dump.vmsd_desc))
@@ -592,7 +592,7 @@ if args.extract:
 
     dump.read(write_memory = True)
     dict = dump.getDict()
-    print "state.json"
+    print("state.json")
     f = open("state.json", "wb")
     f.truncate()
     f.write(jsonenc.encode(dict))
@@ -601,10 +601,10 @@ elif args.dump == "state":
     dump = MigrationDump(args.file)
     dump.read(dump_memory = args.memory)
     dict = dump.getDict()
-    print jsonenc.encode(dict)
+    print(jsonenc.encode(dict))
 elif args.dump == "desc":
     dump = MigrationDump(args.file)
     dump.read(desc_only = True)
-    print jsonenc.encode(dump.vmsd_desc)
+    print(jsonenc.encode(dump.vmsd_desc))
 else:
     raise Exception("Please specify either -x, -d state or -d dump")
diff --git a/scripts/vmstate-static-checker.py 
b/scripts/vmstate-static-checker.py
index 45ae2df2cf..3bfcbd3d4a 100755
--- a/scripts/vmstate-static-checker.py
+++ b/scripts/vmstate-static-checker.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
 #
 # Compares vmstate information stored in JSON format, obtained from
 # the -dump-vmstate QEMU command.
@@ -157,7 +157,7 @@ def check_fields(src_fields, dest_fields, desc, sec):
     while True:
         if advance_src:
             try:
-                s_item = s_iter.next()
+                s_item = next(s_iter)
             except StopIteration:
                 if s_iter_list == []:
                     break
@@ -172,14 +172,14 @@ def check_fields(src_fields, dest_fields, desc, sec):
 
         if advance_dest:
             try:
-                d_item = d_iter.next()
+                d_item = next(d_iter)
             except StopIteration:
                 if d_iter_list == []:
                     # We were not in a substruct
-                    print "Section \"" + sec + "\",",
-                    print "Description " + "\"" + desc + "\":",
-                    print "expected field \"" + s_item["field"] + "\",",
-                    print "while dest has no further fields"
+                    print("Section \"" + sec + "\",", end=' ')
+                    print("Description " + "\"" + desc + "\":", end=' ')
+                    print("expected field \"" + s_item["field"] + "\",", end=' 
')
+                    print("while dest has no further fields")
                     bump_taint()
                     break
 
@@ -197,10 +197,10 @@ def check_fields(src_fields, dest_fields, desc, sec):
                     advance_dest = True
                     continue
                 if unused_count < 0:
-                    print "Section \"" + sec + "\",",
-                    print "Description \"" + desc + "\":",
-                    print "unused size mismatch near \"",
-                    print s_item["field"] + "\""
+                    print("Section \"" + sec + "\",", end=' ')
+                    print("Description \"" + desc + "\":", end=' ')
+                    print("unused size mismatch near \"", end=' ')
+                    print(s_item["field"] + "\"")
                     bump_taint()
                     break
                 continue
@@ -211,10 +211,10 @@ def check_fields(src_fields, dest_fields, desc, sec):
                     advance_src = True
                     continue
                 if unused_count < 0:
-                    print "Section \"" + sec + "\",",
-                    print "Description \"" + desc + "\":",
-                    print "unused size mismatch near \"",
-                    print d_item["field"] + "\""
+                    print("Section \"" + sec + "\",", end=' ')
+                    print("Description \"" + desc + "\":", end=' ')
+                    print("unused size mismatch near \"", end=' ')
+                    print(d_item["field"] + "\"")
                     bump_taint()
                     break
                 continue
@@ -262,10 +262,10 @@ def check_fields(src_fields, dest_fields, desc, sec):
                     unused_count = s_item["size"] - d_item["size"]
                     continue
 
-            print "Section \"" + sec + "\",",
-            print "Description \"" + desc + "\":",
-            print "expected field \"" + s_item["field"] + "\",",
-            print "got \"" + d_item["field"] + "\"; skipping rest"
+            print("Section \"" + sec + "\",", end=' ')
+            print("Description \"" + desc + "\":", end=' ')
+            print("expected field \"" + s_item["field"] + "\",", end=' ')
+            print("got \"" + d_item["field"] + "\"; skipping rest")
             bump_taint()
             break
 
@@ -289,8 +289,8 @@ def check_subsections(src_sub, dest_sub, desc, sec):
             check_descriptions(s_item, d_item, sec)
 
         if not found:
-            print "Section \"" + sec + "\", Description \"" + desc + "\":",
-            print "Subsection \"" + s_item["name"] + "\" not found"
+            print("Section \"" + sec + "\", Description \"" + desc + "\":", 
end=' ')
+            print("Subsection \"" + s_item["name"] + "\" not found")
             bump_taint()
 
 
@@ -299,8 +299,8 @@ def check_description_in_list(s_item, d_item, sec, desc):
         return
 
     if not "Description" in d_item:
-        print "Section \"" + sec + "\", Description \"" + desc + "\",",
-        print "Field \"" + s_item["field"] + "\": missing description"
+        print("Section \"" + sec + "\", Description \"" + desc + "\",", end=' 
')
+        print("Field \"" + s_item["field"] + "\": missing description")
         bump_taint()
         return
 
@@ -311,17 +311,17 @@ def check_descriptions(src_desc, dest_desc, sec):
     check_version(src_desc, dest_desc, sec, src_desc["name"])
 
     if not check_fields_match(sec, src_desc["name"], dest_desc["name"]):
-        print "Section \"" + sec + "\":",
-        print "Description \"" + src_desc["name"] + "\"",
-        print "missing, got \"" + dest_desc["name"] + "\" instead; skipping"
+        print("Section \"" + sec + "\":", end=' ')
+        print("Description \"" + src_desc["name"] + "\"", end=' ')
+        print("missing, got \"" + dest_desc["name"] + "\" instead; skipping")
         bump_taint()
         return
 
     for f in src_desc:
         if not f in dest_desc:
-            print "Section \"" + sec + "\"",
-            print "Description \"" + src_desc["name"] + "\":",
-            print "Entry \"" + f + "\" missing"
+            print("Section \"" + sec + "\"", end=' ')
+            print("Description \"" + src_desc["name"] + "\":", end=' ')
+            print("Entry \"" + f + "\" missing")
             bump_taint()
             continue
 
@@ -334,39 +334,39 @@ def check_descriptions(src_desc, dest_desc, sec):
 
 def check_version(s, d, sec, desc=None):
     if s["version_id"] > d["version_id"]:
-        print "Section \"" + sec + "\"",
+        print("Section \"" + sec + "\"", end=' ')
         if desc:
-            print "Description \"" + desc + "\":",
-        print "version error:", s["version_id"], ">", d["version_id"]
+            print("Description \"" + desc + "\":", end=' ')
+        print("version error:", s["version_id"], ">", d["version_id"])
         bump_taint()
 
     if not "minimum_version_id" in d:
         return
 
     if s["version_id"] < d["minimum_version_id"]:
-        print "Section \"" + sec + "\"",
+        print("Section \"" + sec + "\"", end=' ')
         if desc:
-            print "Description \"" + desc + "\":",
-            print "minimum version error:", s["version_id"], "<",
-            print d["minimum_version_id"]
+            print("Description \"" + desc + "\":", end=' ')
+            print("minimum version error:", s["version_id"], "<", end=' ')
+            print(d["minimum_version_id"])
             bump_taint()
 
 
 def check_size(s, d, sec, desc=None, field=None):
     if s["size"] != d["size"]:
-        print "Section \"" + sec + "\"",
+        print("Section \"" + sec + "\"", end=' ')
         if desc:
-            print "Description \"" + desc + "\"",
+            print("Description \"" + desc + "\"", end=' ')
         if field:
-            print "Field \"" + field + "\"",
-        print "size mismatch:", s["size"], ",", d["size"]
+            print("Field \"" + field + "\"", end=' ')
+        print("size mismatch:", s["size"], ",", d["size"])
         bump_taint()
 
 
 def check_machine_type(s, d):
     if s["Name"] != d["Name"]:
-        print "Warning: checking incompatible machine types:",
-        print "\"" + s["Name"] + "\", \"" + d["Name"] + "\""
+        print("Warning: checking incompatible machine types:", end=' ')
+        print("\"" + s["Name"] + "\", \"" + d["Name"] + "\"")
     return
 
 
@@ -374,9 +374,9 @@ def main():
     help_text = "Parse JSON-formatted vmstate dumps from QEMU in files SRC and 
DEST.  Checks whether migration from SRC to DEST QEMU versions would break 
based on the VMSTATE information contained within the JSON outputs.  The JSON 
output is created from a QEMU invocation with the -dump-vmstate parameter and a 
filename argument to it.  Other parameters to QEMU do not matter, except the -M 
(machine type) parameter."
 
     parser = argparse.ArgumentParser(description=help_text)
-    parser.add_argument('-s', '--src', type=file, required=True,
+    parser.add_argument('-s', '--src', type=open, required=True,
                         help='json dump from src qemu')
-    parser.add_argument('-d', '--dest', type=file, required=True,
+    parser.add_argument('-d', '--dest', type=open, required=True,
                         help='json dump from dest qemu')
     parser.add_argument('--reverse', required=False, default=False,
                         action='store_true',
@@ -400,7 +400,7 @@ def main():
             # doesn't exist in dest.
             dest_sec = get_changed_sec_name(sec)
             if not dest_sec in dest_data:
-                print "Section \"" + sec + "\" does not exist in dest"
+                print("Section \"" + sec + "\" does not exist in dest")
                 bump_taint()
                 continue
 
@@ -415,8 +415,8 @@ def main():
 
         for entry in s:
             if not entry in d:
-                print "Section \"" + sec + "\": Entry \"" + entry + "\"",
-                print "missing"
+                print("Section \"" + sec + "\": Entry \"" + entry + "\"", 
end=' ')
+                print("missing")
                 bump_taint()
                 continue
 
-- 
2.16.1

++++++ ksm.service ++++++
--- /var/tmp/diff_new_pack.lEh6vd/_old  2018-01-28 00:39:07.862341418 +0100
+++ /var/tmp/diff_new_pack.lEh6vd/_new  2018-01-28 00:39:07.862341418 +0100
@@ -6,8 +6,8 @@
 [Service]
 Type=oneshot
 RemainAfterExit=yes
-ExecStart=/bin/bash -c "echo 1 > /sys/kernel/mm/ksm/run"
-ExecStop=/bin/bash -c "echo 0 > /sys/kernel/mm/ksm/run"
+ExecStart=/bin/echo 1 > /sys/kernel/mm/ksm/run
+ExecStop=/bin/echo 0 > /sys/kernel/mm/ksm/run
 
 [Install]
 WantedBy=multi-user.target




++++++ qemu-linux-user.spec.in ++++++
--- /var/tmp/diff_new_pack.lEh6vd/_old  2018-01-28 00:39:07.974336201 +0100
+++ /var/tmp/diff_new_pack.lEh6vd/_new  2018-01-28 00:39:07.974336201 +0100
@@ -65,6 +65,11 @@
        --libdir=%_libdir \
        --libexecdir=%_libexecdir \
        --localstatedir=%_localstatedir \
+%if 0%{?suse_version} > 1320
+        --python=%_bindir/python3 \
+%else
+        --python=%_bindir/python \
+%endif
        --extra-cflags="%{optflags}" \
        --disable-stack-protector \
        --disable-strip \

++++++ qemu.spec.in ++++++
--- /var/tmp/diff_new_pack.lEh6vd/_old  2018-01-28 00:39:08.042333033 +0100
+++ /var/tmp/diff_new_pack.lEh6vd/_new  2018-01-28 00:39:08.046332847 +0100
@@ -134,23 +134,34 @@
 # Please do not add QEMU patches manually here.
 # Run update_git.sh to regenerate this queue.
 
-# SeaBIOS / SeaVGABIOS (Currently no patches)
+# If for any reason we have base QEMU patches which are conditionally applied,
+# include them here
+Patch1000:      Make-installed-scripts-explicitly-python3.patch
+
+# SeaBIOS / SeaVGABIOS
+Patch1100:      seabios-use-python2-explicitly-as-needed.patch
+Patch1101:      seabios-switch-to-python3-as-needed.patch
+
 
 # ipxe
 # PATCH-FIX-OPENSUSE ipxe-stable-buildid.patch [email protected] -- 
reproducible builds
-Patch1100:      ipxe-stable-buildid.patch
-Patch1101:      ipxe-use-gcc6-for-more-compact-code.patch
+Patch1200:      ipxe-stable-buildid.patch
+Patch1201:      ipxe-use-gcc6-for-more-compact-code.patch
 
 # sgabios
 # PATCH-FIX-OPENSUSE sgabios-stable-buildid.patch [email protected] -- 
reproducible builds
-Patch1200:      sgabios-stable-buildid.patch
+Patch1300:      sgabios-stable-buildid.patch
 
 # SLOF (Currently no patches)
 
 # skiboot
-Patch1400:      skiboot-GCC7-fixes-for-Wimplicit-fallthr.patch
-Patch1401:      skiboot-libc-stdio-vsnprintf.c-add-expli.patch
-Patch1402:      skiboot-build-LDFLAGS-pass-pie-flag-explicitly-to-ld.patch
+Patch1500:      skiboot-GCC7-fixes-for-Wimplicit-fallthr.patch
+Patch1501:      skiboot-libc-stdio-vsnprintf.c-add-expli.patch
+Patch1502:      skiboot-build-LDFLAGS-pass-pie-flag-explicitly-to-ld.patch
+
+# ui/keycodemapdb
+Patch1600:      ui-keycodemapdb-Add-missing-QKeyCode-val.patch
+Patch1601:      ui-keycodemapdb-Fix-compat-with-py3-dict.patch
 
 # this is to make lint happy
 Source300:      qemu-rpmlintrc
@@ -265,7 +276,11 @@
 %endif
 BuildRequires:  pkgconfig
 BuildRequires:  pwdutils
-BuildRequires:  python
+%if 0%{?suse_version} > 1320
+BuildRequires:  python3-base
+%else
+BuildRequires:  python-base
+%endif
 %if 0%{?suse_version} >= 1315
 BuildRequires:  rdma-core-devel
 %endif
@@ -699,6 +714,8 @@
 %package ksm
 Summary:        Kernel Samepage Merging services
 Group:          System/Emulators/PC
+Requires(pre):  coreutils
+Requires(post): coreutils
 
 %description ksm
 Kernel Samepage Merging (KSM) is a memory-saving de-duplication feature, that
@@ -713,24 +730,40 @@
 %setup -q -n qemu-2.11.0
 PATCH_EXEC
 
-pushd roms/ipxe
+%if 0%{?suse_version} > 1320
+%patch1000 -p1
+%endif
+
+pushd roms/seabios
 %patch1100 -p1
-%if 0%{?suse_version} <= 1320
+%if 0%{?suse_version} > 1320
 %patch1101 -p1
 %endif
 popd
 
-pushd roms/sgabios
+pushd roms/ipxe
 %patch1200 -p1
+%if 0%{?suse_version} <= 1320
+%patch1201 -p1
+%endif
+popd
+
+pushd roms/sgabios
+%patch1300 -p1
 popd
 
 pushd roms/SLOF
 popd
 
 pushd roms/skiboot
-%patch1400 -p1
-%patch1401 -p1
-%patch1402 -p1
+%patch1500 -p1
+%patch1501 -p1
+%patch1502 -p1
+popd
+
+pushd ui/keycodemapdb
+%patch1600 -p1
+%patch1601 -p1
 popd
 
 # as a safeguard, delete the firmware files that we intend to build
@@ -749,6 +782,11 @@
        --localstatedir=%_localstatedir \
        --docdir=%_docdir/%name \
        --firmwarepath=%_datadir/%name \
+%if 0%{?suse_version} > 1320
+        --python=%_bindir/python3 \
+%else
+        --python=%_bindir/python2 \
+%endif
        --extra-cflags="%{optflags}" \
        --disable-stack-protector \
        --disable-strip \

++++++ seabios-switch-to-python3-as-needed.patch ++++++
seabios: switch to python3 as needed

Switch to python3 the places where "python2" is explicitly referenced.
(Ignore the uses of #!/usr/bin/env python, since that usage does the
right thing in our build environment).
Include changes proposed by the python3 2to3 tool.

Signed-off-by: Bruce Rogers <[email protected]>
---
 Makefile                           |    2 +-
 scripts/acpi_extract.py            |    2 +-
 scripts/acpi_extract_preprocess.py |    2 +-
 scripts/acpi_extract.py            |    2 +-
 scripts/layoutrom.py               |   28 ++++++++++++++--------------
 scripts/vgafixup.py                |    2 +-
 6 files changed, 19 insertions(+), 19 deletions(-)

--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ LD=$(CROSS_PREFIX)ld
 OBJCOPY=$(CROSS_PREFIX)objcopy
 OBJDUMP=$(CROSS_PREFIX)objdump
 STRIP=$(CROSS_PREFIX)strip
-PYTHON=python2
+PYTHON=python3
 CPP=cpp
 IASL:=iasl
 LD32BIT_FLAG:=-melf_i386
--- a/scripts/acpi_extract.py
+++ b/scripts/acpi_extract.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
 # Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <[email protected]>
 #
 # This file may be distributed under the terms of the GNU GPLv3 license.
--- a/scripts/acpi_extract_preprocess.py
+++ b/scripts/acpi_extract_preprocess.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
 # Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <[email protected]>
 #
 # This file may be distributed under the terms of the GNU GPLv3 license.
--- a/scripts/acpi_extract.py
+++ b/scripts/acpi_extract.py
@@ -348,7 +348,7 @@ def main():
     # Pretty print output
     outstrs = ["/* DO NOT EDIT!  This is an autogenerated file."
                "  See scripts/acpi_extract.py. */"]
-    for array in output.keys():
+    for array in list(output.keys()):
         otype = get_value_type(max(output[array]))
         outstrs.append("static unsigned %s %s[] = {" % (otype, array))
         odata = []
--- a/scripts/layoutrom.py
+++ b/scripts/layoutrom.py
@@ -81,8 +81,8 @@ def fitSections(sections, fillsections):
             section.finalsegloc = addr
             fixedsections.append((addr, section))
             if section.align != 1:
-                print("Error: Fixed section %s has non-zero alignment (%d)" % (
-                    section.name, section.align))
+                print(("Error: Fixed section %s has non-zero alignment (%d)" % 
(
+                    section.name, section.align)))
                 sys.exit(1)
     fixedsections.sort(key=operator.itemgetter(0))
     firstfixed = fixedsections[0][0]
@@ -142,10 +142,10 @@ def fitSections(sections, fillsections):
     # Report stats
     total = BUILD_BIOS_SIZE-firstfixed
     slack = total - totalused
-    print ("Fixed space: 0x%x-0x%x  total: %d  slack: %d"
+    print(("Fixed space: 0x%x-0x%x  total: %d  slack: %d"
            "  Percent slack: %.1f%%" % (
             firstfixed, BUILD_BIOS_SIZE, total, slack,
-            (float(slack) / total) * 100.0))
+            (float(slack) / total) * 100.0)))
 
     return firstfixed + BUILD_BIOS_ADDR
 
@@ -288,12 +288,12 @@ def doLayout(sections, config, genreloc)
     size32flat = sec32fseg_start - sec32flat_start
     size32init = sec32flat_start - sec32init_start
     sizelow = li.sec32low_end - li.sec32low_start
-    print("16bit size:           %d" % size16)
-    print("32bit segmented size: %d" % size32seg)
-    print("32bit flat size:      %d" % (size32flat + size32textfseg))
-    print("32bit flat init size: %d" % size32init)
-    print("Lowmem size:          %d" % sizelow)
-    print("f-segment var size:   %d" % size32fseg)
+    print(("16bit size:           %d" % size16))
+    print(("32bit segmented size: %d" % size32seg))
+    print(("32bit flat size:      %d" % (size32flat + size32textfseg)))
+    print(("32bit flat init size: %d" % size32init))
+    print(("Lowmem size:          %d" % sizelow))
+    print(("f-segment var size:   %d" % size32fseg))
     return li
 
 
@@ -312,7 +312,7 @@ def outXRefs(sections, useseg=0, exports
                 and (symbol.section.fileid != section.fileid
                      or symbol.name != reloc.symbolname)):
                 xrefs[reloc.symbolname] = symbol
-    for symbolname, symbol in xrefs.items():
+    for symbolname, symbol in list(xrefs.items()):
         loc = symbol.section.finalloc
         if useseg:
             loc = symbol.section.finalsegloc
@@ -482,8 +482,8 @@ def checkRuntime(reloc, rsection, data,
     if section is None or '.init.' in section.name:
         return 0
     if '.data.varinit.' in section.name:
-        print("ERROR: %s is VARVERIFY32INIT but used from %s" % (
-            section.name, chain))
+        print(("ERROR: %s is VARVERIFY32INIT but used from %s" % (
+            section.name, chain)))
         sys.exit(1)
     return 1
 
@@ -691,7 +691,7 @@ def main():
     li = doLayout(sections, config, genreloc)
 
     # Exported symbols
-    li.varlowsyms = [symbol for symbol in symbols['32flat'].values()
+    li.varlowsyms = [symbol for symbol in list(symbols['32flat'].values())
                      if (symbol.section is not None
                          and symbol.section.finalloc is not None
                          and '.data.varlow.' in symbol.section.name
--- a/scripts/vgafixup.py
+++ b/scripts/vgafixup.py
@@ -29,7 +29,7 @@ re_leal = re.compile(
 def handle_leal(sline):
     m = re_leal.match(sline[5:])
     if m is None or m.group('index') == '%esp':
-        print("Unable to fixup leal instruction: %s" % (sline,))
+        print(("Unable to fixup leal instruction: %s" % (sline,)))
         sys.exit(-1)
     offset, base, index, scale, dest = m.group(
         'offset', 'base', 'index', 'scale', 'dest')
++++++ seabios-use-python2-explicitly-as-needed.patch ++++++
seabios: use python2 explicitly as needed

Switch to python2 the places where "python" is explicitly referenced.
(Ignore the uses of #!/usr/bin/env python, since that usage does the
right thing in our build environment).

Signed-off-by: Bruce Rogers <[email protected]>
---
 Makefile                           |    2 +-
 scripts/acpi_extract.py            |    2 +-
 scripts/acpi_extract_preprocess.py |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ LD=$(CROSS_PREFIX)ld
 OBJCOPY=$(CROSS_PREFIX)objcopy
 OBJDUMP=$(CROSS_PREFIX)objdump
 STRIP=$(CROSS_PREFIX)strip
-PYTHON=python
+PYTHON=python2
 CPP=cpp
 IASL:=iasl
 LD32BIT_FLAG:=-melf_i386
--- a/scripts/acpi_extract.py
+++ b/scripts/acpi_extract.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 # Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <[email protected]>
 #
 # This file may be distributed under the terms of the GNU GPLv3 license.
--- a/scripts/acpi_extract_preprocess.py
+++ b/scripts/acpi_extract_preprocess.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 # Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <[email protected]>
 #
 # This file may be distributed under the terms of the GNU GPLv3 license.
++++++ ui-keycodemapdb-Add-missing-QKeyCode-val.patch ++++++
>From 05dad417e9d0b37ee1fba33056d91a6b734b3357 Mon Sep 17 00:00:00 2001
From: Miika S <[email protected]>
Date: Mon, 18 Dec 2017 10:53:16 +0000
Subject: [PATCH] Add missing QKeyCode values for JIS keyboards

The AT set1 code for KEY_ISO is removed because it conflicts with
KEY_KATAKANAHIRAGANA.

Signed-off-by: Miika S <[email protected]>
Signed-off-by: Bruce Rogers <[email protected]>
---
 data/keymaps.csv | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/data/keymaps.csv b/data/keymaps.csv
index 0ef2ec1..bc2376c 100644
--- a/data/keymaps.csv
+++ b/data/keymaps.csv
@@ -154,9 +154,9 @@ 
KEY_KATAKANA,90,JIS_Kana,0x68,0x78,0x63,,146,VK_KANA,0x15,,,,,Lang3,KATA,,,
 KEY_HIRAGANA,91,,,0x77,0x62,0x87,147,,,,,,,Hiragana,HIRA,hiragana,,
 KEY_HIRAGANA,91,,,0x77,0x62,0x87,147,,,,,,,Lang4,HIRA,hiragana,,
 KEY_HENKAN,92,,,0x79,0x64,0x86,138,,,,,,,Convert,HENK,henkan,,
-KEY_KATAKANAHIRAGANA,93,,,0x70,0x13,0x87,136,,,0xc8,0xc8,,,KanaMode,HKTG,,,
-KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,NFER,,,
-KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,MUHE,,,
+KEY_KATAKANAHIRAGANA,93,,,0x70,0x13,0x87,136,,,0xc8,0xc8,,,KanaMode,HKTG,katakanahiragana,,
+KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,NFER,muhenkan,,
+KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,MUHE,muhenkan,,
 
KEY_KPJPCOMMA,95,JIS_KeypadComma,0x5f,0x5c,0x27,,140,,,,,XK_KP_Separator,0xffac,,KPSP,,,
 
KEY_KPJPCOMMA,95,JIS_KeypadComma,0x5f,0x5c,0x27,,140,,,,,XK_KP_Separator,0xffac,,JPCM,,,
 
KEY_KPENTER,96,ANSI_KeypadEnter,0x4c,0xe01c,0xe05a,0x79,88,,,0x64,0x64,XK_KP_Enter,0xff8d,NumpadEnter,KPEN,kp_enter,0x5a,0x4c
@@ -246,7 +246,7 @@ 
KEY_STOPCD,166,,,0xe024,0xe03b,0x98,233,VK_MEDIA_STOP,0xb2,,,,,MediaStop,I174,au
 KEY_RECORD,167,,,0xe031,,0x9e,,,,,,,,,I175,,,
 KEY_REWIND,168,,,0xe018,,0x9f,,,,,,,,,I176,,,
 KEY_PHONE,169,,,0x63,,,,,,,,,,,I177,,,
-KEY_ISO,170,ISO_Section,0xa,0x70,,,,,,,,,,,I178,,,
+KEY_ISO,170,ISO_Section,0xa,,,,,,,,,,,,I178,,,
 KEY_CONFIG,171,,,0xe001,,,,,,,,,,,I179,,,
 
KEY_HOMEPAGE,172,,,0xe032,0xe03a,0x97,,VK_BROWSER_HOME,0xac,,,,,BrowserHome,I180,ac_home,,
 
KEY_REFRESH,173,,,0xe067,0xe020,,250,VK_BROWSER_REFRESH,0xa8,,,,,BrowserRefresh,I181,ac_refresh,,
-- 
2.15.1

++++++ ui-keycodemapdb-Fix-compat-with-py3-dict.patch ++++++
>From 6b3d716e2b6472eb7189d3220552280ef3d832ce Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <[email protected]>
Date: Fri, 12 Jan 2018 13:53:44 +0000
Subject: [PATCH] Fix compat with py3 dict keys/values data types

Signed-off-by: Daniel P. Berrange <[email protected]>
Signed-off-by: Bruce Rogers <[email protected]>
---
 tools/keymap-gen | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/keymap-gen b/tools/keymap-gen
index d4594b4..f0269e3 100755
--- a/tools/keymap-gen
+++ b/tools/keymap-gen
@@ -356,19 +356,19 @@ class LanguageSrcGenerator(LanguageGenerator):
 
         if frommapname in database.ENUM_COLUMNS:
             fromtype = self.TYPE_ENUM
-        elif type(tolinux.keys()[0]) == str:
+        elif type(list(tolinux.keys())[0]) == str:
             fromtype = self.TYPE_STRING
         else:
             fromtype = self.TYPE_INT
 
         if tomapname in database.ENUM_COLUMNS:
             totype = self.TYPE_ENUM
-        elif type(fromlinux.values()[0]) == str:
+        elif type(list(fromlinux.values())[0]) == str:
             totype = self.TYPE_STRING
         else:
             totype = self.TYPE_INT
 
-        keys = tolinux.keys()
+        keys = list(tolinux.keys())
         keys.sort()
         if fromtype == self.TYPE_INT:
             keys = range(keys[-1] + 1)
@@ -402,7 +402,7 @@ class LanguageSrcGenerator(LanguageGenerator):
             raise Exception("Unknown map %s, expected one of %s" % (
                             mapname, ", ".join(database.mapto.keys())))
 
-        keys = database.mapto[Database.MAP_LINUX].keys()
+        keys = list(database.mapto[Database.MAP_LINUX].keys())
         keys.sort()
         names = [database.mapname[Database.MAP_LINUX].get(key, "unnamed") for 
key in keys]
 
@@ -411,7 +411,7 @@ class LanguageSrcGenerator(LanguageGenerator):
 
         if mapname in database.ENUM_COLUMNS:
             totype = self.TYPE_ENUM
-        elif type(database.mapto[mapname].values()[0]) == str:
+        elif type(list(database.mapto[mapname].values())[0]) == str:
             totype = self.TYPE_STRING
         else:
             totype = self.TYPE_INT
@@ -440,7 +440,7 @@ class LanguageSrcGenerator(LanguageGenerator):
         if varname is None:
             varname = "name_map_%s_to_%s" % (frommapname, tomapname)
 
-        keys = tolinux.keys()
+        keys = list(tolinux.keys())
         keys.sort()
         if type(keys[0]) == int:
             keys = range(keys[-1] + 1)
@@ -470,7 +470,7 @@ class LanguageSrcGenerator(LanguageGenerator):
             raise Exception("Unknown map %s, expected one of %s" % (
                             mapname, ", ".join(database.mapname.keys())))
 
-        keys = database.mapto[Database.MAP_LINUX].keys()
+        keys = list(database.mapto[Database.MAP_LINUX].keys())
         keys.sort()
         names = [database.mapname[Database.MAP_LINUX].get(key, "unnamed") for 
key in keys]
 
@@ -514,7 +514,7 @@ class LanguageDocGenerator(LanguageGenerator):
             raise Exception("Unknown map %s, expected one of %s" % (
                             mapname, ", ".join(database.mapname.keys())))
 
-        keys = database.mapto[Database.MAP_LINUX].keys()
+        keys = list(database.mapto[Database.MAP_LINUX].keys())
         keys.sort()
         names = [database.mapname[Database.MAP_LINUX].get(key, "unnamed") for 
key in keys]
 
@@ -537,7 +537,7 @@ class LanguageDocGenerator(LanguageGenerator):
                             mapname, ", ".join(database.mapfrom.keys())))
 
         tolinux = database.mapfrom[mapname]
-        keys = tolinux.keys()
+        keys = list(tolinux.keys())
         keys.sort()
         if mapname in database.mapname:
             names = database.mapname[mapname]
-- 
2.15.1


Reply via email to