From nobody Thu Jul 11 13:37:01 2024 X-Original-To: dev-commits-ports-all@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 4WKbPB4QKpz5Qg3g; Thu, 11 Jul 2024 13:37:02 +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 4WKbPB0hbNz4scZ; Thu, 11 Jul 2024 13:37:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720705022; 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=6eJA3yQ9hhiYwbqSdhzNs+Z/aF/D5LGdcjv6rMDBPy8=; b=j7WiXPalcXJPJxzZSPUahZU+WidwKIbyK0w7IPp3SnkZ1FLoO7Lw3Wh96cIzn6ipemn1Fl LwqHo++BjpNFZPak9NB7hwX3DpQfB4QajfEdUSO6mherLfZAshA3Q6WHJt02rr2W3dtA3Y 4cNU2rknO1NBz0KMYnM+hhm1yhlCPBnMmpJvKGSo1OBPylFYSGKKv6lLQTYbsVVaWGe4O1 RckPFe1v9rP+dkbgoG0fGWSpx/S1VCCdXEuAqhXTS8wFxl4O0w+hkFdmLpqEigZxyttQho UT2NV8I0oaUB7W8AwS4tWDugRMnd9WVdoIUxz7boA5z5xlW5/wXAh1pYBGx8lg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720705022; a=rsa-sha256; cv=none; b=c1ZSmNiBbexweN2Nt7g/1qiviNedR1+p3LtZU4aIPfSrXh+iAQPaqj1tGxgARKzLxduzBl mlUA/AeRqsnizyWQNhCmnkymCvmszPtHJUbE2gvewDzO4dqsUtvyQf+fSmuI/IUV4UcYHq 3ruBBNVHSXiJ2vuawVOk8yD1Ki+AT6fEgJ3GaJ6eL3UWEAOmJf5NIXgKYN0IfWqHVEHEdr 6soCwMS8o3wO/6LU7P58KAyqRpgETa2y8iv9CguxpMzLuFIFoanu6HgHtp7Rj2GZtV86S3 Kj6Dd2Pv9L8W/vC2gmdGXmsnWG4KVE0xFH3O7h11adClzL/mNkz4giJWTDh/Ew== 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=1720705022; 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=6eJA3yQ9hhiYwbqSdhzNs+Z/aF/D5LGdcjv6rMDBPy8=; b=GkprTZI5D6TGWIO5+I0Djo3rLNbfei2QDFM1aXrK7+++f3NHr1MbYtmopl04vGxF8AHlPm WWk02ek/xQW+2wlQBmuaCE/sejsrOyJgznlGxiv6VEn4Kg7COcRG6IaIZ46/AhveMR8wbF Y8dqSBwVbP/MLSno5SybIjzW32fU2wtnOasDy8Y5RPe+OmPjDu1M1zBEOPXQcil43RDWgG 2sfjy6bgihi5EzXMrYfY440w3pQuQrRvIEijkyKLdgVPtG6tfdL4rLLG8GMJYFUSyNOYpk W/M3BDNmXtReG/noHstA/rleDhIdCwhYUw6VpA9icSBXy585yC5vK1+2fcGYvg== 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 4WKbPB0JpJz12Yg; Thu, 11 Jul 2024 13:37:02 +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 46BDb1hU062827; Thu, 11 Jul 2024 13:37:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46BDb15P062824; Thu, 11 Jul 2024 13:37:01 GMT (envelope-from git) Date: Thu, 11 Jul 2024 13:37:01 GMT Message-Id: <202407111337.46BDb15P062824@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Matthias Fechner Subject: git: 52b385abc680 - main - Mk/Uses: go.mk can not load a go.mod from other locations List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-all@freebsd.org Sender: owner-dev-commits-ports-all@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/main X-Git-Reftype: branch X-Git-Commit: 52b385abc68053471e9713a6ef9c81a8ce74910d Auto-Submitted: auto-generated The branch main has been updated by mfechner: URL: https://cgit.FreeBSD.org/ports/commit/?id=52b385abc68053471e9713a6ef9c81a8ce74910d commit 52b385abc68053471e9713a6ef9c81a8ce74910d Author: Matthias Fechner AuthorDate: 2024-06-19 09:15:30 +0000 Commit: Matthias Fechner CommitDate: 2024-07-11 13:36:42 +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 --- 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}