xen/tools: Fix gen-cpuid.py's ability to report errors
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 26 Nov 2018 12:03:07 +0000 (12:03 +0000)
committerWei Liu <wei.liu2@citrix.com>
Tue, 27 Nov 2018 16:57:41 +0000 (16:57 +0000)
commitc9d7fdb83bdfd71bec84acea0e0db232c4503212
tree10eca2ed3775be55cda937c353d970e43607a8ec
parentdc80c424844578048b457730e293a65267dea01c
xen/tools: Fix gen-cpuid.py's ability to report errors

c/s 18596903 "xen/tools: support Python 2 and Python 3" unfortunately
introduced a TypeError when changing how Fail exceptions were printed:

  /local/xen.git/xen/../xen/tools/gen-cpuid.py:Traceback (most recent call last):
    File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 483, in <module>
        sys.stderr.write(e)
  TypeError: expected a character buffer object

Coerce e to a string before printing.  While changing this, fold the three
write() calls making up the line into a single one, and take the opportunity
to neaten the output.

A sample error is:

  /local/xen.git/xen/tools/gen-cpuid.py: Fail: Aliased value between FOO and BAR

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/tools/gen-cpuid.py