diff options
author | Matt Madison <matt@madison.systems> | 2017-09-14 16:22:30 -0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-21 09:05:50 +0100 |
commit | e1fd36cd6d0c6c70e498980678a71ba042063571 (patch) | |
tree | 123deaa9a78976f7019f2199c51d2f9eda2cddce | |
parent | 6590c03808c0c6728c6fa914c6bfecf72de1e95a (diff) | |
download | poky-e1fd36cd6d0c6c70e498980678a71ba042063571.tar.gz |
go.bbclass: set TMPDIR during compilation
The go build tool creates working directories under
$TMPDIR for all of its processing. Create a directory
under ${WORKDIR} for this and point TMPDIR at it during
compilation, so that systems that have a relatively
small /tmp filesystems can still compile larger Go
packages.
(From OE-Core rev: 5de3de12c70f01753491c46b5622b0d273c3257b)
Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/go.bbclass | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass index 863b578e5c..e167c949ec 100644 --- a/meta/classes/go.bbclass +++ b/meta/classes/go.bbclass | |||
@@ -61,6 +61,8 @@ GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/" | |||
61 | 61 | ||
62 | B = "${WORKDIR}/build" | 62 | B = "${WORKDIR}/build" |
63 | export GOPATH = "${B}" | 63 | export GOPATH = "${B}" |
64 | GO_TMPDIR ?= "${WORKDIR}/go-tmp" | ||
65 | GO_TMPDIR[vardepvalue] = "" | ||
64 | 66 | ||
65 | python go_do_unpack() { | 67 | python go_do_unpack() { |
66 | src_uri = (d.getVar('SRC_URI') or "").split() | 68 | src_uri = (d.getVar('SRC_URI') or "").split() |
@@ -97,14 +99,17 @@ go_do_configure() { | |||
97 | } | 99 | } |
98 | 100 | ||
99 | go_do_compile() { | 101 | go_do_compile() { |
102 | export TMPDIR="${GO_TMPDIR}" | ||
100 | ${GO} env | 103 | ${GO} env |
101 | if [ -n "${GO_INSTALL}" ]; then | 104 | if [ -n "${GO_INSTALL}" ]; then |
102 | ${GO} install ${GO_LINKSHARED} ${GOBUILDFLAGS} `go_list_packages` | 105 | ${GO} install ${GO_LINKSHARED} ${GOBUILDFLAGS} `go_list_packages` |
103 | fi | 106 | fi |
104 | } | 107 | } |
108 | do_compile[dirs] =+ "${GO_TMPDIR}" | ||
105 | do_compile[cleandirs] = "${B}/bin ${B}/pkg" | 109 | do_compile[cleandirs] = "${B}/bin ${B}/pkg" |
106 | 110 | ||
107 | do_compile_ptest() { | 111 | do_compile_ptest() { |
112 | export TMPDIR="${GO_TMPDIR}" | ||
108 | rm -f ${B}/.go_compiled_tests.list | 113 | rm -f ${B}/.go_compiled_tests.list |
109 | go_list_package_tests | while read pkg; do | 114 | go_list_package_tests | while read pkg; do |
110 | cd ${B}/src/$pkg | 115 | cd ${B}/src/$pkg |
@@ -113,6 +118,7 @@ do_compile_ptest() { | |||
113 | sed -e's,/\./,/,'>> ${B}/.go_compiled_tests.list | 118 | sed -e's,/\./,/,'>> ${B}/.go_compiled_tests.list |
114 | done | 119 | done |
115 | } | 120 | } |
121 | do_compile_ptest_base[dirs] =+ "${GO_TMPDIR}" | ||
116 | 122 | ||
117 | go_do_install() { | 123 | go_do_install() { |
118 | install -d ${D}${libdir}/go/src/${GO_IMPORT} | 124 | install -d ${D}${libdir}/go/src/${GO_IMPORT} |