Skip to contentSkip to conversation

go-cross: don't use host /var/tmp for temporary build artifacts

PATCH In review Mark Asselstine 2 participants 2 messages May 13, 2016 – May 16, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 go-cross: don't use host /var/tmp for temporary build artifacts

The default behavior for go-cross build is to use the path specified in TMPDIR for some temporary build artifacts and if no TMPDIR is set in the environment to fallback to use /var/tmp. This causes a build failure on hosts that do not have a /var/tmp or that have restrictive permissions on /var/tmp. The failure is seen as:

go tool dist: mkdtemp(/var/tmp/go-cbuild-yhmNbi): No such file or directory

By setting TMPDIR and ensuring we create this
directory we can avoid the associated issue with using the default.

---
 recipes-devtools/go-cross/go-cross.inc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
recipes-devtools/go-cross/go-cross.inc +5 -1
index eea1b2c..cd75b40 100644
@@ -17,9 +17,13 @@ CC = "${@d.getVar('BUILD_CC', True).strip()}"
 do_configure[noexec] = "1"
 
 do_compile() {
-    export GOBIN="${B}/bin"
+    export GOBIN="${B}/bin"    
     rm -rf ${GOBIN} ${B}/pkg
     mkdir ${GOBIN}
+
+    export TMPDIR=${WORKDIR}/build-tmp
+    mkdir ${WORKDIR}/build-tmp
+
     cd src
     ./make.bash --host-only
 }
Signature · 1 line
2.1.4
#1 lore raw
Quoted 10 lines · Mark Asselstine

The default behavior for go-cross build is to use the path specified in TMPDIR for some temporary build artifacts and if no TMPDIR is set in the environment to fallback to use /var/tmp. This causes a build failure on hosts that do not have a /var/tmp or that have restrictive permissions on /var/tmp. The failure is seen as:

go tool dist: mkdtemp(/var/tmp/go-cbuild-yhmNbi): No such file or directory

By setting TMPDIR and ensuring we create this
directory we can avoid the associated issue with using the default.

merged.

Bruce

Quoted 26 lines
---
 recipes-devtools/go-cross/go-cross.inc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
recipes-devtools/go-cross/go-cross.inc +5 -1
index eea1b2c..cd75b40 100644
@@ -17,9 +17,13 @@ CC = "${@d.getVar('BUILD_CC', True).strip()}"
 do_configure[noexec] = "1"
 
 do_compile() {
-    export GOBIN="${B}/bin"
+    export GOBIN="${B}/bin"
     rm -rf ${GOBIN} ${B}/pkg
     mkdir ${GOBIN}
+
+    export TMPDIR=${WORKDIR}/build-tmp
+    mkdir ${WORKDIR}/build-tmp
+
     cd src
     ./make.bash --host-only
 }