summaryrefslogtreecommitdiffstats
path: root/meta/classes/go.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/go.bbclass')
-rw-r--r--meta/classes/go.bbclass52
1 files changed, 1 insertions, 51 deletions
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index e05a5c641c..f303a15eaf 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -1,4 +1,4 @@
1inherit goarch ptest 1inherit goarch
2 2
3GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}" 3GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}"
4 4
@@ -114,19 +114,6 @@ go_do_compile() {
114do_compile[dirs] =+ "${GOTMPDIR}" 114do_compile[dirs] =+ "${GOTMPDIR}"
115do_compile[cleandirs] = "${B}/bin ${B}/pkg" 115do_compile[cleandirs] = "${B}/bin ${B}/pkg"
116 116
117do_compile_ptest_base() {
118 export TMPDIR="${GOTMPDIR}"
119 rm -f ${B}/.go_compiled_tests.list
120 go_list_package_tests | while read pkg; do
121 cd ${B}/src/$pkg
122 ${GO} test ${GOPTESTBUILDFLAGS} $pkg
123 find . -mindepth 1 -maxdepth 1 -type f -name '*.test' -exec echo $pkg/{} \; | \
124 sed -e's,/\./,/,'>> ${B}/.go_compiled_tests.list
125 done
126 do_compile_ptest
127}
128do_compile_ptest_base[dirs] =+ "${GOTMPDIR}"
129
130go_do_install() { 117go_do_install() {
131 install -d ${D}${libdir}/go/src/${GO_IMPORT} 118 install -d ${D}${libdir}/go/src/${GO_IMPORT}
132 tar -C ${S}/src/${GO_IMPORT} -cf - --exclude-vcs --exclude '*.test' --exclude 'testdata' . | \ 119 tar -C ${S}/src/${GO_IMPORT} -cf - --exclude-vcs --exclude '*.test' --exclude 'testdata' . | \
@@ -139,18 +126,6 @@ go_do_install() {
139 fi 126 fi
140} 127}
141 128
142go_make_ptest_wrapper() {
143 cat >${D}${PTEST_PATH}/run-ptest <<EOF
144#!/bin/sh
145RC=0
146run_test() (
147 cd "\$1"
148 ((((./\$2 ${GOPTESTFLAGS}; echo \$? >&3) | sed -r -e"s,^(PASS|SKIP|FAIL)\$,\\1: \$1/\$2," >&4) 3>&1) | (read rc; exit \$rc)) 4>&1
149 exit \$?)
150EOF
151
152}
153
154go_stage_testdata() { 129go_stage_testdata() {
155 oldwd="$PWD" 130 oldwd="$PWD"
156 cd ${S}/src 131 cd ${S}/src
@@ -165,37 +140,12 @@ go_stage_testdata() {
165 cd "$oldwd" 140 cd "$oldwd"
166} 141}
167 142
168do_install_ptest_base() {
169 test -f "${B}/.go_compiled_tests.list" || exit 0
170 install -d ${D}${PTEST_PATH}
171 go_stage_testdata
172 go_make_ptest_wrapper
173 havetests=""
174 while read test; do
175 testdir=`dirname $test`
176 testprog=`basename $test`
177 install -d ${D}${PTEST_PATH}/$testdir
178 install -m 0755 ${B}/src/$test ${D}${PTEST_PATH}/$test
179 echo "run_test $testdir $testprog || RC=1" >> ${D}${PTEST_PATH}/run-ptest
180 havetests="yes"
181 done < ${B}/.go_compiled_tests.list
182 if [ -n "$havetests" ]; then
183 echo "exit \$RC" >> ${D}${PTEST_PATH}/run-ptest
184 chmod +x ${D}${PTEST_PATH}/run-ptest
185 else
186 rm -rf ${D}${PTEST_PATH}
187 fi
188 do_install_ptest
189 chown -R root:root ${D}${PTEST_PATH}
190}
191
192EXPORT_FUNCTIONS do_unpack do_configure do_compile do_install 143EXPORT_FUNCTIONS do_unpack do_configure do_compile do_install
193 144
194FILES_${PN}-dev = "${libdir}/go/src" 145FILES_${PN}-dev = "${libdir}/go/src"
195FILES_${PN}-staticdev = "${libdir}/go/pkg" 146FILES_${PN}-staticdev = "${libdir}/go/pkg"
196 147
197INSANE_SKIP_${PN} += "ldflags" 148INSANE_SKIP_${PN} += "ldflags"
198INSANE_SKIP_${PN}-ptest += "ldflags"
199 149
200# Add -buildmode=pie to GOBUILDFLAGS to satisfy "textrel" QA checking, but mips 150# Add -buildmode=pie to GOBUILDFLAGS to satisfy "textrel" QA checking, but mips
201# doesn't support -buildmode=pie, so skip the QA checking for mips and its 151# doesn't support -buildmode=pie, so skip the QA checking for mips and its