From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCyRE-0003ww-QN for qemu-devel@nongnu.org; Mon, 10 Feb 2014 16:30:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCyRA-0007pX-KS for qemu-devel@nongnu.org; Mon, 10 Feb 2014 16:30:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCyRA-0007pS-Aw for qemu-devel@nongnu.org; Mon, 10 Feb 2014 16:30:44 -0500 Message-ID: <52F936CC.201@redhat.com> Date: Mon, 10 Feb 2014 13:30:04 -0700 From: Eric Blake MIME-Version: 1.0 References: <20140210195816.3495.74530.stgit@fimbulvetr.bsc.es> <20140210195828.3495.73534.stgit@fimbulvetr.bsc.es> In-Reply-To: <20140210195828.3495.73534.stgit@fimbulvetr.bsc.es> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7lQHMBMjxu4uCo1ukaQgF7OooLw6UGMGS" Subject: Re: [Qemu-devel] [PATCH v2 2/2] qapi: Add a primitive to include other files from a QAPI schema file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?TGx1w61zIFZpbGFub3Zh?= , qemu-devel@nongnu.org Cc: Markus Armbruster , Luiz Capitulino This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --7lQHMBMjxu4uCo1ukaQgF7OooLw6UGMGS Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 02/10/2014 12:58 PM, Llu=C3=ADs Vilanova wrote: > Adds the "include(...)" primitive to the syntax of QAPI schema files. >=20 > Signed-off-by: Llu=C3=ADs Vilanova > --- > scripts/qapi.py | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) >=20 > + elif self.tok =3D=3D 'i': > + include_src =3D self.src[self.cursor-1:] > + include_match =3D include_cre.match(include_src) > + if include_match is not None: > + include_path =3D os.path.join(self.input_dir, > + include_match.group(1)= ) > + if not os.path.isfile(include_path): > + raise QAPISchemaError( > + self, > + 'Non-existing included file "%s"' % includ= e_path) Should you also check against loops, and gracefully fail if a file tries to include itself, or if file A includes B while B includes A? This changes the code generator, but not the documentation. For this patch to be complete, you need to edit somewhere in the docs tree, probably docs/qapi-code-gen.txt, to describe how to use includes. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --7lQHMBMjxu4uCo1ukaQgF7OooLw6UGMGS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJS+TbMAAoJEKeha0olJ0NquZgIAIMXKOqKpBLGxKtsmg3QaemD gLfL1NUV3IcEe5IazPsq6RnLMGZQGsUD53ZvAXm8RZFGp0VBqm+YDAN6xMlk4p8y u66px5bH/XfZiUmRQU2PYknyOeJsb7SV1TGdmNzmwG82lXshCsvrnJhPdQT5Plg3 ysX5Q4gn7mB1Jbjet6A9bGCg1ChLXDQNemroDTkSN9pmfCAyuQ2kgBejT7T+pBP3 qZrTdPlZ02VbAK3u/Ef+QVhMC5u7XY1RaLCBL6D6kQA5yX7qfDPcOR7oX3GNYYpX obCcv/DhEe7ceAIqyhrVASJ5RK9Lrhqct6UkuhaGNcLQLDli97wGtjQCdhjQNsk= =skwE -----END PGP SIGNATURE----- --7lQHMBMjxu4uCo1ukaQgF7OooLw6UGMGS--