Currently go.port.mk points the port directly at go modules inside
${DISTDIR}. This means that a port can still successfully build even
if MODGO_MODULES / MODGO_MODFILES are missing some required files
and those files are already present in distfiles (e.g. from some
other port).

You can confirm this behaviour by picking a MODGO_MODULES port, "make
fetch", remove some entry from MODGO_MODULES, "make makesum", and try
building. Without the diff you can expect it to succeed unless you
clean distfiles/go_modules.

This diff changes things to copy the exact set of listed files to
a directory tree under WRKDIR and pointing the build there.
Therefore if any files are missing from the list, the build will now fail.

(install -D is used to create any missing directories; far simpler than
splitting the file from directory name using make variable regexps).

OK?

Index: go.port.mk
===================================================================
RCS file: /cvs/ports/lang/go/go.port.mk,v
retrieving revision 1.35
diff -u -p -r1.35 go.port.mk
--- go.port.mk  9 Oct 2020 13:23:51 -0000       1.35
+++ go.port.mk  22 Nov 2020 15:46:13 -0000
@@ -71,7 +71,7 @@ DISTFILES +=  ${MODGO_DIST_SUBDIR}/${_mod
 .  for _modpath _modver in ${MODGO_MODFILES}
 DISTFILES +=   
${MODGO_DIST_SUBDIR}/${_modpath}/@v/${_modver}.mod{${_modpath}/@v/${_modver}.mod}:${MODGO_MASTER_SITESN}
 .  endfor
-MAKE_ENV +=            GOPROXY=file://${DISTDIR}/${MODGO_DIST_SUBDIR}
+MAKE_ENV +=            GOPROXY=file://${WRKDIR}/go_modules
 MAKE_ENV +=            GO111MODULE=on GOPATH="${MODGO_GOPATH}"
 .else
 # ports are not allowed to fetch from the network at build time; point
@@ -105,7 +105,10 @@ WRKSRC ?=          ${MODGO_WORKSPACE}/src/${ALL_
 MODGO_SETUP_WORKSPACE =        mkdir -p ${WRKSRC:H}; mv ${MODGO_SUBDIR} 
${WRKSRC};
 .else
 WRKSRC ?=              ${WRKDIR}/${MODGO_MODNAME}@${MODGO_VERSION}
-MODGO_SETUP_WORKSPACE =        ln -sf ${WRKSRC} ${WRKDIR}/${MODGO_MODNAME}
+MODGO_SETUP_WORKSPACE =        ln -sf ${WRKSRC} ${WRKDIR}/${MODGO_MODNAME};
+.for _MODGO_m in ${DISTFILES:Mgo_modules/*:C/{.*//}
+MODGO_SETUP_WORKSPACE += ${INSTALL} -D ${DISTDIR}/${_MODGO_m} 
${WRKDIR}/${_MODGO_m};
+.endfor
 .endif
 
 INSTALL_STRIP =

Reply via email to