QAPI patches for 2018-06-22
Subsystems (2)
[Qemu-devel] [PULL 02/10] qapi/events: generate event enum in main module
In reply to Markus ArmbrusterFrom: Marc-André Lureau <[email protected]>
The event generator produces an enum, and put it in the last visited module. It fits better in the main module, since it's the set of all visited events, from all modules.
Message-Id: <[email protected]>
--- scripts/qapi/events.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
scripts/qapi/events.py +3 -2
@@ -180,8 +180,9 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor): types=types)) def visit_end(self): - self._genh.add(gen_enum(self._enum_name, self._event_names)) - self._genc.add(gen_enum_lookup(self._enum_name, self._event_names)) + (genc, genh) = self._module[self._main_module] + genh.add(gen_enum(self._enum_name, self._event_names)) + genc.add(gen_enum_lookup(self._enum_name, self._event_names)) def visit_event(self, name, info, arg_type, boxed): self._genh.add(gen_event_send_decl(name, arg_type, boxed))
Signature · 1 line
2.17.1
The following changes since commit 45eb6fb6cea28cdc937764aac6585751047bb294:
nbd/server: Silence gcc false positive (2018-06-22 14:18:36 +0100)
are available in the Git repository at:
git://repo.or.cz/qemu/armbru.git tags/pull-qapi-2018-06-22
for you to fetch changes up to be25fcc4d2faeb3ffa8db813272963bae659c4c2:
MAINTAINERS: Update QAPI stanza for commit fb0bc835e56 (2018-06-22 16:33:47 +0200)
----------------------------------------------------------------
QAPI patches for 2018-06-22
----------------------------------------------------------------
Anton Nefedov (2):
qapi: allow empty branches in flat unions
qapi: remove empty flat union branches and types
Marc-André Lureau (2):
qapi/visit: remove useless prefix argument qapi/events: generate event enum in main module
Markus Armbruster (3):
qapi: Open files with encoding='utf-8' qapi/introspect: Eliminate pointless variable in .visit_end()
MAINTAINERS: Update QAPI stanza for commit fb0bc835e56
Matthias Maier (1):
Revert commit d4e5ec877ca
Max Reitz (2):
qdict: Make qdict_flatten() shallow-clone-friendly
tests: Add QDict clone-flatten test
MAINTAINERS | 3 +- Makefile | 6 +-- block/qcow2.c | 1 - cpus.c | 2 - docs/devel/qapi-code-gen.txt | 8 ++-- qapi/block-core.json | 52 ++-------------------- qapi/crypto.json | 13 +----- qapi/misc.json | 46 +------------------ qapi/net.json | 12 ----- qapi/ui.json | 19 +------- qobject/block-qdict.c | 19 ++++++-- scripts/qapi/common.py | 32 ++++++++----- scripts/qapi/events.py | 5 ++- scripts/qapi/introspect.py | 5 +-- scripts/qapi/types.py | 2 + scripts/qapi/visit.py | 21 ++++++--- tests/Makefile.include | 7 ++- tests/check-block-qdict.c | 33 ++++++++++++++ tests/qapi-schema/flat-union-incomplete-branch.err | 1 - .../qapi-schema/flat-union-incomplete-branch.exit | 1 - .../qapi-schema/flat-union-incomplete-branch.json | 9 ---- tests/qapi-schema/flat-union-incomplete-branch.out | 0 tests/qapi-schema/qapi-schema-test.json | 6 ++- tests/qapi-schema/qapi-schema-test.out | 3 +- 24 files changed, 116 insertions(+), 190 deletions(-) delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.err delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.exit delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.json delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.out
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 09/10] qapi/introspect: Eliminate pointless variable in .visit_end()
Commit 1a9a507b2e3 "qapi-introspect: Hide type names" added local variable @jsons to improve sorting, but also removed the sorting. It was part of a big series that went to v8, and it made sense until v2 or so...
Commit 7d0f982bfbb replaced @jsons by @qlits, preserving the uselessness.
Get rid of it.
Message-Id: <[email protected]>
--- scripts/qapi/introspect.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
scripts/qapi/introspect.py +1 -4
@@ -75,13 +75,10 @@ class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor): def visit_end(self): # visit the types that are actually used - qlits = self._qlits - self._qlits = [] for typ in self._used_types: typ.visit(self) # generate C # TODO can generate awfully long lines - qlits.extend(self._qlits) name = c_name(self._prefix, protect=False) + 'qmp_schema_qlit' self._genh.add(mcgen(''' #include "qapi/qmp/qlit.h"
@@ -93,7 +90,7 @@ extern const QLitObject %(c_name)s; const QLitObject %(c_name)s = %(c_string)s; ''', c_name=c_name(name), - c_string=to_qlit(qlits))) + c_string=to_qlit(self._qlits))) self._schema = None self._qlits = [] self._used_types = []
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 10/10] MAINTAINERS: Update QAPI stanza for commit fb0bc835e56
In reply to Markus ArmbrusterCommit fb0bc835e56 moved code from scripts/qapi-*.py to scripts/qapi/*.py. It neglected to update MAINTAINERS: scripts/qapi* matches only the former, not the latter. Do that now.
Message-Id: <[email protected]>
--- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
MAINTAINERS +2 -1
@@ -1623,7 +1623,8 @@ F: tests/test-*-visitor.c F: tests/test-qapi-*.c F: tests/test-qmp-*.c F: tests/test-visitor-serialization.c -F: scripts/qapi* +F: scripts/qapi-gen.py +F: scripts/qapi/* F: docs/devel/qapi* T: git git://repo.or.cz/qemu/armbru.git qapi-next
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 01/10] qapi/visit: remove useless prefix argument
In reply to Markus ArmbrusterFrom: Marc-André Lureau <[email protected]>
Message-Id: <[email protected]>
--- scripts/qapi/visit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qapi/visit.py +1 -1
@@ -293,7 +293,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor): #include "qapi/qmp/qerror.h" #include "%(visit)s.h" ''', - visit=visit, prefix=self._prefix)) + visit=visit)) self._genh.preamble_add(mcgen(''' #include "qapi/qapi-builtin-visit.h" #include "%(types)s.h"
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 03/10] qdict: Make qdict_flatten() shallow-clone-friendly
In reply to Markus ArmbrusterFrom: Max Reitz <[email protected]>
In its current form, qdict_flatten() removes all entries from nested QDicts that are moved to the root QDict. It is completely sufficient to remove all old entries from the root QDict, however. If the nested dicts have a refcount of 1, this will automatically delete them, too. And if they have a greater refcount, we probably do not want to modify them in the first place.
The latter observation means that it was currently (in general) impossible to qdict_flatten() a shallowly cloned dict because that would empty nested QDicts in the original dict as well. This patch changes this, so you can now use qdict_flatten(qdict_shallow_clone(dict)) to get a flattened copy without disturbing the original.
Message-Id: <[email protected]>
--- qobject/block-qdict.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
qobject/block-qdict.c +15 -4
@@ -114,19 +114,30 @@ static void qdict_flatten_qdict(QDict *qdict, QDict *target, const char *prefix)/* * Flatten non-empty QDict and QList recursively into @target, -* copy other objects to @target +* copy other objects to @target. +* On the root level (if @qdict == @target), remove flattened +* nested QDicts and QLists from @qdict. +* +* (Note that we do not need to remove entries from nested +* dicts or lists. Their reference count is decremented on +* the root level, so there are no leaks. In fact, if they +* have a reference count greater than one, we are probably +* well advised not to modify them altogether.) */ if (dict_val &&qdict_size (dict_val)) {qdict_flatten_qdict (dict_val, target, new_key ? new_key : entry->key); -qdict_del (qdict, entry->key); +if (target == qdict) { +qdict_del (qdict, entry->key); + } }else if (list_val && !qlist_empty (list_val)) {qdict_flatten_qlist (list_val, target, new_key ? new_key : entry->key); -qdict_del (qdict, entry->key); +if (target == qdict) { +qdict_del (qdict, entry->key); + } }else if (target != qdict) {qdict_put_obj (target, new_key,qobject_ref (value)); -qdict_del (qdict, entry->key); }g_free (new_key);
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 04/10] tests: Add QDict clone-flatten test
In reply to Markus ArmbrusterFrom: Max Reitz <[email protected]>
This new test verifies that qdict_flatten() does not modify a shallow clone of the given QDict.
Message-Id: <[email protected]>
--- tests/check-block-qdict.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
tests/check-block-qdict.c +33 -0
@@ -125,6 +125,38 @@ static void qdict_flatten_test(void)qobject_unref (root); } +static void qdict_clone_flatten_test (void ) +{ +QDict *dict1 =qdict_new (); +QDict *dict2 =qdict_new (); +QDict *cloned_dict1; + +/* +* Test that we can clone and flatten +* { "a": { "b": 42 } } +* without modifying the clone. +*/ + +qdict_put_int (dict2,"b" ,42 ); +qdict_put (dict1,"a" , dict2); + + cloned_dict1 =qdict_clone_shallow (dict1); + +qdict_flatten (dict1); + +g_assert (qdict_size (dict1) ==1 ); +g_assert (qdict_get_int (dict1,"a.b" ) ==42 ); + +g_assert (qdict_size (cloned_dict1) ==1 ); +g_assert (qdict_get_qdict (cloned_dict1,"a" ) == dict2); + +g_assert (qdict_size (dict2) ==1 ); +g_assert (qdict_get_int (dict2,"b" ) ==42 ); + +qobject_unref (dict1); +qobject_unref (cloned_dict1); +} +static void qdict_array_split_test (void ) {QDict *test_dict =qdict_new ();
@@ -674,6 +706,7 @@ int main(int argc, char **argv)g_test_add_func ("/public/defaults" , qdict_defaults_test);g_test_add_func ("/public/flatten" , qdict_flatten_test); +g_test_add_func ("/public/clone_flatten" , qdict_clone_flatten_test);g_test_add_func ("/public/array_split" , qdict_array_split_test);g_test_add_func ("/public/array_entries" , qdict_array_entries_test);g_test_add_func ("/public/join" , qdict_join_test);
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 05/10] qapi: allow empty branches in flat unions
In reply to Markus ArmbrusterFrom: Anton Nefedov <[email protected]>
It often happens that just a few discriminator values imply extra data in a flat union. Existing checks did not make possible to leave other values uncovered. Such cases had to be worked around by either stating a dummy (empty) type or introducing another (subset) discriminator enumeration.
Both options create redundant entities in qapi files for little profit.
With this patch it is not necessary anymore to add designated union fields for every possible value of a discriminator enumeration.
Message-Id: <[email protected]>
--- docs/devel/qapi-code-gen.txt | 8 +++++--- scripts/qapi/common.py | 15 ++++++++------- scripts/qapi/types.py | 2 ++ scripts/qapi/visit.py | 19 ++++++++++++++----- tests/Makefile.include | 1 - .../flat-union-incomplete-branch.err | 1 - .../flat-union-incomplete-branch.exit | 1 - .../flat-union-incomplete-branch.json | 9 --------- .../flat-union-incomplete-branch.out | 0 tests/qapi-schema/qapi-schema-test.json | 6 ++++-- tests/qapi-schema/qapi-schema-test.out | 3 ++- 11 files changed, 35 insertions(+), 30 deletions(-) delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.err delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.exit delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.json delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.out
docs/devel/qapi-code-gen.txt +5 -3
@@ -496,9 +496,11 @@ Resulting in these JSON objects: Notice that in a flat union, the discriminator name is controlled by the user, but because it must map to a base member with enum type, the -code generator can ensure that branches exist for all values of the -enum (although the order of the keys need not match the declaration of -the enum). In the resulting generated C data types, a flat union is +code generator ensures that branches match the existing values of the +enum. The order of the keys need not match the declaration of the enum. +The keys need not cover all possible enum values. Omitted enum values +are still valid branches that add no additional members to the data type. +In the resulting generated C data types, a flat union is represented as a struct with the base members included directly, and then a union of structures for each branch of the struct.
scripts/qapi/common.py +8 -7
@@ -779,13 +779,6 @@ def check_union(expr, info): "enum '%s'" % (key, enum_define['enum'])) - # If discriminator is user-defined, ensure all values are covered - if enum_define: - for value in enum_define['data']: - if value not in members.keys(): - raise QAPISemError(info, "Union '%s' data missing '%s' branch" - % (name, value)) - def check_alternate(expr, info): name = expr['alternate']
@@ -1357,6 +1350,14 @@ class QAPISchemaObjectTypeVariants(object): self.tag_member = seen[c_name(self._tag_name)] assert self._tag_name == self.tag_member.name assert isinstance(self.tag_member.type, QAPISchemaEnumType) + if self._tag_name: # flat union + # branches that are not explicitly covered get an empty type + cases = set([v.name for v in self.variants]) + for val in self.tag_member.type.values: + if val.name not in cases: + v = QAPISchemaObjectTypeVariant(val.name, 'q_empty') + v.set_owner(self.tag_member.owner) + self.variants.append(v) for v in self.variants: v.check(schema) # Union names must match enum values; alternate names are
scripts/qapi/types.py +2 -0
@@ -125,6 +125,8 @@ def gen_variants(variants): c_name=c_name(variants.tag_member.name)) for var in variants.variants: + if var.type.name == 'q_empty': + continue ret += mcgen(''' %(c_type)s %(c_name)s; ''',
scripts/qapi/visit.py +14 -5
@@ -81,15 +81,24 @@ void visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp) c_name=c_name(variants.tag_member.name)) for var in variants.variants: - ret += mcgen(''' + case_str = c_enum_const(variants.tag_member.type.name, + var.name, + variants.tag_member.type.prefix) + if var.type.name == 'q_empty': + # valid variant and nothing to do + ret += mcgen(''' + case %(case)s: + break; +''', + case=case_str) + else: + ret += mcgen(''' case %(case)s: visit_type_%(c_type)s_members(v, &obj->u.%(c_name)s, &err); break; ''', - case=c_enum_const(variants.tag_member.type.name, - var.name, - variants.tag_member.type.prefix), - c_type=var.type.c_name(), c_name=c_name(var.name)) + case=case_str, + c_type=var.type.c_name(), c_name=c_name(var.name)) ret += mcgen(''' default:
tests/Makefile.include +0 -1
@@ -499,7 +499,6 @@ qapi-schema += flat-union-base-any.json qapi-schema += flat-union-base-union.json qapi-schema += flat-union-clash-member.json qapi-schema += flat-union-empty.json -qapi-schema += flat-union-incomplete-branch.json qapi-schema += flat-union-inline.json qapi-schema += flat-union-int-branch.json qapi-schema += flat-union-invalid-branch-key.json
tests/qapi-schema/flat-union-incomplete-branch.err deleted +0 -1
@@ -1 +0,0 @@ -tests/qapi-schema/flat-union-incomplete-branch.json:6: Union 'TestUnion' data missing 'value2' branch
tests/qapi-schema/flat-union-incomplete-branch.exit deleted +0 -1
@@ -1 +0,0 @@ -1
tests/qapi-schema/flat-union-incomplete-branch.json deleted +0 -9
@@ -1,9 +0,0 @@ -# we require all branches of the union to be covered -{ 'enum': 'TestEnum', - 'data': [ 'value1', 'value2' ] } -{ 'struct': 'TestTypeA', - 'data': { 'string': 'str' } } -{ 'union': 'TestUnion', - 'base': { 'type': 'TestEnum' }, - 'discriminator': 'type', - 'data': { 'value1': 'TestTypeA' } }
tests/qapi-schema/flat-union-incomplete-branch.out deleted +0 -0
tests/qapi-schema/qapi-schema-test.json +4 -2
@@ -39,7 +39,7 @@ '*enum1': 'EnumOne' } } # intentional forward reference { 'enum': 'EnumOne', - 'data': [ 'value1', 'value2', 'value3' ] } + 'data': [ 'value1', 'value2', 'value3', 'value4' ] } { 'struct': 'UserDefZero', 'data': { 'integer': 'int' } }
@@ -76,7 +76,9 @@ 'discriminator': 'enum1', 'data': { 'value1' : 'UserDefA', 'value2' : 'UserDefB', - 'value3' : 'UserDefB' } } + 'value3' : 'UserDefB' + # 'value4' defaults to empty + } } { 'struct': 'UserDefUnionBase', 'base': 'UserDefZero',
tests/qapi-schema/qapi-schema-test.out +2 -1
@@ -23,7 +23,7 @@ object UserDefOne base UserDefZero member string: str optional=False member enum1: EnumOne optional=True -enum EnumOne ['value1', 'value2', 'value3'] +enum EnumOne ['value1', 'value2', 'value3', 'value4'] object UserDefZero member integer: int optional=False object UserDefTwoDictDict
@@ -52,6 +52,7 @@ object UserDefFlatUnion case value1: UserDefA case value2: UserDefB case value3: UserDefB + case value4: q_empty object UserDefUnionBase base UserDefZero member string: str optional=False
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 06/10] qapi: remove empty flat union branches and types
In reply to Markus ArmbrusterFrom: Anton Nefedov <[email protected]>
Flat unions may now have uncovered branches, so it is possible to get rid of empty types defined for that purpose only.
Message-Id: <[email protected]>
--- block/qcow2.c | 1 - cpus.c | 2 -- qapi/block-core.json | 52 +++----------------------------------------- qapi/crypto.json | 13 +---------- qapi/misc.json | 46 ++------------------------------------- qapi/net.json | 12 ---------- qapi/ui.json | 19 +--------------- 7 files changed, 7 insertions(+), 138 deletions(-)
block/qcow2.c +0 -1
@@ -4166,7 +4166,6 @@ static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs)switch (encrypt_info->format) {case Q_CRYPTO_BLOCK_FORMAT_QCOW : qencrypt->format =BLOCKDEV_QCOW2_ENCRYPTION_FORMAT_AES ; - qencrypt->u.aes = encrypt_info->u.qcow;break ;case Q_CRYPTO_BLOCK_FORMAT_LUKS : qencrypt->format =BLOCKDEV_QCOW2_ENCRYPTION_FORMAT_LUKS ;
cpus.c +0 -2
@@ -2273,8 +2273,6 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) info->value->target = target;if (target ==SYS_EMU_TARGET_S390X ) {cpustate_to_cpuinfo_s390 (&info->value->u.s390x, cpu); - }else { -/* do nothing for @CpuInfoOther */ }if (!cur_item) {
qapi/block-core.json +3 -49
95 lines not on this page · raw message
qapi/crypto.json +1 -12
@@ -297,16 +297,6 @@ 'uuid': 'str', 'slots': [ 'QCryptoBlockInfoLUKSSlot' ] }} -## -# @QCryptoBlockInfoQCow: -# -# Information about the QCow block encryption options -# -# Since: 2.7 -## -{ 'struct': 'QCryptoBlockInfoQCow', - 'data': { }} - ## # @QCryptoBlockInfo:
@@ -318,5 +308,4 @@ { 'union': 'QCryptoBlockInfo', 'base': 'QCryptoBlockInfoBase', 'discriminator': 'format', - 'data': { 'qcow': 'QCryptoBlockInfoQCow', - 'luks': 'QCryptoBlockInfoLUKS' } } + 'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
qapi/misc.json +2 -44
64 lines not on this page · raw message
qapi/net.json +0 -12
@@ -88,16 +88,6 @@ ## { 'command': 'netdev_del', 'data': {'id': 'str'} } -## -# @NetdevNoneOptions: -# -# Use it alone to have zero network devices. -# -# Since: 1.2 -## -{ 'struct': 'NetdevNoneOptions', - 'data': { } } - ## # @NetLegacyNicOptions: #
@@ -477,7 +467,6 @@ 'base': { 'id': 'str', 'type': 'NetClientDriver' }, 'discriminator': 'type', 'data': { - 'none': 'NetdevNoneOptions', 'nic': 'NetLegacyNicOptions', 'user': 'NetdevUserOptions', 'tap': 'NetdevTapOptions',
@@ -530,7 +519,6 @@ 'base': { 'type': 'NetLegacyOptionsType' }, 'discriminator': 'type', 'data': { - 'none': 'NetdevNoneOptions', 'nic': 'NetLegacyNicOptions', 'user': 'NetdevUserOptions', 'tap': 'NetdevTapOptions',
qapi/ui.json +1 -18
@@ -995,17 +995,6 @@ 'events' : [ 'InputEvent' ] } } -## -# @DisplayNoOpts: -# -# Empty struct for displays without config options. -# -# Since: 2.12 -# -## -{ 'struct' : 'DisplayNoOpts', - 'data' : { } } - ## # @DisplayGTK: #
@@ -1068,10 +1057,4 @@ '*window-close' : 'bool', '*gl' : 'DisplayGLMode' }, 'discriminator' : 'type', - 'data' : { 'default' : 'DisplayNoOpts', - 'none' : 'DisplayNoOpts', - 'gtk' : 'DisplayGTK', - 'sdl' : 'DisplayNoOpts', - 'egl-headless' : 'DisplayNoOpts', - 'curses' : 'DisplayNoOpts', - 'cocoa' : 'DisplayNoOpts' } } + 'data' : { 'gtk' : 'DisplayGTK' } }
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 07/10] qapi: Open files with encoding='utf-8'
In reply to Markus ArmbrusterPython 2 happily reads UTF-8 files in text mode, but Python 3 requires either UTF-8 locale or an explicit encoding passed to open(). Commit d4e5ec877ca fixed this by setting the en_US.UTF-8 locale. Falls apart when the locale isn't be available.
Matthias Maier and Arfrever Frehtes Taifersar Arahesis proposed to use binary mode instead, with manual conversion from bytes to str. Works, but opening with an explicit encoding is simpler, so do that.
Since Python 2's open() doesn't support the encoding parameter, we need to suppress it with a version check.
Message-Id: <[email protected]>
--- scripts/qapi/common.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
scripts/qapi/common.py +14 -3
@@ -16,6 +16,7 @@ import errno import os import re import string +import sys from collections import OrderedDict builtin_types = {
@@ -340,7 +341,10 @@ class QAPISchemaParser(object): return None try: - fobj = open(incl_fname, 'r') + if sys.version_info[0] >= 3: + fobj = open(incl_fname, 'r', encoding='utf-8') + else: + fobj = open(incl_fname, 'r') except IOError as e: raise QAPISemError(info, '%s: %s' % (e.strerror, incl_fname)) return QAPISchemaParser(fobj, previously_included, info)
@@ -1493,7 +1497,11 @@ class QAPISchemaEvent(QAPISchemaEntity): class QAPISchema(object): def __init__(self, fname): self._fname = fname - parser = QAPISchemaParser(open(fname, 'r')) + if sys.version_info[0] >= 3: + f = open(fname, 'r', encoding='utf-8') + else: + f = open(fname, 'r') + parser = QAPISchemaParser(f) exprs = check_exprs(parser.exprs) self.docs = parser.docs self._entity_list = []
@@ -2007,7 +2015,10 @@ class QAPIGen(object): if e.errno != errno.EEXIST: raise fd = os.open(pathname, os.O_RDWR | os.O_CREAT, 0o666) - f = os.fdopen(fd, 'r+') + if sys.version_info[0] >= 3: + f = open(fd, 'r+', encoding='utf-8') + else: + f = os.fdopen(fd, 'r+') text = (self._top(fname) + self._preamble + self._body + self._bottom(fname)) oldtext = f.read(len(text) + 1)
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 08/10] Revert commit d4e5ec877ca
In reply to Markus ArmbrusterFrom: Matthias Maier <[email protected]>
This commit removes the PYTHON_UTF8 workaround. The problem with setting
LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8
is that the en_US.UTF-8 locale might not be available. In this case setting above locales results in build errors even though another UTF-8 locale was originally set [1]. The only stable way of fixing the encoding problem is by specifying the encoding in Python, like the previous commit does.
[1] https://bugs.gentoo.org/657766
Message-Id: <[email protected]>
--- Makefile | 6 ++---- tests/Makefile.include | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-)
Makefile +2 -4
@@ -20,8 +20,6 @@ ifneq ($(wildcard config-host.mak),) all: include config-host.mak -PYTHON_UTF8 = LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8 $(PYTHON) - git-submodule-update: .PHONY: git-submodule-update
@@ -576,7 +574,7 @@ qga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \ qga/qapi-generated/qga-qapi-doc.texi: \ qga/qapi-generated/qapi-gen-timestamp ; qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py) - $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \ + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \ -o qga/qapi-generated -p "qga-" $<, \ "GEN","$(@:%-timestamp=%)") @>$@
@@ -676,7 +674,7 @@ qapi/qapi-introspect.h qapi/qapi-introspect.c \ qapi/qapi-doc.texi: \ qapi-gen-timestamp ; qapi-gen-timestamp: $(qapi-modules) $(qapi-py) - $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \ + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \ -o "qapi" -b $<, \ "GEN","$(@:%-timestamp=%)") @>$@
tests/Makefile.include +3 -3
@@ -678,13 +678,13 @@ tests/test-qapi-events.c tests/test-qapi-events.h \ tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \ tests/test-qapi-gen-timestamp ; tests/test-qapi-gen-timestamp: $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(qapi-py) - $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \ + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \ -o tests -p "test-" $<, \ "GEN","$(@:%-timestamp=%)") @>$@ tests/qapi-schema/doc-good.test.texi: $(SRC_PATH)/tests/qapi-schema/doc-good.json $(qapi-py) - $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \ + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \ -o tests/qapi-schema -p "doc-good-" $<, \ "GEN","$@") @mv tests/qapi-schema/doc-good-qapi-doc.texi $@
@@ -978,7 +978,7 @@ check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) .PHONY: $(patsubst %, check-%, $(check-qapi-schema-y)) $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json $(call quiet-command, PYTHONPATH=$(SRC_PATH)/scripts \ - $(PYTHON_UTF8) $(SRC_PATH)/tests/qapi-schema/test-qapi.py \ + $(PYTHON) $(SRC_PATH)/tests/qapi-schema/test-qapi.py \ $^ >$*.test.out 2>$*.test.err; \ echo $$? >$*.test.exit, \ "TEST","$*.out")
Signature · 1 line
2.17.1
Peter Maydell
AppliedQuoted 8 lines · Markus Armbruster
The following changes since commit
45eb6fb6cea28cdc937764aac6585751047bb294:nbd/server: Silence gcc false positive (2018-06-22 14:18:36 +0100)
are available in the Git repository at:
git://repo.or.cz/qemu/armbru.gittags/pull-qapi-2018-06-22
Quoted 8 lines
for you to fetch changes up to
be25fcc4d2faeb3ffa8db813272963bae659c4c2:
MAINTAINERS: Update QAPI stanza for commitfb0bc835e56(2018-06-22 16:33:47 +0200)----------------------------------------------------------------
QAPI patches for 2018-06-22----------------------------------------------------------------
Applied, thanks.
-- PMM