Skip to contentSkip to conversation

golang/xenlight: Move to an entirely external repo

PATCH In review George Dunlap 3 participants 6 messages Sep 4, 2020 – Sep 9, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 golang/xenlight: Move to an entirely external repo

Remove all go files and generation targets.

Add a convenience macro to build the package from staging. This isn't really meant to be called directly; rather, it's meant to be called from a corresponding build target inside the external xenlight package repo.

---
CC: Nick Rosbrook <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>

---
 tools/Makefile                       |    5 +-
 tools/golang/xenlight/LICENSE        |  502 ----
 tools/golang/xenlight/Makefile       |   36 +-
 tools/golang/xenlight/README.md      |   28 -
 tools/golang/xenlight/gengotypes.py  |  738 -----
 tools/golang/xenlight/go.mod         |    3 -
 tools/golang/xenlight/helpers.gen.go | 4182 --------------------------
 tools/golang/xenlight/types.gen.go   | 1194 --------
 tools/golang/xenlight/xenlight.go    | 1273 --------
 9 files changed, 10 insertions(+), 7951 deletions(-)
 delete mode 100644 tools/golang/xenlight/LICENSE
 delete mode 100644 tools/golang/xenlight/README.md
 delete mode 100644 tools/golang/xenlight/gengotypes.py
 delete mode 100644 tools/golang/xenlight/go.mod
 delete mode 100644 tools/golang/xenlight/helpers.gen.go
 delete mode 100644 tools/golang/xenlight/types.gen.go
 delete mode 100644 tools/golang/xenlight/xenlight.go
tools/Makefile +2 -3
index 198b239edc..f24d7b6f74 100644
@@ -31,7 +31,6 @@ endif
 
 SUBDIRS-y += xenpmd
 SUBDIRS-y += libxl
-SUBDIRS-$(CONFIG_GOLANG) += golang
 SUBDIRS-y += xl
 SUBDIRS-y += helpers
 SUBDIRS-$(CONFIG_X86) += xenpaging
@@ -113,7 +112,7 @@ endif
 #    Pull to the most recent update (as if you had checked it out for the
 #    first time)
 #  subdir-all-${target}-dir
-#    Do "make all" for ${target}, including all prerequisites (such as 
+#    Do "make all" for ${target}, including all prerequisites (such as
 #    configure)
 #  subdir-install-${target}-dir
 #    Do "make install" for $TARGET
@@ -126,7 +125,7 @@ endif
 #  ${target}-dir-remote
 #    Where remote repositories are cloned
 #  ${target}
-#    Where a copy of the source files are put when building a source 
+#    Where a copy of the source files are put when building a source
 #    tarball for release
 #
 # Expected variables:
tools/golang/xenlight/LICENSE deleted +0 -502

502 lines not on this page · raw message

tools/golang/xenlight/Makefile +8 -28
index b17095e64b..271cd7f595 100644
@@ -1,43 +1,23 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-# Standing boldly against convention, we insist on installing the
-# package source under $(prefix)/share/gocode
-GOCODE_DIR ?= $(prefix)/share/gocode/
-GOXL_INSTALL_DIR = $(GOCODE_DIR)/src/$(XEN_GOCODE_URL)/xenlight/
-
 GO ?= go
 
-LIBXL_SRC_DIR = ../../libxl
-
-.PHONY: all
 all: build
 
-GOXL_GEN_FILES = types.gen.go helpers.gen.go
-
-%.gen.go: gengotypes.py $(LIBXL_SRC_DIR)/libxl_types.idl $(LIBXL_SRC_DIR)/idl.py
-	XEN_ROOT=$(XEN_ROOT) $(PYTHON) gengotypes.py $(LIBXL_SRC_DIR)/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.
-#
-# NB that because the users of this library need to be able to
-# recompile the library from source, it needs to include '-lxenlight'
-# in the LDFLAGS; and thus we need to add -L$(XEN_libxenlight) here
-# so that it can find the actual library.
 .PHONY: build
-build: xenlight.go $(GOXL_GEN_FILES)
-	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog)" CGO_LDFLAGS="$(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -L$(XEN_libxenlight) -L$(XEN_libxentoollog)" $(GO) build -x
+build:
+	if test -z "$(XENLIGHT_PKG_DIR)" ; then \
+		echo Please set XENLIGHT_PKG_DIR to the directory containing xenlight package files ; \
+		false ; \
+	fi
+	cd $(XENLIGHT_PKG_DIR) && CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog)" CGO_LDFLAGS="$(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -L$(XEN_libxenlight) -L$(XEN_libxentoollog)" $(GO) build -x
 
 .PHONY: install
-install: build
-	$(INSTALL_DIR) $(DESTDIR)$(GOXL_INSTALL_DIR)
-	$(INSTALL_DATA) xenlight.go $(DESTDIR)$(GOXL_INSTALL_DIR)
-	$(INSTALL_DATA) types.gen.go $(DESTDIR)$(GOXL_INSTALL_DIR)
-	$(INSTALL_DATA) helpers.gen.go $(DESTDIR)$(GOXL_INSTALL_DIR)
+install:
 
 .PHONY: uninstall
-	rm -rf $(DESTDIR)$(GOXL_INSTALL_DIR)
+uninstall:
 
 .PHONY: clean
 clean:
tools/golang/xenlight/README.md deleted +0 -28
deleted file mode 100644
index a423a5600a..0000000000
@@ -1,28 +0,0 @@
-# xenlight
-
-## About
-
-The xenlight package provides Go bindings to Xen's libxl C library via cgo.
-The package is currently in an unstable "experimental" state. This means
-the package is ready for initial use and evaluation, but is not yet fully
-functional. Namely, only a subset of libxl's API is implemented, and
-breaking changes may occur in future package versions.
-
-Much of the package is generated using the libxl IDL. Changes to the
-generated code can be made by modifying `tools/golang/xenlight/gengotypes.py`
-in the xen.git tree.
-
-## Getting Started
-
-```go
-import (
-        "xenbits.xenproject.org/git-http/xen.git/tools/golang/xenlight"
-)
-```
-
-The module is not yet tagged independently of xen.git; if you don’t specify
-the version, you’ll get the most recent development version, which is
-probably not what you want. A better option would be to specify a Xen
-release tag; for instance:
-
-    go get xenbits.xenproject.org/git-http/xen.git/tools/golang/[email protected].
tools/golang/xenlight/gengotypes.py deleted +0 -738

738 lines not on this page · raw message

tools/golang/xenlight/go.mod deleted +0 -3
deleted file mode 100644
index 7dfbd758d1..0000000000
@@ -1,3 +0,0 @@
-module xenbits.xenproject.org/git-http/xen.git/tools/golang/xenlight
-
-go 1.11
tools/golang/xenlight/helpers.gen.go deleted +0 -4182

1,655 lines not on this page · raw message

tools/golang/xenlight/types.gen.go deleted +0 -1194

1,194 lines not on this page · raw message

tools/golang/xenlight/xenlight.go deleted +0 -1273

1,273 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.25.1

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 53 lines · George Dunlap

Remove all go files and generation targets.

Add a convenience macro to build the package from staging. This isn't really meant to be called directly; rather, it's meant to be called from a corresponding build target inside the external xenlight package repo.

---
CC: Nick Rosbrook <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>

---
 tools/Makefile                       |    5 +-
 tools/golang/xenlight/LICENSE        |  502 ----
 tools/golang/xenlight/Makefile       |   36 +-
 tools/golang/xenlight/README.md      |   28 -
 tools/golang/xenlight/gengotypes.py  |  738 -----
 tools/golang/xenlight/go.mod         |    3 -
 tools/golang/xenlight/helpers.gen.go | 4182 --------------------------
 tools/golang/xenlight/types.gen.go   | 1194 --------
 tools/golang/xenlight/xenlight.go    | 1273 --------
 9 files changed, 10 insertions(+), 7951 deletions(-)
 delete mode 100644 tools/golang/xenlight/LICENSE
 delete mode 100644 tools/golang/xenlight/README.md
 delete mode 100644 tools/golang/xenlight/gengotypes.py
 delete mode 100644 tools/golang/xenlight/go.mod
 delete mode 100644 tools/golang/xenlight/helpers.gen.go
 delete mode 100644 tools/golang/xenlight/types.gen.go
 delete mode 100644 tools/golang/xenlight/xenlight.go
tools/Makefile +1 -2
index 198b239edc..f24d7b6f74 100644
@@ -31,7 +31,6 @@ endif
 
 SUBDIRS-y += xenpmd
 SUBDIRS-y += libxl
-SUBDIRS-$(CONFIG_GOLANG) += golang
 SUBDIRS-y += xl
 SUBDIRS-y += helpers
 SUBDIRS-$(CONFIG_X86) += xenpaging
@@ -113,7 +112,7 @@ endif
 #    Pull to the most recent update (as if you had checked it out for the
 #    first time)
 #  subdir-all-${target}-dir
-#    Do "make all" for ${target}, including all prerequisites (such as 
+#    Do "make all" for ${target}, including all prerequisites (such as
 #    configure)
 #  subdir-install-${target}-dir
 #    Do "make install" for $TARGET

tools/Makefile endif · line 128

Quoted 5 lines
tools/Makefile +1 -1
@@ -126,7 +125,7 @@ endif
 #  ${target}-dir-remote
 #    Where remote repositories are cloned
 #  ${target}
-#    Where a copy of the source files are put when building a source 
+#    Where a copy of the source files are put when building a source

Unrelated changes here?

Wei.

#2 lore raw
Quoted 57 lines · Wei Liu
Quoted 52 lines · George Dunlap

Remove all go files and generation targets.

Add a convenience macro to build the package from staging. This isn't really meant to be called directly; rather, it's meant to be called from a corresponding build target inside the external xenlight package repo.

---
CC: Nick Rosbrook <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
---

tools/Makefile                       |    5 +-
tools/golang/xenlight/LICENSE        |  502 ----
tools/golang/xenlight/Makefile       |   36 +-
tools/golang/xenlight/README.md      |   28 -
tools/golang/xenlight/gengotypes.py  |  738 -----
tools/golang/xenlight/go.mod         |    3 -
tools/golang/xenlight/helpers.gen.go | 4182 --------------------------
tools/golang/xenlight/types.gen.go   | 1194 --------
tools/golang/xenlight/xenlight.go    | 1273 --------
9 files changed, 10 insertions(+), 7951 deletions(-)

delete mode 100644 tools/golang/xenlight/LICENSE delete mode 100644 tools/golang/xenlight/README.md delete mode 100644 tools/golang/xenlight/gengotypes.py delete mode 100644 tools/golang/xenlight/go.mod delete mode 100644 tools/golang/xenlight/helpers.gen.go delete mode 100644 tools/golang/xenlight/types.gen.go delete mode 100644 tools/golang/xenlight/xenlight.go

tools/Makefile +0 -0
index 198b239edc..f24d7b6f74 100644
@@ -31,7 +31,6 @@ endif
 

SUBDIRS-y += xenpmd
SUBDIRS-y += libxl
-SUBDIRS-$(CONFIG_GOLANG) += golang
SUBDIRS-y += xl
SUBDIRS-y += helpers
SUBDIRS-$(CONFIG_X86) += xenpaging

tools/Makefile +1 -1
@@ -113,7 +112,7 @@ endif
 #    Pull to the most recent update (as if you had checked it out for the
 #    first time)
 #  subdir-all-${target}-dir
-#    Do "make all" for ${target}, including all prerequisites (such as 
+#    Do "make all" for ${target}, including all prerequisites (such as
 #    configure)
 #  subdir-install-${target}-dir
 #    Do "make install" for $TARGET
Quoted 8 lines

tools/Makefile endif · line 128

Quoted 6 lines
tools/Makefile +1 -1
@@ -126,7 +125,7 @@ endif
 #  ${target}-dir-remote
 #    Where remote repositories are cloned
 #  ${target}
-#    Where a copy of the source files are put when building a source 
+#    Where a copy of the source files are put when building a source

Unrelated changes here?

Trailing whitespace deletion, done automatically by my editor on save. I probably should have mentioned them in the commit message, but I don’t think it’s worth removing them or moving them to another patch.

-George

#3 lore raw
In reply to George Dunlap
Quoted 8 lines · George Dunlap

Remove all go files and generation targets.

Add a convenience macro to build the package from staging. This isn't really meant to be called directly; rather, it's meant to be called from a corresponding build target inside the external xenlight package repo.

Does this make our move to gitlab.com/xen-project/go-xen official? I wasn't expecting this to be so soon. But, if you're satisifed with what you've learned from working on the experimental repo/module, I guess I'm not opposed. I would like to know the rest of the details though.

Thanks,
-NR

#4 lore raw
Quoted 12 lines · Nick Rosbrook
Quoted 7 lines · George Dunlap

Remove all go files and generation targets.

Add a convenience macro to build the package from staging. This isn't really meant to be called directly; rather, it's meant to be called from a corresponding build target inside the external xenlight package repo.

Quoted 6 lines
Quoted 1 line

Does this make our move to gitlab.com/xen-project/go-xen official? I wasn't expecting this to be so soon. But, if you're satisifed with what you've learned from working on the experimental repo/module, I guess I'm not opposed. I would like to know the rest of the details though.

All patches to the list are proposals — nothing is official until it’s been checked in; and I haven’t checked, but since nobody has Acked it, it certainly *shouldn’t* have been checked in yet. :-)

So, feel free to give feedback or ask whatever details you think need to be ironed out. That’s what this thread is for.

There’s certainly no issue with waiting to delete the code in-tree; but I wouldn’t be a fan of developing in both places at once and keeping things in sync. (I could be convinced if you thought that was important.) I’d prefer just to develop in the external tree, and if for some reason we decide that doesn’t work, importing the changes back into xen.git.

-George

Acked-by
#5 lore raw
Quoted 19 lines · George Dunlap
Quoted 12 lines · Nick Rosbrook
Quoted 7 lines · George Dunlap

Remove all go files and generation targets.

Add a convenience macro to build the package from staging. This isn't really meant to be called directly; rather, it's meant to be called from a corresponding build target inside the external xenlight package repo.

Quoted 6 lines
Quoted 1 line

Does this make our move to gitlab.com/xen-project/go-xen official? I wasn't expecting this to be so soon. But, if you're satisifed with what you've learned from working on the experimental repo/module, I guess I'm not opposed. I would like to know the rest of the details though.

Quoted 5 lines

All patches to the list are proposals — nothing is official until it’s been checked in; and I haven’t checked, but since nobody has Acked it, it certainly *shouldn’t* have been checked in yet. :-)

So, feel free to give feedback or ask whatever details you think need to be ironed out. That’s what this thread is for.

There’s certainly no issue with waiting to delete the code in-tree; but I wouldn’t be a fan of developing in both places at once and keeping things in sync. (I could be convinced if you thought that was important.) I’d prefer just to develop in the external tree, and if for some reason we decide that doesn’t work, importing the changes back into xen.git.

That's all I was curious about really. I incorrectly assumed that deleting the code from xen.git would be some big, "permanent" action, so I was just wasn't expecting this already. Your plan makes sense to me. :)