All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: mdroth@linux.vnet.ibm.com, marcandre.lureau@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 08/29] qapi-gen: New common driver for code and doc generators
Date: Mon, 12 Feb 2018 13:42:05 -0600	[thread overview]
Message-ID: <a095759a-0b4b-125d-a178-3456e3651c42@redhat.com> (raw)
In-Reply-To: <20180211093607.27351-9-armbru@redhat.com>

On 02/11/2018 03:35 AM, Markus Armbruster wrote:
> Whenever qapi-schema.json changes, we run six programs eleven times to
> update eleven files.  Similar for qga/qapi-schema.json.  This is
> silly.  Replace the six programs by a single program that spits out
> all eleven files.
> 
> The programs become modules in new Python package qapi, along with the
> helper library.  This requires moving them to scripts/qapi/.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   .gitignore                                         |  2 +
>   Makefile                                           | 86 +++++++++----------
>   docs/devel/qapi-code-gen.txt                       | 97 ++++++++++------------
>   monitor.c                                          |  2 +-
>   qapi-schema.json                                   |  2 +-
>   scripts/qapi-gen.py                                | 41 +++++++++
>   scripts/qapi/__init__.py                           |  0
>   scripts/{qapi-commands.py => qapi/commands.py}     | 23 ++---
>   scripts/{qapi.py => qapi/common.py}                | 18 +---
>   scripts/{qapi2texi.py => qapi/doc.py}              | 29 ++-----
>   scripts/{qapi-event.py => qapi/events.py}          | 23 ++---
>   scripts/{qapi-introspect.py => qapi/introspect.py} | 32 ++-----
>   scripts/{qapi-types.py => qapi/types.py}           | 34 ++------
>   scripts/{qapi-visit.py => qapi/visit.py}           | 34 ++------
>   tests/Makefile.include                             | 56 ++++++-------
>   tests/qapi-schema/test-qapi.py                     |  4 +-
>   16 files changed, 193 insertions(+), 290 deletions(-)
>   create mode 100755 scripts/qapi-gen.py
>   create mode 100644 scripts/qapi/__init__.py
>   rename scripts/{qapi-commands.py => qapi/commands.py} (94%)
>   rename scripts/{qapi.py => qapi/common.py} (99%)
>   rename scripts/{qapi2texi.py => qapi/doc.py} (92%)
>   mode change 100755 => 100644

Still forgot mention that the mode bit change was intentional, but not 
worth a respin for just that.

>   rename scripts/{qapi-event.py => qapi/events.py} (92%)
>   rename scripts/{qapi-introspect.py => qapi/introspect.py} (90%)
>   rename scripts/{qapi-types.py => qapi/types.py} (90%)
>   rename scripts/{qapi-visit.py => qapi/visit.py} (92%)

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

> +++ b/docs/devel/qapi-code-gen.txt

> -    $ python scripts/qapi-event.py --output-dir="qapi-generated"
> -    --prefix="example-" example-schema.json
>       $ cat qapi-generated/example-qapi-event.h
>   [Uninteresting stuff omitted...]
>   
> @@ -1302,23 +1296,22 @@ Example:
>       }
>   
>       const char *const example_QAPIEvent_lookup[] = {
> -        [EXAMPLE_QAPI_EVENT_MY_EVENT] = "MY_EVENT",
> +
> +[EXAMPLE_QAPI_EVENT_MY_EVENT] = "MY_EVENT",
>           [EXAMPLE_QAPI_EVENT__MAX] = NULL,
>       };

Looks like our generated code indentation has slightly regressed from 
what we would write by hand, but it's still okay for generated code (and 
the commit message in 5/29 did call that out)

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

> +++ b/scripts/qapi/commands.py
> @@ -13,7 +13,7 @@ This work is licensed under the terms of the GNU GPL, version 2.
>   See the COPYING file in the top-level directory.
>   """
>   
> -from qapi import *
> +from qapi.common import *
>   
>   
>   def gen_command_decl(name, arg_type, boxed, ret_type):
> @@ -255,13 +255,8 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor):
>           self._regy += gen_register_command(name, success_response)
>   
>   
> -def main(argv):
> -    (input_file, output_dir, do_c, do_h, prefix, opts) = parse_command_line()
> -
> -    blurb = '''
> - * Schema-defined QAPI/QMP commands
> -'''
> -
> +def gen_commands(schema, output_dir, prefix):
> +    blurb = ' * Schema-defined QAPI/QMP commands'

We discussed whether to make the assignment to blurb be a one-liner in 
an earlier patch, but I'm also fine with the churn you have over the 
course of the series.


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

  reply	other threads:[~2018-02-12 19:42 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-11  9:35 [Qemu-devel] [PATCH v2 00/29] Modularize generated QAPI code Markus Armbruster
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 01/29] Include qapi/qmp/qerror.h exactly where needed Markus Armbruster
2018-02-12 16:55   ` Eric Blake
2018-02-13 15:24   ` Marc-Andre Lureau
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 02/29] qapi: Streamline boilerplate comment generation Markus Armbruster
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 03/29] qapi: Generate up-to-date copyright notice Markus Armbruster
2018-02-12 19:40   ` Eric Blake
2018-02-16 22:53   ` Michael Roth
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 04/29] qapi: Rename variable holding the QAPISchemaGenFOOVisitor Markus Armbruster
2018-02-12 16:59   ` Eric Blake
2018-02-13 15:24   ` Marc-Andre Lureau
2018-02-16 22:56   ` Michael Roth
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 05/29] qapi: New classes QAPIGenC, QAPIGenH, QAPIGenDoc Markus Armbruster
2018-02-17  0:59   ` Michael Roth
2018-02-23 17:18     ` Markus Armbruster
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 06/29] qapi: Reduce use of global variables in generators some Markus Armbruster
2018-02-17  1:22   ` Michael Roth
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 07/29] qapi: Turn generators into modules Markus Armbruster
2018-02-17  1:29   ` Michael Roth
2018-02-27 15:53   ` Eric Blake
2018-02-27 16:01     ` Daniel P. Berrangé
2018-04-13 12:49       ` Markus Armbruster
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 08/29] qapi-gen: New common driver for code and doc generators Markus Armbruster
2018-02-12 19:42   ` Eric Blake [this message]
2018-02-23 17:20     ` Markus Armbruster
2018-02-26 20:02       ` Eric Blake
2018-02-18 22:16   ` Michael Roth
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 09/29] qapi-gen: Convert from getopt to argparse Markus Armbruster
2018-02-12 19:44   ` Eric Blake
2018-02-13 15:24   ` Marc-Andre Lureau
2018-02-18 22:31   ` Michael Roth
2018-02-23 17:21     ` Markus Armbruster
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 10/29] qapi: Touch generated files only when they change Markus Armbruster
2018-02-12 19:48   ` Eric Blake
2018-02-13 15:22     ` Marc-Andre Lureau
2018-02-23 17:22       ` Markus Armbruster
2018-02-18 22:43   ` Michael Roth
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 11/29] qapi: Improve include file name reporting in error messages Markus Armbruster
2018-02-18 23:11   ` Michael Roth
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 12/29] qapi/common: Eliminate QAPISchema.exprs Markus Armbruster
2018-02-18 23:13   ` Michael Roth
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 13/29] qapi: Lift error reporting from QAPISchema.__init__() to callers Markus Armbruster
2018-02-12 19:52   ` Eric Blake
2018-02-18 23:17   ` Michael Roth
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 14/29] qapi: Concentrate QAPISchemaParser.exprs updates in .__init__() Markus Armbruster
2018-02-12 19:56   ` Eric Blake
2018-02-18 23:32   ` Michael Roth
2018-02-23 17:29     ` Markus Armbruster
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 15/29] qapi: Record 'include' directives in parse tree Markus Armbruster
2018-02-12 20:03   ` Eric Blake
2018-02-18 23:57   ` Michael Roth
2018-02-23 17:31     ` Markus Armbruster
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 16/29] qapi: Generate in source order Markus Armbruster
2018-02-12 20:06   ` Eric Blake
2018-02-19  0:01   ` Michael Roth
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 17/29] qapi: Record 'include' directives in intermediate representation Markus Armbruster
2018-02-12 20:34   ` Eric Blake
2018-02-23 17:33     ` Markus Armbruster
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 18/29] qapi: Rename generated qmp-marshal.c to qmp-commands.c Markus Armbruster
2018-02-12 20:56   ` Eric Blake
2018-02-13 15:25   ` Marc-Andre Lureau
2018-02-19  0:21   ` Michael Roth
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 19/29] qapi: Make code-generating visitors use QAPIGen more Markus Armbruster
2018-02-12 21:06   ` Eric Blake
2018-02-13 15:25   ` Marc-Andre Lureau
2018-02-19 15:52   ` Michael Roth
2018-02-23 17:35     ` Markus Armbruster
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 20/29] qapi/types qapi/visit: Generate built-in stuff into separate files Markus Armbruster
2018-02-12 21:44   ` Eric Blake
2018-02-23 17:36     ` Markus Armbruster
2018-02-13 15:25   ` Marc-Andre Lureau
2018-02-19 19:30   ` Michael Roth
2018-02-11  9:35 ` [Qemu-devel] [PATCH v2 21/29] qapi/common: Fix guardname() for funny filenames Markus Armbruster
2018-02-19 18:18   ` Michael Roth
2018-02-11  9:36 ` [Qemu-devel] [PATCH v2 22/29] qapi: Generate separate .h, .c for each module Markus Armbruster
2018-02-12 22:06   ` Eric Blake
2018-02-23 17:41     ` Markus Armbruster
2018-02-26 22:39       ` Eric Blake
2018-02-11  9:36 ` [Qemu-devel] [PATCH v2 23/29] Include less of the generated modular QAPI headers Markus Armbruster
2018-02-12 22:13   ` Eric Blake
2018-02-23 17:47     ` Markus Armbruster
2018-02-13 15:54   ` Marc-Andre Lureau
2018-02-11  9:36 ` [Qemu-devel] [PATCH v2 24/29] qapi: Empty out qapi-schema.json Markus Armbruster
2018-02-12 22:26   ` Eric Blake
2018-02-23 17:50     ` Markus Armbruster
2018-02-11  9:36 ` [Qemu-devel] [PATCH v2 25/29] docs/devel/writing-qmp-commands: Update for modular QAPI Markus Armbruster
2018-02-12 22:27   ` Eric Blake
2018-02-13 16:00   ` Marc-Andre Lureau
2018-02-19 19:33   ` Michael Roth
2018-02-11  9:36 ` [Qemu-devel] [PATCH v2 26/29] docs: Correct outdated information on QAPI Markus Armbruster
2018-02-12 22:29   ` Eric Blake
2018-02-13 16:03   ` Marc-Andre Lureau
2018-02-19 19:35   ` Michael Roth
2018-02-11  9:36 ` [Qemu-devel] [PATCH v2 27/29] qapi: Move qapi-schema.json to qapi/, rename generated files Markus Armbruster
2018-02-12 22:36   ` Eric Blake
2018-02-23 17:51     ` Markus Armbruster
2018-02-13 16:08   ` Marc-Andre Lureau
2018-02-19 19:37   ` Michael Roth
2018-02-11  9:36 ` [Qemu-devel] [PATCH v2 28/29] Fix up dangling references to qmp-commands.* in comment and doc Markus Armbruster
2018-02-12 22:47   ` Eric Blake
2018-02-13 16:12   ` Marc-Andre Lureau
2018-02-19 19:38   ` Michael Roth
2018-02-11  9:36 ` [Qemu-devel] [PATCH v2 29/29] qapi: Don't create useless directory qapi-generated Markus Armbruster
2018-02-12 22:48   ` Eric Blake
2018-02-13 16:15   ` Marc-Andre Lureau
2018-02-19 19:38   ` Michael Roth
2018-02-11 10:16 ` [Qemu-devel] [PATCH v2 00/29] Modularize generated QAPI code no-reply
2018-02-26 22:57 ` [Qemu-devel] [PATCH v2 23.5/29] watchdog: Consolidate QAPI into single file Eric Blake
2018-02-26 23:10   ` Eric Blake
2018-02-27 14:19 ` [Qemu-devel] [PATCH v2 00/29] Modularize generated QAPI code 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=a095759a-0b4b-125d-a178-3456e3651c42@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.