qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: marcandre.lureau@redhat.com, mdroth@linux.vnet.ibm.com
Subject: Re: [PATCH 6/7] qapi: Split up scripts/qapi/common.py
Date: Tue, 1 Oct 2019 16:19:42 -0500	[thread overview]
Message-ID: <f195452f-43f8-a1be-653b-e4d8d2d888e3@redhat.com> (raw)
In-Reply-To: <20191001191514.11208-7-armbru@redhat.com>

On 10/1/19 2:15 PM, Markus Armbruster wrote:
> The QAPI code generator clocks in at some 3100 SLOC in 8 source files.
> Almost 60% of the code is in qapi/common.py.  Split it into more
> focused modules:
> 
> * Move QAPISchemaPragma and QAPISourceInfo to qapi/source.py.
> 
> * Move QAPIError and its sub-classes to qapi/error.py.
> 
> * Move QAPISchemaParser and QAPIDoc to parser.py.  Use the opportunity
>    to put QAPISchemaParser first.
> 
> * Move check_expr() & friends to qapi/expr.py.  Use the opportunity to
>    put the code into a more sensible order.

Code motion can be easier to review when it is 1:1 (using 'diff -u <(sed 
-n '/^-//p' patch) <(sed -n '/^\+//p'patch)', which is quite small if 
code moved wholesale).  Reordering things breaks that property.

> 
> * Move QAPISchema & friends to qapi/schema.py
> 
> * Move QAPIGen and its sub-classes, ifcontext,
>    QAPISchemaModularCVisitor, and QAPISchemaModularCVisitor to qapi/gen.py
> 
> A number of helper functions remain in qapi/common.py.  I considered
> moving the code generator helpers to qapi/gen.py, but decided not to.
> Perhaps we should rewrite them as methods of QAPIGen some day.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---

>   15 files changed, 2411 insertions(+), 2329 deletions(-)

Sheesh. This one's big.  I'm half-tempted to ask you to split it 
further.  But here goes my review anyway...

>   create mode 100644 scripts/qapi/error.py
>   create mode 100644 scripts/qapi/expr.py
>   create mode 100644 scripts/qapi/gen.py
>   create mode 100644 scripts/qapi/parser.py
>   create mode 100644 scripts/qapi/schema.py
>   create mode 100644 scripts/qapi/source.py
> 
> diff --git a/scripts/qapi-gen.py b/scripts/qapi-gen.py
> index 3d98ca2e0c..f93f3c7c23 100755
> --- a/scripts/qapi-gen.py


> +++ b/scripts/qapi/error.py
> @@ -0,0 +1,42 @@
> +#
> +# QAPI error classes
> +#
> +# Copyright (c) 2017-2019 Red Hat Inc.
> +#
> +# Authors:
> +#  Markus Armbruster <armbru@redhat.com>
> +#  Marc-André Lureau <marcandre.lureau@redhat.com>
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2.
> +# See the COPYING file in the top-level directory.

It's a shame the generator got stuck at GPLv2-only.  I don't know if 
that's worth cleaning up as part of refactoring, but if so, it would be 
best as a separate patch from the code motion.

> +++ b/scripts/qapi/gen.py

> +++ b/scripts/qapi/parser.py

> +++ b/scripts/qapi/schema.py

> +++ b/scripts/qapi/source.py
I didn't see any obvious accidental changes in all that motion (although 
given the size, the review was more cursory of the form "does it look 
like an entire chunk of code moved from one file to another per the 
commit message" than "read every line").

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


  reply	other threads:[~2019-10-01 21:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01 19:15 [PATCH 0/7] qapi: Cleanups and test speedup Markus Armbruster
2019-10-01 19:15 ` [PATCH 1/7] qapi: Don't suppress doc generation without pragma doc-required Markus Armbruster
2019-10-01 19:59   ` Eric Blake
2019-10-01 19:15 ` [PATCH 2/7] qapi: Store pragma state in QAPISourceInfo, not global state Markus Armbruster
2019-10-01 20:01   ` Eric Blake
2019-10-01 19:15 ` [PATCH 3/7] qapi: Eliminate accidental global frontend state Markus Armbruster
2019-10-01 20:03   ` Eric Blake
2019-10-01 19:15 ` [PATCH 4/7] qapi: Speed up frontend tests Markus Armbruster
2019-10-01 20:23   ` Eric Blake
2019-10-02 14:31     ` Markus Armbruster
2019-10-01 19:15 ` [PATCH 5/7] qapi: Move gen_enum(), gen_enum_lookup() back to qapi/types.py Markus Armbruster
2019-10-01 20:26   ` Eric Blake
2019-10-01 19:15 ` [PATCH 6/7] qapi: Split up scripts/qapi/common.py Markus Armbruster
2019-10-01 21:19   ` Eric Blake [this message]
2019-10-02 15:16     ` Markus Armbruster
2019-10-02 15:27       ` Eric Blake
2019-10-02 16:13         ` Markus Armbruster
2019-10-16 13:05   ` Kevin Wolf
2019-10-16 14:09     ` Markus Armbruster
2019-10-01 19:15 ` [PATCH 7/7] qapi: Clear scripts/qapi/doc.py executable bits again Markus Armbruster
2019-10-01 20:34   ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f195452f-43f8-a1be-653b-e4d8d2d888e3@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).