[gnome-continuous-yocto/gnomeostree-3.28-rocko: 7648/8267] go.bbclass: add GO_INSTALL_FILTEROUT variable
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 7648/8267] go.bbclass: add GO_INSTALL_FILTEROUT variable
- Date: Sun, 17 Dec 2017 06:32:35 +0000 (UTC)
commit 245285e3be5996aa05542c52786cbb097e61f2d9
Author: Matt Madison <matt@madison.systems>
Date: Fri Sep 8 18:04:42 2017 -0300
go.bbclass: add GO_INSTALL_FILTEROUT variable
When using the Go 'vendor' mechanism to bring in
dependencies for a Go package, the default GO_INSTALL
setting, which uses the '...' wildcard, will include
the vendored packages in the build, which produces
incorrect results.
There are also some Go packages that are structured
poorly, so that the '...' wildcard results in building
example or test code that should not be included in
the build, or fail to build.
This patch adds a mechanism for filtering out a
subset of the sources. It defaults to filtering
out everything under the 'vendor' subdirectory
under package's main directory, which is the
normal location for vendored packages, but can
be overridden by a recipe to filter out other
subdirectories, if needed.
(From OE-Core rev: 9819353726d85780546158428bd97a253705017d)
Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio ossystems com br>
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
meta/classes/go.bbclass | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index c1ef01f..cb1e96d 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -52,6 +52,7 @@ FILES_${PN}-staticdev += "${GOSRC_FINAL}/${GO_IMPORT}"
FILES_${PN}-staticdev += "${GOPKG_FINAL}/${GO_IMPORT}*"
GO_INSTALL ?= "${GO_IMPORT}/..."
+GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
B = "${WORKDIR}/build"
@@ -73,6 +74,11 @@ python go_do_unpack() {
raise bb.build.FuncFailed(e)
}
+go_list_packages() {
+ GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go list -f '{{.ImportPath}}' ${GOBUILDFLAGS}
${GO_INSTALL} | \
+ egrep -v '${GO_INSTALL_FILTEROUT}'
+}
+
go_do_configure() {
ln -snf ${S}/src ${B}/
}
@@ -80,7 +86,7 @@ go_do_configure() {
go_do_compile() {
GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go env
if [ -n "${GO_INSTALL}" ]; then
- GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install ${GOBUILDFLAGS} ${GO_INSTALL}
+ GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install ${GOBUILDFLAGS} `go_list_packages`
fi
}
do_compile[cleandirs] = "${B}/bin ${B}/pkg"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]