Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Mar 2020 13:30:33 +0000 (UTC)
From:      Dmitri Goutnik <dmgk@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r528031 - head/Mk/Uses
Message-ID:  <202003081330.028DUXYo025471@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dmgk
Date: Sun Mar  8 13:30:32 2020
New Revision: 528031
URL: https://svnweb.freebsd.org/changeset/ports/528031

Log:
  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

Modified:
  head/Mk/Uses/go.mk

Modified: head/Mk/Uses/go.mk
==============================================================================
--- head/Mk/Uses/go.mk	Sun Mar  8 12:24:16 2020	(r528030)
+++ head/Mk/Uses/go.mk	Sun Mar  8 13:30:32 2020	(r528031)
@@ -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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003081330.028DUXYo025471>