From nobody Sun Jul 21 06:56:41 2024 X-Original-To: dev-commits-ports-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WRZ2d5l7Zz5QtJB; Sun, 21 Jul 2024 06:56:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WRZ2d4rqgz4ZQq; Sun, 21 Jul 2024 06:56:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721545001; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u23QVbmjohg9MYPjCSrL/p86tr8WQmyy8fG94OmvK2k=; b=Tuqy2jaYYCZ5jxH2uKbdpylFEtzjq2eyJJLZE5yixC7B32PSjIeAQIjTtVSEawJX2HJsnU PsUrxbYc+hq8fOS+rO7snhUY4ErI+bUI9+tofxRKAIfcUzLG73l2/UB67cfK2jZGifmGUM mHm0C6tuoxkrilCz4JRD0ushA+740g1WZ81bXVGfvJh4LsCifwtLXQRC4350hyPFRsI4Yv R54cHs65/rNzC3ZbJVFvnKpF8oPT1nTmvj3r8gNNkMUN/bzMMx9rUHrzf5oPYfbO9lAW+f CcjnTS8ujukIaowgZW9oKWOOxFzNZ2LRX/qKq4dtFdIobJD/NFYjwFTTL0G4iQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721545001; a=rsa-sha256; cv=none; b=HisvvYUjvrDw8RJakAo8XDwuS8UgOeG/hVtIaPZUPcD8/IGMSZZ5yu7sR4GAdRJ5GzSlFG m+u2Lvykvmv4DFXIUvzmWdFGentoV3xohiGVB24QInqov/kodgnWum6i1Xp2zFSJFS0Ke0 8J58mNnMHlqvQzycdPRFmV6fFjcjTo2gur3w5Fy6Nmr1lV3PnPTuPh2+es8lVPYGeYTuE6 F5c5DzoGBMx/vTgaM+P/ZEUsmHAAWEFGeidYyBTto5Jt1Ih9Nt+WoQV/XBTsk5uLADx3Rl fVwR1GpzRd++jP+MlkA+pR7tPIDey3Hm9eqBNC8yf9w4eiJPDOnZSYEcKUgojA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721545001; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u23QVbmjohg9MYPjCSrL/p86tr8WQmyy8fG94OmvK2k=; b=mz0DoIrc08N+VTWWJQKBUVFwAOVq8bKHOvQkVnuG0dAGFdjpvKAv446ohdNLteV0HGEdLY lLIoftwOpbCfkvwxfmWKQ5jf1RvM7tFjost+81bXZyAMdfpQGytiLBWyRSy6fa8FQ/Yt6P M+RNEKoXx/xRHVqPp4mzQodFvxWmY93oMbc3fVfO9Ej5rkiZQqbg/iE5wljVZYbgazrnsq a43iBBgDbLfHORarHQfaFl5+HxancOVNpa2XwUHRMzNNUM9r8aCn0gEmXZWBfG1Ax/WeMz LKoqd1pmi0Gl+ys+xP3MBL/bS0ipBxL/5yiBH1nAIrMgMso3hATovI5AQeWXew== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WRZ2d4CTmzq4M; Sun, 21 Jul 2024 06:56:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46L6ufG4068866; Sun, 21 Jul 2024 06:56:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46L6ufFD068863; Sun, 21 Jul 2024 06:56:41 GMT (envelope-from git) Date: Sun, 21 Jul 2024 06:56:41 GMT Message-Id: <202407210656.46L6ufFD068863@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org From: Matthias Fechner Subject: git: 03194a20aa97 - 2024Q3 - Mk/Uses: go.mk can not load a go.mod from other locations List-Id: Commits to the quarterly branches of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-branches@freebsd.org Sender: owner-dev-commits-ports-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mfechner X-Git-Repository: ports X-Git-Refname: refs/heads/2024Q3 X-Git-Reftype: branch X-Git-Commit: 03194a20aa97ed622bccf2f28fd069b212a720a5 Auto-Submitted: auto-generated The branch 2024Q3 has been updated by mfechner: URL: https://cgit.FreeBSD.org/ports/commit/?id=03194a20aa97ed622bccf2f28fd069b212a720a5 commit 03194a20aa97ed622bccf2f28fd069b212a720a5 Author: Matthias Fechner AuthorDate: 2024-06-19 09:15:30 +0000 Commit: Matthias Fechner CommitDate: 2024-07-21 05:38:36 +0000 Mk/Uses: go.mk can not load a go.mod from other locations Not all projects are providing there go.mod file to the go proxy. If the go.mod is not available on the go proxies it is not possible to build the port with the go module approach. This modification make a new variable GO_MOD_DIST availble. With the values: - gitlab (to download the go.mod from gitlab) - github (to download the go.mod from github) - https://.... (a custom URI without the go.mod in it) - not defined (will download as now from go proxy) This make it now possible to also easily package go based ports that are only hosted on some sites but not published to the go proxy. Differential Revision: https://reviews.freebsd.org/D45631 (cherry picked from commit 52b385abc68053471e9713a6ef9c81a8ce74910d) --- Mk/Uses/go.mk | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk index e78dbe33b7a5..1929dbc1dc9f 100644 --- a/Mk/Uses/go.mk +++ b/Mk/Uses/go.mk @@ -23,6 +23,16 @@ # In most cases, this is the only required variable for ports that # use Go modules. # +# GO_MOD_DIST +# The location to download the go.mod file if GO_MODULE is used. +# The default is empty, so it is loaded from GO_PROXY. +# Set it to "gitlab" and make sure GL_PROJECT is defined to download +# the "go.mod" from gitlab. +# Set it to "github" and make sure GH_PROJECT is defined to download +# the "go.mod" from github. +# You can also set it completely manually a URI without go.mod in it, +# is attached automatically to the URI. +# # GO_PKGNAME # The name of the package when building in GOPATH mode. This # is the directory that will be created in ${GOPATH}/src. If not set @@ -143,9 +153,25 @@ GO_MODNAME= ${GO_MODULE:C/^([^@]*)(@([^@]*)?)/\1/} GO_MODVERSION= ${GO_MODULE:C/^([^@]*)(@([^@]*)?)/\2/:M@*:S/^@//:S/^$/${DISTVERSIONFULL}/} GO_MODFILE= ${GO_MODVERSION}.mod GO_DISTFILE= ${GO_MODVERSION}.zip +# If GO_MOD_DIST is gitlab, download the go.mod from gitlab by the defined GL_ACCOUNT and GL_PROJECT/PORTNAME +. if defined(GO_MOD_DIST) && "${GO_MOD_DIST}" == "gitlab" +MASTER_SITES+= https://gitlab.com/${GL_ACCOUNT}/${GL_PROJECT}/-/raw/${GO_MODVERSION}/${WRKSRC_SUBDIR:?${WRKSRC_SUBDIR}/:} +DISTFILES+= go.mod +# If GO_MOD_DIST is github, download the go.mod from github by the defined GH_ACCOUNT and GH_PROJECT/PORTNAME +. elif defined(GO_MOD_DIST) && "${GO_MOD_DIST}" == "github" +MASTER_SITES+= https://raw.githubusercontent.com/${GH_ACCOUNT}/${GH_PROJECT}/${GO_MODVERSION}/${WRKSRC_SUBDIR:?${WRKSRC_SUBDIR}/:} +DISTFILES+= go.mod +# Manually defined GO_MOD_DIST +. elifdef(GO_MOD_DIST) +MASTER_SITES+= ${GO_MOD_DIST} +DISTFILES+= go.mod +# Fallback to default GO_PROXY +. else MASTER_SITES+= ${GO_GOPROXY}/${GO_MODNAME:C/([A-Z])/!\1/g:tl}/@v/ DISTFILES+= ${GO_MODFILE} ${GO_DISTFILE} WRKSRC= ${WRKDIR}/${GO_MODNAME}@${GO_MODVERSION} +. endif + . endif EXTRACT_ONLY?= ${DISTFILES:N*.mod\:*:N*.mod:C/:.*//} DIST_SUBDIR= go/${PKGORIGIN:S,/,_,g}/${DISTNAME}