All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Benoît Canet" <benoit.canet@irqsave.net>, qemu-devel@nongnu.org
Cc: anthony@codemonkey.ws, Benoit Canet <benoit@irqsave.net>,
	armbru@redhat.com, wenchaoqemu@gmail.com, lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH V2 2/3] qapi: Change the qapi scripts to take their input as first argument.
Date: Thu, 27 Mar 2014 11:27:38 -0600	[thread overview]
Message-ID: <53345F8A.1040607@redhat.com> (raw)
In-Reply-To: <1395934399-18769-3-git-send-email-benoit.canet@irqsave.net>

[-- Attachment #1: Type: text/plain, Size: 2331 bytes --]

On 03/27/2014 09:33 AM, Benoît Canet wrote:
> This patch is here to pave the way for the JSON include directive which
> will need to do include loop detection.
> 

Would also be nice to mention that it improves the error message
quality.  While 3/3 is definitely 2.1 material, 1/3 and 2/3 could
arguably be committed in 2.0 as bug fixes due to the improved errors
(but it's a stretch - personally I'm fine with saving the whole series
for 2.1, as the error messages are in the build chain only for
developers to see, and not user-visible in the end product)

> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---

>  24 files changed, 76 insertions(+), 51 deletions(-)

> 
> diff --git a/Makefile b/Makefile
> index ec74039..9bec4ff 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -236,24 +236,24 @@ gen-out-type = $(subst .,-,$(suffix $@))
>  qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
>  
>  qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
> -$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
> +$(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(SRC_PATH)/qga/qapi-schema.json $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")

While I don't mind GNU getopt's ability to reorganize options to occur
after non-options, I'm not sure it's the smartest thing to do here.
Either the input file should be a new option (as in '-i input -o
output') or you should consider ordering the command line to put the
file name after all options ('-o output input' rather than 'input -o
output').  For that matter, I feel that named options are always more
flexible than positional arguments.

That said, it looks like this script _already_ has a positional argument
(gen-out-type) occurring before options, so you aren't making it any
worse.  Therefore, if you don't respin it to take the input file name as
an option, I can live with:

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

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2014-03-27 17:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 15:33 [Qemu-devel] [PATCH V2 0/3] Create an include directive for QAPI JSON files Benoît Canet
2014-03-27 15:33 ` [Qemu-devel] [PATCH V2 1/3] test-qapi: Make test-qapi.py spit useful error messages Benoît Canet
2014-03-27 15:33 ` [Qemu-devel] [PATCH V2 2/3] qapi: Change the qapi scripts to take their input as first argument Benoît Canet
2014-03-27 17:27   ` Eric Blake [this message]
2014-03-28  8:27     ` Markus Armbruster
2014-03-27 17:56   ` Markus Armbruster
2014-03-27 15:33 ` [Qemu-devel] [PATCH V2 3/3] qapi: Create an include directive for use in the JSON description files Benoît Canet
2014-03-27 17:39   ` Eric Blake
2014-03-27 18:07   ` Markus Armbruster
2014-03-27 19:46     ` Benoît Canet

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=53345F8A.1040607@redhat.com \
    --to=eblake@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=armbru@redhat.com \
    --cc=benoit.canet@irqsave.net \
    --cc=benoit@irqsave.net \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wenchaoqemu@gmail.com \
    /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.