xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Nick Rosbrook <rosbrookn@gmail.com>, <xen-devel@lists.xenproject.org>
Cc: Nick Rosbrook <rosbrookn@ainfosec.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	kerriganb@ainfosec.com, Wei Liu <wl@xen.org>
Subject: Re: [Xen-devel] [PATCH 24/24] golang/xenlight: add make target for generated files
Date: Thu, 24 Oct 2019 15:26:19 +0100	[thread overview]
Message-ID: <52866b46-6da0-9d89-8c77-0ac4ceb7b689@citrix.com> (raw)
In-Reply-To: <26d6deae1803591361f7568645bc59b1535d6b88.1570456846.git.rosbrookn@ainfosec.com>

On 10/7/19 4:13 PM, Nick Rosbrook wrote:
> From: Nick Rosbrook <rosbrookn@ainfosec.com>
> 
> Remove the PKGSOURCES variable since adding xenlight_types.go
> and xenlight_helpers.go to this list breaks the rest of the
> Makefile.
> 
> Add xenlight_%.go target for generated files, and use full
> file names within install, uninstall and $(XEN_GOPATH)$(GOXL_PKG_DIR)
> rule.
> 
> Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>

Hey Nick!  Thanks for breaking down the series this way -- this is much
easier to review.

One standard practice when making a series is to try to avoid any
regressions, including build regressions, in the middle of the series.
This is particularly helpful to aid in bisections, but in this case it
makes it easier to observe the action of the `gengotypes.py` script (and
how it's meant to be called).

So I would basically make this part of patch 2, except remove references
to xenlight_helpers.go until the patch where that file is generated.

One other comment...

> ---
> Cc: George Dunlap <george.dunlap@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Wei Liu <wl@xen.org>
> 
>  tools/golang/xenlight/Makefile | 22 ++++++++++++++--------
>  1 file changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/golang/xenlight/Makefile b/tools/golang/xenlight/Makefile
> index 0987305224..821a5d48fa 100644
> --- a/tools/golang/xenlight/Makefile
> +++ b/tools/golang/xenlight/Makefile
> @@ -7,20 +7,22 @@ GOCODE_DIR ?= $(prefix)/share/gocode/
>  GOXL_PKG_DIR = /src/$(XEN_GOCODE_URL)/xenlight/
>  GOXL_INSTALL_DIR = $(GOCODE_DIR)$(GOXL_PKG_DIR)
>  
> -# PKGSOURCES: Files which comprise the distributed source package
> -PKGSOURCES = xenlight.go
> -
>  GO ?= go
>  
>  .PHONY: all
>  all: build
>  
>  .PHONY: package
> -package: $(XEN_GOPATH)$(GOXL_PKG_DIR)$(PKGSOURCES)
> +package: $(XEN_GOPATH)$(GOXL_PKG_DIR)
>  
> -$(XEN_GOPATH)/src/$(XEN_GOCODE_URL)/xenlight/$(PKGSOURCES): $(PKGSOURCES)
> +$(XEN_GOPATH)/src/$(XEN_GOCODE_URL)/xenlight/: xenlight_%.go
>  	$(INSTALL_DIR) $(XEN_GOPATH)$(GOXL_PKG_DIR)
> -	$(INSTALL_DATA) $(PKGSOURCES) $(XEN_GOPATH)$(GOXL_PKG_DIR)
> +	$(INSTALL_DATA) xenlight.go $(XEN_GOPATH)$(GOXL_PKG_DIR)
> +	$(INSTALL_DATA) xenlight_types.go $(XEN_GOPATH)$(GOXL_PKG_DIR)
> +	$(INSTALL_DATA) xenlight_helpers.go $(XEN_GOPATH)$(GOXL_PKG_DIR)

It might be nice to have a naming convention for the generated files
that clues people in to the fact that they're generated (other than the
comment at the top of course).  In libxl, this is done by giving them a
leading underscore (e.g., _libxl_type.h); but the go compiler will
helpfully ignore such files. :-)

The go compiler will also do special things sometimes with things after
a `_`; e.g., "${foo}_test.go" will only be compiled for `go test`,
"${foo}_linux.go" will only be compiled on Linux, and so on.  I'm pretty
sure these names will be safe, but it might be slightly more
future-proof to avoid using an underscore in the names.

What about something like "gentypes.go" or "idltypes.go"?

Just a suggestion.

> +
> +xenlight_%.go: gengotypes.py $(XEN_ROOT)/tools/libxl/libxl_types.idl $(XEN_ROOT)/tools/libxl/idl.py
> +	XEN_ROOT=$(XEN_ROOT) $(PYTHON) gengotypes.py ../../libxl/libxl_types.idl
>  
>  # Go will do its own dependency checking, and not actuall go through
>  # with the build if none of the input files have changed.
> @@ -36,10 +38,14 @@ build: package
>  .PHONY: install
>  install: build
>  	$(INSTALL_DIR) $(DESTDIR)$(GOXL_INSTALL_DIR)
> -	$(INSTALL_DATA) $(XEN_GOPATH)$(GOXL_PKG_DIR)$(PKGSOURCES) $(DESTDIR)$(GOXL_INSTALL_DIR)
> +	$(install_data) $(xen_gopath)$(goxl_pkg_dir)xenlight.go $(destdir)$(goxl_install_dir)
> +	$(install_data) $(xen_gopath)$(goxl_pkg_dir)xenlight_types.go $(destdir)$(goxl_install_dir)
> +	$(install_data) $(xen_gopath)$(goxl_pkg_dir)xenlight_helpers.go $(destdir)$(goxl_install_dir)
>  
>  .PHONY: uninstall
> -	rm -f $(addprefix $(DESTDIR)$(GOXL_INSTALL_DIR)/, $(PKGSOURCES))
> +	rm -f $(addprefix $(DESTDIR)$(GOXL_INSTALL_DIR)/, xenlight.go)
> +	rm -f $(addprefix $(DESTDIR)$(GOXL_INSTALL_DIR)/, xenlight_types.go)
> +	rm -f $(addprefix $(DESTDIR)$(GOXL_INSTALL_DIR)/, xenlight_helpers.go)

Kind of random, but would it make sense to `rm -rf` the whole directory
here instead?

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-10-24 14:26 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07 15:12 [Xen-devel] [PATCH 00/24] generated Go libxl bindings using IDL Nick Rosbrook
2019-10-07 15:12 ` [Xen-devel] [PATCH 01/24] golang/xenlight: fix calls to libxl_domain_unpause/pause Nick Rosbrook
2019-10-07 16:39   ` George Dunlap
2019-10-08  4:17     ` Jürgen Groß
2019-10-07 15:12 ` [Xen-devel] [PATCH 02/24] golang/xenlight: generate enum types from IDL Nick Rosbrook
2019-10-24 14:35   ` George Dunlap
2019-10-07 15:12 ` [Xen-devel] [PATCH 03/24] golang/xenlight: define Defbool builtin type Nick Rosbrook
2019-10-24 15:17   ` George Dunlap
2019-10-07 15:12 ` [Xen-devel] [PATCH 04/24] golang/xenlight: define Devid type as int Nick Rosbrook
2019-10-24 15:20   ` George Dunlap
2019-10-07 15:12 ` [Xen-devel] [PATCH 05/24] golang/xenlight: define KeyValueList builtin type Nick Rosbrook
2019-10-24 16:34   ` George Dunlap
2019-10-24 19:54     ` Nick Rosbrook
2019-10-25 11:26       ` George Dunlap
2019-10-25 12:30         ` Nick Rosbrook
2019-10-07 15:12 ` [Xen-devel] [PATCH 06/24] golang/xenlight: re-name Bitmap marshaling functions Nick Rosbrook
2019-11-13 15:21   ` George Dunlap
2019-11-13 20:53     ` Nick Rosbrook
2019-11-14 11:44       ` George Dunlap
2019-10-07 15:12 ` [Xen-devel] [PATCH 07/24] golang/xenlight: define StringList builtin type Nick Rosbrook
2019-11-13 15:37   ` George Dunlap
2019-11-13 21:14     ` Nick Rosbrook
2019-10-07 15:12 ` [Xen-devel] [PATCH 08/24] golang/xenlight: define Mac " Nick Rosbrook
2019-11-13 15:51   ` George Dunlap
2019-11-13 21:50     ` Nick Rosbrook
2019-11-14 12:27       ` George Dunlap
2019-11-14 15:34         ` Nick Rosbrook
2019-10-07 15:12 ` [Xen-devel] [PATCH 09/24] golang/xenlight: define MsVmGenid " Nick Rosbrook
2019-11-13 16:20   ` George Dunlap
2019-10-07 15:12 ` [Xen-devel] [PATCH 10/24] golang/xenlight: define EvLink builtin as empty struct Nick Rosbrook
2019-11-13 16:23   ` George Dunlap
2019-10-07 15:12 ` [Xen-devel] [PATCH 11/24] golang/xenlight: define CpuidPolicyList builtin type Nick Rosbrook
2019-11-13 17:34   ` George Dunlap
2019-11-14 14:58     ` Nick Rosbrook
2019-11-14 17:44       ` George Dunlap
2019-11-15 15:26         ` Nick Rosbrook
2019-11-15 15:42           ` George Dunlap
2019-11-15 15:51             ` Nick Rosbrook
2019-11-15 15:58               ` George Dunlap
2019-11-15 16:06                 ` Nick Rosbrook
2019-10-07 15:12 ` [Xen-devel] [PATCH 12/24] golang/xenlight: re-factor Uuid type implementation Nick Rosbrook
2019-11-13 17:47   ` George Dunlap
2019-10-07 15:13 ` [Xen-devel] [PATCH 13/24] golang/xenlight: re-factor Hwcap " Nick Rosbrook
2019-11-13 17:58   ` George Dunlap
2019-10-07 15:13 ` [Xen-devel] [PATCH 14/24] golang/xenlight: generate structs from the IDL Nick Rosbrook
2019-11-14 14:18   ` George Dunlap
2019-11-14 16:15     ` Nick Rosbrook
2019-10-07 15:13 ` [Xen-devel] [PATCH 15/24] golang/xenlight: remove no-longer used type MemKB Nick Rosbrook
2019-11-14 14:18   ` George Dunlap
2019-10-07 15:13 ` [Xen-devel] [PATCH 16/24] golang/xenlight: begin C to Go type marshaling Nick Rosbrook
2019-10-07 15:13 ` [Xen-devel] [PATCH 17/24] golang/xenlight: implement keyed union C to Go marshaling Nick Rosbrook
2019-10-07 15:13 ` [Xen-devel] [PATCH 18/24] golang/xenlight: implement array " Nick Rosbrook
2019-10-07 15:13 ` [Xen-devel] [PATCH 19/24] golang/xenlight: begin Go to C type marshaling Nick Rosbrook
2019-10-07 15:13 ` [Xen-devel] [PATCH 20/24] golang/xenlight: implement keyed union Go to C marshaling Nick Rosbrook
2019-10-07 15:13 ` [Xen-devel] [PATCH 21/24] golang/xenlight: implement array " Nick Rosbrook
2019-10-07 15:13 ` [Xen-devel] [PATCH 22/24] golang/xenlight: revise use of Context type Nick Rosbrook
2019-10-07 15:13 ` [Xen-devel] [PATCH 23/24] golang/xenlight: add error return type to Context.Cpupoolinfo Nick Rosbrook
2019-10-07 15:13 ` [Xen-devel] [PATCH 24/24] golang/xenlight: add make target for generated files Nick Rosbrook
2019-10-24 14:26   ` George Dunlap [this message]
2019-10-24 18:49     ` Nick Rosbrook
2019-11-14 17:19       ` George Dunlap

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=52866b46-6da0-9d89-8c77-0ac4ceb7b689@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=kerriganb@ainfosec.com \
    --cc=rosbrookn@ainfosec.com \
    --cc=rosbrookn@gmail.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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).