git: d592a0f851d5 - main - Mk/Uses/go.mk: Do not insist on always pulling go.mod and distfile from GOPROXY
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 04 May 2022 12:31:08 UTC
The branch main has been updated by dmgk:
URL: https://cgit.FreeBSD.org/ports/commit/?id=d592a0f851d5e09f08eb62f0e7342b3cc69d9ad1
commit d592a0f851d5e09f08eb62f0e7342b3cc69d9ad1
Author: Dmitri Goutnik <dmgk@FreeBSD.org>
AuthorDate: 2022-05-04 12:12:06 +0000
Commit: Dmitri Goutnik <dmgk@FreeBSD.org>
CommitDate: 2022-05-04 12:30:23 +0000
Mk/Uses/go.mk: Do not insist on always pulling go.mod and distfile from GOPROXY
Some Go packages are not listed on pkg.go.dev (usually because their
versioning scheme does not satisfy Go requirements) and, as a
consequence, are not accessible through proxy.golang.org.
Instead of resorting to hacks with pseudo-versions and/or enumerating
dependencies manually with modules2tuple, support fetching go.mod and
distfile from the usual places using DISTFILES mechanism. This will
allow bypassing GOPROXY for go.mod and the distribution archive, but
will still use it for fetching dependencies (with GO_MODULE).
---
Mk/Uses/go.mk | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk
index 034416dda1c1..d77c78c63b84 100644
--- a/Mk/Uses/go.mk
+++ b/Mk/Uses/go.mk
@@ -120,14 +120,16 @@ GO_ENV+= GOPATH="${GO_GOPATH}" \
GOSUMDB=${GO_GOSUMDB}
. if defined(GO_MODULE)
GO_MODNAME= ${GO_MODULE:C/^([^@]*)(@([^@]*)?)/\1/}
+. if empty(DISTFILES:Mgo.mod*)
GO_MODVERSION= ${GO_MODULE:C/^([^@]*)(@([^@]*)?)/\2/:M@*:S/^@//:S/^$/${DISTVERSIONFULL}/}
GO_MODFILE= ${GO_MODVERSION}.mod
GO_DISTFILE= ${GO_MODVERSION}.zip
-DIST_SUBDIR= go/${PKGORIGIN:S,/,_,g}/${DISTNAME}
MASTER_SITES+= ${GO_GOPROXY}/${GO_MODNAME:C/([A-Z])/!\1/g:tl}/@v/
DISTFILES+= ${GO_MODFILE} ${GO_DISTFILE}
EXTRACT_ONLY+= ${GO_DISTFILE}
WRKSRC= ${WRKDIR}/${GO_MODNAME}@${GO_MODVERSION}
+. endif
+DIST_SUBDIR= go/${PKGORIGIN:S,/,_,g}/${DISTNAME}
FETCH_DEPENDS+= ${GO_CMD}:${GO_PORT} \
ca_root_nss>0:security/ca_root_nss
USES+= zip