Hilko Bengen
2013-Dec-12 23:00 UTC
[Libguestfs] [PATCH 1/2] golang: Fix for out-of-tree builds
--- configure.ac | 2 +- golang/Makefile.am | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4e2bc65..9abec95 100644 --- a/configure.ac +++ b/configure.ac @@ -1530,7 +1530,7 @@ AS_IF([test "x$enable_golang" != "xno"],[ AC_CHECK_PROG([GOLANG],[go],[go],[no]) AS_IF([test "x$GOLANG" != "xno"],[ AC_MSG_CHECKING([if $GOLANG is usable]) - AS_IF([$GOLANG run golang/config-test.go 2>&AS_MESSAGE_LOG_FD],[ + AS_IF([$GOLANG run $srcdir/golang/config-test.go 2>&AS_MESSAGE_LOG_FD],[ AC_MSG_RESULT([yes]) # Substitute some golang environment. diff --git a/golang/Makefile.am b/golang/Makefile.am index a7dd1b2..a60c9ba 100644 --- a/golang/Makefile.am +++ b/golang/Makefile.am @@ -44,6 +44,7 @@ golangpkg_DATA = \ pkg/$(GOOS)_$(GOARCH)/$(pkg).a pkg/$(GOOS)_$(GOARCH)/$(pkg).a: src/$(pkg)/guestfs.go + -[ $(srcdir) != $(builddir) ] && cp -rsu $(abs_srcdir)/src $(builddir)/src $(top_builddir)/run $(GOLANG) install $(pkg) golangsrc_DATA = $(source_files) @@ -57,4 +58,5 @@ endif CLEANFILES = *~ src/$(pkg)/*~ clean-local: + -[ $(srcdir) != $(builddir) ] && rm -rf $(builddir)/src rm -rf pkg -- 1.8.5.1
Hilko Bengen
2013-Dec-12 23:00 UTC
[Libguestfs] [PATCH 2/2] golang: Don't run launch test if appliance has not been built.
--- golang/Makefile.am | 7 ++++++- golang/src/libguestfs.org/guestfs/guestfs_100_launch_test.go | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/golang/Makefile.am b/golang/Makefile.am index a60c9ba..f59488e 100644 --- a/golang/Makefile.am +++ b/golang/Makefile.am @@ -37,6 +37,11 @@ EXTRA_DIST = \ if HAVE_GOLANG +GOFLAGS +if ENABLE_APPLIANCE +GOFLAGS += -tags appliance +endif + golangpkgdir = $(GOROOT)/pkg/$(GOOS)_$(GOARCH)/$(pkg) golangsrcdir = $(GOROOT)/src/pkg/$(pkg) @@ -49,7 +54,7 @@ pkg/$(GOOS)_$(GOARCH)/$(pkg).a: src/$(pkg)/guestfs.go golangsrc_DATA = $(source_files) -TESTS_ENVIRONMENT = pkg=$(pkg) $(top_builddir)/run $(VG) # --test +TESTS_ENVIRONMENT = pkg=$(pkg) GOFLAGS="$(GOFLAGS)" $(top_builddir)/run $(VG) # --test TESTS = run-bindtests run-tests diff --git a/golang/src/libguestfs.org/guestfs/guestfs_100_launch_test.go b/golang/src/libguestfs.org/guestfs/guestfs_100_launch_test.go index cddc42d..9511819 100644 --- a/golang/src/libguestfs.org/guestfs/guestfs_100_launch_test.go +++ b/golang/src/libguestfs.org/guestfs/guestfs_100_launch_test.go @@ -1,3 +1,5 @@ +// +build appliance + /* libguestfs Go tests * Copyright (C) 2013 Red Hat Inc. * -- 1.8.5.1
Richard W.M. Jones
2013-Dec-13 08:32 UTC
Re: [Libguestfs] [PATCH 1/2] golang: Fix for out-of-tree builds
On Fri, Dec 13, 2013 at 12:00:12AM +0100, Hilko Bengen wrote:> --- > configure.ac | 2 +- > golang/Makefile.am | 2 ++ > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/configure.ac b/configure.ac > index 4e2bc65..9abec95 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -1530,7 +1530,7 @@ AS_IF([test "x$enable_golang" != "xno"],[ > AC_CHECK_PROG([GOLANG],[go],[go],[no]) > AS_IF([test "x$GOLANG" != "xno"],[ > AC_MSG_CHECKING([if $GOLANG is usable]) > - AS_IF([$GOLANG run golang/config-test.go 2>&AS_MESSAGE_LOG_FD],[ > + AS_IF([$GOLANG run $srcdir/golang/config-test.go 2>&AS_MESSAGE_LOG_FD],[ > AC_MSG_RESULT([yes]) > > # Substitute some golang environment.ACK ^^^ to the above part. I think the vvv below part is a hack and we shouldn't put it upstream. I appreciate how complicated Go packaging is, as it defies proper distro packaging, but I still don't want to take this.> diff --git a/golang/Makefile.am b/golang/Makefile.am > index a7dd1b2..a60c9ba 100644 > --- a/golang/Makefile.am > +++ b/golang/Makefile.am > @@ -44,6 +44,7 @@ golangpkg_DATA = \ > pkg/$(GOOS)_$(GOARCH)/$(pkg).a > > pkg/$(GOOS)_$(GOARCH)/$(pkg).a: src/$(pkg)/guestfs.go > + -[ $(srcdir) != $(builddir) ] && cp -rsu $(abs_srcdir)/src $(builddir)/src > $(top_builddir)/run $(GOLANG) install $(pkg) > > golangsrc_DATA = $(source_files) > @@ -57,4 +58,5 @@ endif > CLEANFILES = *~ src/$(pkg)/*~ > > clean-local: > + -[ $(srcdir) != $(builddir) ] && rm -rf $(builddir)/src > rm -rf pkg > -- > 1.8.5.1 > > _______________________________________________ > Libguestfs mailing list > Libguestfs@redhat.com > https://www.redhat.com/mailman/listinfo/libguestfsRich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
Richard W.M. Jones
2013-Dec-13 08:32 UTC
Re: [Libguestfs] [PATCH 2/2] golang: Don't run launch test if appliance has not been built.
On Fri, Dec 13, 2013 at 12:00:13AM +0100, Hilko Bengen wrote:> --- > golang/Makefile.am | 7 ++++++- > golang/src/libguestfs.org/guestfs/guestfs_100_launch_test.go | 2 ++ > 2 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/golang/Makefile.am b/golang/Makefile.am > index a60c9ba..f59488e 100644 > --- a/golang/Makefile.am > +++ b/golang/Makefile.am > @@ -37,6 +37,11 @@ EXTRA_DIST = \ > > if HAVE_GOLANG > > +GOFLAGS > +if ENABLE_APPLIANCE > +GOFLAGS += -tags appliance > +endif > + > golangpkgdir = $(GOROOT)/pkg/$(GOOS)_$(GOARCH)/$(pkg) > golangsrcdir = $(GOROOT)/src/pkg/$(pkg) > > @@ -49,7 +54,7 @@ pkg/$(GOOS)_$(GOARCH)/$(pkg).a: src/$(pkg)/guestfs.go > > golangsrc_DATA = $(source_files) > > -TESTS_ENVIRONMENT = pkg=$(pkg) $(top_builddir)/run $(VG) # --test > +TESTS_ENVIRONMENT = pkg=$(pkg) GOFLAGS="$(GOFLAGS)" $(top_builddir)/run $(VG) # --test > > TESTS = run-bindtests run-tests > > diff --git a/golang/src/libguestfs.org/guestfs/guestfs_100_launch_test.go b/golang/src/libguestfs.org/guestfs/guestfs_100_launch_test.go > index cddc42d..9511819 100644 > --- a/golang/src/libguestfs.org/guestfs/guestfs_100_launch_test.go > +++ b/golang/src/libguestfs.org/guestfs/guestfs_100_launch_test.go > @@ -1,3 +1,5 @@ > +// +build appliance > + > /* libguestfs Go tests > * Copyright (C) 2013 Red Hat Inc. > * > -- > 1.8.5.1 > > _______________________________________________ > Libguestfs mailing list > Libguestfs@redhat.com > https://www.redhat.com/mailman/listinfo/libguestfsACK. Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Hilko Bengen
2013-Dec-13 17:53 UTC
Re: [Libguestfs] [PATCH 1/2] golang: Fix for out-of-tree builds
* Richard W.M. Jones:> I think the vvv below part is a hack and we shouldn't put it upstream. > I appreciate how complicated Go packaging is, as it defies proper > distro packaging, but I still don't want to take this.This is what we do for the Perl bindings in hivex... ,----[ hivex/perl/Makefile.am ] | Makefile-pl: Makefile.PL | -[ $(srcdir) != $(builddir) ] && cp -rsu $(abs_srcdir)/. $(builddir)/. | perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS) PREFIX=$(prefix) `---- ... and from what I have seen, the Golang build tool has similarly strong opinions on how project directories should be laid out. What about a simple symlink, like this? ,---- | diff --git a/golang/Makefile.am b/golang/Makefile.am | index 58cafc6..ba13691 100644 | --- a/golang/Makefile.am | +++ b/golang/Makefile.am | @@ -49,6 +49,7 @@ golangpkg_DATA = \ | pkg/$(GOOS)_$(GOARCH)/$(pkg).a | | pkg/$(GOOS)_$(GOARCH)/$(pkg).a: src/$(pkg)/guestfs.go | + -[ $(srcdir) != $(builddir) ] && ln -s $(abs_srcdir)/src $(builddir)/src | $(top_builddir)/run $(GOLANG) install $(pkg) | | golangsrc_DATA = $(source_files) | @@ -62,4 +63,5 @@ endif | CLEANFILES = *~ src/$(pkg)/*~ | | clean-local: | + -[ $(srcdir) != $(builddir) ] && rm -f $(builddir)/src | rm -rf pkg `---- Cheers, -Hilko
Reasonably Related Threads
- [PATCH libnbd v2 0/3] Unfinished golang bindings.
- [PATCH 2/2] golang: Don't run launch test if appliance has not been built.
- [PATCH libnbd v3] Add Go language bindings (golang) (RHBZ#1814538).
- [PATCH libnbd v4] Add Go language bindings (golang) (RHBZ#1814538).
- Re: [PATCH 1/2] golang: Fix for out-of-tree builds