aboutsummaryrefslogtreecommitdiff
path: root/Mk/Uses/go.mk
diff options
context:
space:
mode:
authorDmitri Goutnik <dmgk@FreeBSD.org>2020-03-08 13:30:32 +0000
committerDmitri Goutnik <dmgk@FreeBSD.org>2020-03-08 13:30:32 +0000
commit5f2bc195fefd8d4abdbfc730ccb0fcc798337ba8 (patch)
treea509595620de95ee8c1b7adc58240844832e6cb9 /Mk/Uses/go.mk
parent3d2fe04bc9db3e21b952ce87d7df12173962c0da (diff)
downloadports-5f2bc195fefd8d4abdbfc730ccb0fcc798337ba8.tar.gz
ports-5f2bc195fefd8d4abdbfc730ccb0fcc798337ba8.zip
Mk/Uses/go.mk: Add the gomod-vendor-diff target
Add the 'gomod-vendor-diff' target that tells the user what changes are needed in GH_TUPLE. This is in addition to the existing 'gomod-vendor' target that shows the user the whole new GH_TUPLE. PR: 244660 Submitted by: yuri
Notes
Notes: svn path=/head/; revision=528031
Diffstat (limited to 'Mk/Uses/go.mk')
-rw-r--r--Mk/Uses/go.mk26
1 files changed, 16 insertions, 10 deletions
diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk
index 59c03d880dd7..cd7eb5f40894 100644
--- a/Mk/Uses/go.mk
+++ b/Mk/Uses/go.mk
@@ -176,17 +176,23 @@ do-test:
.if ${go_ARGS:Mmodules}
_MODULES2TUPLE_CMD= modules2tuple
-gomod-vendor: patch
- @if type ${GO_CMD} > /dev/null 2>&1; then \
- if type ${_MODULES2TUPLE_CMD} > /dev/null 2>&1; then \
- cd ${WRKSRC}; ${SETENV} GOPATH=${WRKDIR}/.gopath GOFLAGS=-modcacherw ${GO_CMD} mod vendor; \
- [ -r vendor/modules.txt ] && ${_MODULES2TUPLE_CMD} vendor/modules.txt; \
- else \
- ${ECHO_MSG} "===> Please install \"ports-mgmt/modules2tuple\""; \
- fi \
- else \
- ${ECHO_MSG} "===> Please install \"${GO_PORT}\""; \
+gomod-vendor-deps:
+ @if ! type ${GO_CMD} > /dev/null 2>&1; then \
+ ${ECHO_MSG} "===> Please install \"${GO_PORT}\""; exit 1; \
+ fi; \
+ if ! type ${_MODULES2TUPLE_CMD} > /dev/null 2>&1; then \
+ ${ECHO_MSG} "===> Please install \"ports-mgmt/modules2tuple\""; exit 1; \
fi
+
+gomod-vendor: gomod-vendor-deps patch
+ @cd ${WRKSRC}; ${SETENV} GOPATH=${WRKDIR}/.gopath GOFLAGS=-modcacherw ${GO_CMD} mod vendor; \
+ [ -r vendor/modules.txt ] && ${_MODULES2TUPLE_CMD} vendor/modules.txt
+
+gomod-vendor-diff: gomod-vendor-deps patch
+ @cd ${WRKSRC}; ${SETENV} GOPATH=${WRKDIR}/.gopath GOFLAGS=-modcacherw ${GO_CMD} mod vendor; \
+ [ -r vendor/modules.txt ] && ${_MODULES2TUPLE_CMD} vendor/modules.txt | ${GREP} -v "^GH_TUPLE=" | ${SED} 's| \\$$||' > ${WRKDIR}/GH_TUPLE-new.txt && \
+ echo ${GH_TUPLE} | ${TR} -s " " "\n" | ${SED} "s|^| |" > ${WRKDIR}/GH_TUPLE-old.txt && \
+ ${DIFF} ${WRKDIR}/GH_TUPLE-old.txt ${WRKDIR}/GH_TUPLE-new.txt || exit 0
.endif
.endif # defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_GO_POST_MK)