Sat Jan 23 12:42:57 2016 UTC ()
Made Go packages testable and cleaned up shell commands

Prevented the error message "*** Error 1 (ignored) ***" during installation
by using || instead of &&.

Shell commands are hidden during normal operation.

Go packages can be tested using "bmake test".

ok @bsiegert


(rillig)
diff -r1.7 -r1.8 pkgsrc/lang/go/go-package.mk

cvs diff -r1.7 -r1.8 pkgsrc/lang/go/go-package.mk (expand / switch to unified diff)

--- pkgsrc/lang/go/go-package.mk 2015/12/29 21:47:48 1.7
+++ pkgsrc/lang/go/go-package.mk 2016/01/23 12:42:57 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: go-package.mk,v 1.7 2015/12/29 21:47:48 bsiegert Exp $ 1# $NetBSD: go-package.mk,v 1.8 2016/01/23 12:42:57 rillig Exp $
2# 2#
3# This file implements common logic for compiling Go programs in pkgsrc. 3# This file implements common logic for compiling Go programs in pkgsrc.
4# The compiled Go code is tied to a specific compiler version, and the 4# The compiled Go code is tied to a specific compiler version, and the
5# compilation is fast. So the plan is: 5# compilation is fast. So the plan is:
6# 6#
7# 1. Compile everything. 7# 1. Compile everything.
8# 2. Install binaries into bin/. 8# 2. Install binaries into bin/.
9# 3. Install source code and packages into a separate gopkg tree. 9# 3. Install source code and packages into a separate gopkg tree.
10# 10#
11# In the future, we may implement buildlink by creating a separate tree during 11# In the future, we may implement buildlink by creating a separate tree during
12# the build and linking only the packages explicitly mentioned in dependencies 12# the build and linking only the packages explicitly mentioned in dependencies
13# there. 13# there.
14# 14#
@@ -46,23 +46,28 @@ BUILD_DEPENDS+= go-${GO_VERSION}*:../.. @@ -46,23 +46,28 @@ BUILD_DEPENDS+= go-${GO_VERSION}*:../..
46 46
47MAKE_JOBS_SAFE= no 47MAKE_JOBS_SAFE= no
48INSTALLATION_DIRS+= bin gopkg 48INSTALLATION_DIRS+= bin gopkg
49USE_TOOLS+= pax 49USE_TOOLS+= pax
50 50
51GO_PLATFORM= ${LOWER_OPSYS}_${GOARCH} 51GO_PLATFORM= ${LOWER_OPSYS}_${GOARCH}
52GOTOOLDIR= ${PREFIX}/go/pkg/tool/${GO_PLATFORM} 52GOTOOLDIR= ${PREFIX}/go/pkg/tool/${GO_PLATFORM}
53 53
54PRINT_PLIST_AWK+= { gsub(/${GO_PLATFORM}/, \ 54PRINT_PLIST_AWK+= { gsub(/${GO_PLATFORM}/, \
55 "$${GO_PLATFORM}"); \ 55 "$${GO_PLATFORM}"); \
56 print; next; } 56 print; next; }
57 57
58post-extract: 58post-extract:
59 ${MKDIR} ${WRKSRC} 59 ${RUN} ${MKDIR} ${WRKSRC}
60 ${RM} -fr ${WRKDIR}/`basename ${GO_DIST_BASE}`/.hg 60 ${RUN} ${RM} -fr ${WRKDIR}/`basename ${GO_DIST_BASE}`/.hg
61 ${MV} ${WRKDIR}/`basename ${GO_DIST_BASE}`/* ${WRKSRC} 61 ${RUN} ${MV} ${WRKDIR}/`basename ${GO_DIST_BASE}`/* ${WRKSRC}
62 62
63do-build: 63do-build:
64 env GOPATH=${WRKDIR}:${BUILDLINK_DIR}/gopkg go install -v ${GO_BUILD_PATTERN} 64 ${RUN} env GOPATH=${WRKDIR}:${BUILDLINK_DIR}/gopkg go install -v ${GO_BUILD_PATTERN}
 65
 66.if !target(do-test)
 67do-test:
 68 ${RUN} env GOPATH=${WRKDIR}:${BUILDLINK_DIR}/gopkg go test -v ${GO_BUILD_PATTERN}
 69.endif
65 70
66do-install: 71do-install:
67 -cd ${WRKDIR} && [ -d bin ] && ${PAX} -rw bin ${DESTDIR}${PREFIX} 72 ${RUN} cd ${WRKDIR}; [ ! -d bin ] || ${PAX} -rw bin ${DESTDIR}${PREFIX}
68 -cd ${WRKDIR} && [ -d pkg ] && ${PAX} -rw src pkg ${DESTDIR}${PREFIX}/gopkg 73 ${RUN} cd ${WRKDIR}; [ ! -d pkg ] || ${PAX} -rw src pkg ${DESTDIR}${PREFIX}/gopkg