[libvirt PATCH 0/2] Update sync_qemu_i386.py tool for changes in QEMU

QEMU commit e11fd68996fb27c040552320f01a7d30a15a7cc1 changed a line that was used by our tool as marker. Commit 1 prepares for the change, commit 2 actually makes the required adjustment. Cheers, Tim Tim Wiederhake (2): cpu_map: sync_qemu_i386.py: Use regex to look for begin mark cpu_map: sync_qemu_i386.py: Allow begin mark to contain `const` src/cpu_map/sync_qemu_i386.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.26.3

Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- src/cpu_map/sync_qemu_i386.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cpu_map/sync_qemu_i386.py b/src/cpu_map/sync_qemu_i386.py index 1a98fa70d7..40c7d6e969 100755 --- a/src/cpu_map/sync_qemu_i386.py +++ b/src/cpu_map/sync_qemu_i386.py @@ -196,7 +196,7 @@ def read_builtin_x86_defs(filename): """Extract content between begin_mark and end_mark from file `filename` as string, while expanding shorthand macros like "I486_FEATURES".""" - begin_mark = "static X86CPUDefinition builtin_x86_defs[] = {\n" + begin_mark = re.compile("^static X86CPUDefinition builtin_x86_defs\\[\\] = {$") end_mark = "};\n" shorthand = re.compile("^#define ([A-Z0-9_]+_FEATURES) (.*)$") lines = list() @@ -205,10 +205,11 @@ def read_builtin_x86_defs(filename): with open(filename, "rt") as f: while True: line = readline_cont(f) - if line == begin_mark: - break if not line: raise RuntimeError("begin mark not found") + match = begin_mark.match(line) + if match: + break; match = shorthand.match(line) if match: # TCG definitions are irrelevant for cpu models -- 2.26.3

This was introduced in qemu commit e11fd68996fb27c040552320f01a7d30a15a7cc1. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- src/cpu_map/sync_qemu_i386.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpu_map/sync_qemu_i386.py b/src/cpu_map/sync_qemu_i386.py index 40c7d6e969..fbf1edf5d0 100755 --- a/src/cpu_map/sync_qemu_i386.py +++ b/src/cpu_map/sync_qemu_i386.py @@ -196,7 +196,7 @@ def read_builtin_x86_defs(filename): """Extract content between begin_mark and end_mark from file `filename` as string, while expanding shorthand macros like "I486_FEATURES".""" - begin_mark = re.compile("^static X86CPUDefinition builtin_x86_defs\\[\\] = {$") + begin_mark = re.compile("^static( const)? X86CPUDefinition builtin_x86_defs\\[\\] = {$") end_mark = "};\n" shorthand = re.compile("^#define ([A-Z0-9_]+_FEATURES) (.*)$") lines = list() -- 2.26.3

On 6/7/21 2:01 PM, Tim Wiederhake wrote:
QEMU commit e11fd68996fb27c040552320f01a7d30a15a7cc1 changed a line that was used by our tool as marker. Commit 1 prepares for the change, commit 2 actually makes the required adjustment.
Cheers, Tim
Tim Wiederhake (2): cpu_map: sync_qemu_i386.py: Use regex to look for begin mark cpu_map: sync_qemu_i386.py: Allow begin mark to contain `const`
src/cpu_map/sync_qemu_i386.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> and pushed. Michal
participants (2)
-
Michal Prívozník
-
Tim Wiederhake