Received: from eggs.gnu.org ([2001:4830:134:3::10]:45239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aROYl-0003WW-Il for qemu-devel@nongnu.org; Thu, 04 Feb 2016 13:23:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aROYi-0004zP-BY for qemu-devel@nongnu.org; Thu, 04 Feb 2016 13:23:15 -0500 Received: from roura.ac.upc.es ([147.83.33.10]:50106) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aROYh-0004z7-Ux for qemu-devel@nongnu.org; Thu, 04 Feb 2016 13:23:12 -0500 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <145459675563.11777.5257429454748921678.stgit@localhost> <56B36EF8.6080309@redhat.com> <20160204154425.GY30301@redhat.com> <878u305t9x.fsf@fimbulvetr.bsc.es> Date: Thu, 04 Feb 2016 19:23:05 +0100 In-Reply-To: <878u305t9x.fsf@fimbulvetr.bsc.es> (=?utf-8?Q?=22Llu=C3=ADs?= Vilanova"'s message of "Thu, 04 Feb 2016 17:34:18 +0100") Message-ID: <87powc49o6.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH ] [trivial] qapi: Build-depend on all json files List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: Peter Maydell , QEMU Developers , Markus Armbruster , Michael Roth Llu=C3=ADs Vilanova writes: > Daniel P Berrange writes: >> On Thu, Feb 04, 2016 at 03:36:56PM +0000, Peter Maydell wrote: >>> On 4 February 2016 at 15:32, Eric Blake wrote: >>> > On 02/04/2016 07:55 AM, Peter Maydell wrote: >>> >> On 4 February 2016 at 14:39, Llu=C3=ADs Vilanova wrote: >>> >>> Dynamically detects the files used to generate QAPI code, thus ensu= ring >>> >>> it's never out of sync with the sources. >>> >>> >>> >>> Signed-off-by: Llu=C3=ADs Vilanova >>> >>> --- >>> >>> Makefile | 6 ++---- >>> >>> 1 file changed, 2 insertions(+), 4 deletions(-) >>> >>> >>> >>> diff --git a/Makefile b/Makefile >>> >>> index d0de2d4..627f772 100644 >>> >>> --- a/Makefile >>> >>> +++ b/Makefile >>> >>> @@ -269,10 +269,8 @@ $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/s= cripts/qapi-commands.py $(qapi-py) >>> >>> $(gen-out-type) -o qga/qapi-generated -p "qga-" $<,= \ >>> >>> " GEN $@") >>> >>> >>> >>> -qapi-modules =3D $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/com= mon.json \ >>> >>> - $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-= core.json \ >>> >>> - $(SRC_PATH)/qapi/event.json $(SRC_PATH)/qapi/intros= pect.json \ >>> >>> - $(SRC_PATH)/qapi/crypto.json >>> >>> +qapi-modules =3D $(SRC_PATH)/qapi-schema.json >>> >>> +qapi-modules +=3D $(shell find $(SRC_PATH)/qapi -name "*.json") >>> >> >>> >> All the .json files are in the same directory, so I don't think we s= hould >>> >> need to use find here. Does >>> >> >>> >> qapi-modules +=3D $(wildcard $(SRC_PATH)/qapi/*.json)) >>> >> >>> >> work ? >>> > >>> > Does this wildcard affect what goes into a tarball? I'm worried that = we >>> > may run the risk of a stale .json file on one developer's machine >>> > causing an unreproducible build on other machines where the file is n= ot >>> > found; explicit lists tend to be safer than wildcards. >>> > >>> > I won't reject the patch if others like it, but I won't approve it my= self. >>>=20 >>> You need to ask Mike Roth about our tarball generation process, not me. >>>=20 >>> I do agree that this patch needs to make the case for why .json source >>> files are special and should be wildcarded, when for instance all our >>> C source files are explicitly listed in makefiles. >> Yes, normal practice is that the files are listed in a Makefile that liv= es >> in the same dir as the file. The qapi json files are not following that >> since they live in a dir above. I'd be inclined to say any patch should >> take us in line with source files, and thus look more like this: >> diff --git a/Makefile b/Makefile >> index b7b0f24..5481b57 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -161,7 +161,8 @@ dummy :=3D $(call unnest-vars,, \ >> qom-obj-y \ >> io-obj-y \ >> common-obj-y \ >> - common-obj-m) >> + common-obj-m \ >> + qapi-modules) =20 >> ifneq ($(wildcard config-host.mak),) >> include $(SRC_PATH)/tests/Makefile >> @@ -269,10 +270,7 @@ $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/script= s/qapi-commands.py $(qapi-py) >> $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \ >> " GEN $@") =20 >> -qapi-modules =3D $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.j= son \ >> - $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.= json \ >> - $(SRC_PATH)/qapi/event.json $(SRC_PATH)/qapi/introspect.= json \ >> - $(SRC_PATH)/qapi/crypto.json >> +qapi-modules +=3D $(SRC_PATH)/qapi-schema.json =20 >> qapi-types.c qapi-types.h :\ >> $(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py) >> diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs >> index 2278970..a644a69 100644 >> --- a/qapi/Makefile.objs >> +++ b/qapi/Makefile.objs >> @@ -4,3 +4,10 @@ util-obj-y +=3D string-input-visitor.o string-output-vi= sitor.o >> util-obj-y +=3D opts-visitor.o >> util-obj-y +=3D qmp-event.o >> util-obj-y +=3D qapi-util.o >> + >> +qapi-modules +=3D common.json >> +qapi-modules +=3D block.json >> +qapi-modules +=3D block-core.json >> +qapi-modules +=3D event.json >> +qapi-modules +=3D introspect.json >> +qapi-modules +=3D crypto.json > Moving it into the qapi directory is definitely an improvement (regardles= s of > whether it uses an explicit list or find/wildcard). For the record: I've played with this for a bit and it does not work. In yo= ur example, it cannot find the source files (for some reason cannot find them = in vpath although I've changed VPATH_SUFFIXES in rules.mak to account for %.js= on), and using an absolute path seems to break the makefile macro that recurses = into directories (unnest-vars). Cheers, Lluis