From nobody Fri May 13 18:39:35 2022 X-Original-To: dev-commits-ports-main@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 821F71AC93CE; Fri, 13 May 2022 18:39:35 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4L0HVv3CWDz4dyL; Fri, 13 May 2022 18:39:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652467175; 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=PMmt9stKQnHxK9lBp8w8ghlyqLLahx9TC8qsnQmm+QE=; b=SHYnzSchgQHunaCExP1BUl/nVW+oVEeFX8ubJKjcmgITVQF8cczew/nnBzD6FXZrxVxklt 4nWPfyQSiGwEQ0fjGJFxBHO0zdQYI5Tl8++aNZlsR3Y/ktMoSusQOzW8aC+gI5NUtzzDE0 vGqEYl2DBX2Ok3GjbkBdoF39Oj241lDiushn7CYtnmvXCnUqWK+INpmPC+Xeg0GZIVDTca vJ0TVVatviGcBDKaAb9uhcONWMWGIqajkOE2+9xRVN/pjYqpy/z3UEIhh7/SykLHA/JWvs 0fA0z15GQqlhtwnEw2LrvKIdbDBPLPY0cnhuHhf1FJbhNg29z/9OqFNxD0WSiQ== 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 4CE9D278C8; Fri, 13 May 2022 18:39:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 24DIdZG8023887; Fri, 13 May 2022 18:39:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24DIdZjQ023886; Fri, 13 May 2022 18:39:35 GMT (envelope-from git) Date: Fri, 13 May 2022 18:39:35 GMT Message-Id: <202205131839.24DIdZjQ023886@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Dmitri Goutnik Subject: git: d71b4ca77528 - main - Mk/Uses/go.mk: Block modules download when CLEAN_FETCH_ENV is defined List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dmgk X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d71b4ca7752864918dea9b92e7f65c15deb3d290 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652467175; 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=PMmt9stKQnHxK9lBp8w8ghlyqLLahx9TC8qsnQmm+QE=; b=Ay7RnKVyHkGkJQR9iTbBh2QyIeImLY3Hz9RUVnwrWnTy0+gb3TdzRlw+XkaIyU3oe5871S T4Xf6RpOE/QSfEtiIGG68zmFoKiAlHHKu+d0J5tb2WmuSIq8RbHqkWU9Oagl5QCJ7tHJOe rrsy1S6iv4wAgVU3AqAs6nu4PnKZDfAQX+JISo2Pq6CiaKIUzOSPMRjjGQSHaReLpOw6zR aCqmuyI0d47I/mLgm+exLAmlghnc4Ssqpxz57BqAxyYwOQqpMYY1QtPVn4fPDjYsv3qbS0 5bl328ve1eD5JbA8VaCkiqD1L5L47RD77zsnjdpZbd66WHhFIxDQPzx/P7Mq1Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652467175; a=rsa-sha256; cv=none; b=hUuc6aslJ/PxJwjaK04mcIJWoYYqcqUP/ivzyMWjlrMunKfLvhHK+/5CJukGy61ZqiZpHO VWR0wxGpCKwtiiV5e1/1imrP7B45Nzyk9NjHFSLDb8gKWJInuLWxVEc2W6fBC2jImIAww6 TDTH/jG7QkugNa6Pcw9+21IlixxhJXHeycN2V5vI6eQWIL0hsa58yGUCK8NWeoJP56JgwB 0Dqt2c7Iom8tprq4SPP64L8UPa4yjnhgRDsmupr/RaQ1zapawfUKyXXf+RSdckST6dHzaY di+f5kObbzMEw9ShxQV7dcNXgmw2XQ2PguD+5Wi0phVMls8dqa3cTItp/9Q+uw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dmgk: URL: https://cgit.FreeBSD.org/ports/commit/?id=d71b4ca7752864918dea9b92e7f65c15deb3d290 commit d71b4ca7752864918dea9b92e7f65c15deb3d290 Author: Dmitri Goutnik AuthorDate: 2022-05-13 18:34:15 +0000 Commit: Dmitri Goutnik CommitDate: 2022-05-13 18:38:01 +0000 Mk/Uses/go.mk: Block modules download when CLEAN_FETCH_ENV is defined Additionally, stop overriding post-fetch and post-extract targets. PR: 258474 Differential Revision: https://reviews.freebsd.org/D35145 --- Mk/Uses/go.mk | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk index b73e198e29fe..39585e0c9946 100644 --- a/Mk/Uses/go.mk +++ b/Mk/Uses/go.mk @@ -128,6 +128,8 @@ GO_ENV+= GOPATH="${GO_GOPATH}" \ . if defined(GO_MODULE) GO_MODNAME= ${GO_MODULE:C/^([^@]*)(@([^@]*)?)/\1/} . if empty(DISTFILES:Mgo.mod\:*) && empty(DISTFILES:Mgo.mod) +# Unless already setup for download by other means, +# arrange to pull go.mod and distribution archive from GOPROXY. GO_MODVERSION= ${GO_MODULE:C/^([^@]*)(@([^@]*)?)/\2/:M@*:S/^@//:S/^$/${DISTVERSIONFULL}/} GO_MODFILE= ${GO_MODVERSION}.mod GO_DISTFILE= ${GO_MODVERSION}.zip @@ -162,26 +164,37 @@ _USES_POST+= go .if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_GO_POST_MK) _INCLUDE_USES_GO_POST_MK= yes -. if !target(post-fetch) && ${go_ARGS:Mmodules} && defined(GO_MODULE) -post-fetch: +. if ${go_ARGS:Mmodules} && defined(GO_MODULE) +_USES_fetch+= 200:go-pre-fetch 800:go-post-fetch +# Check that pkg can be installed or is already available, +# otherwise it will be impossible to install go and fetch dependencies. +go-pre-fetch: +. if defined(CLEAN_FETCH_ENV) && !exists(${PKG_BIN}) + @${ECHO_MSG} "===> CLEAN_FETCH_ENV is defined, cannot download Go modules (pkg and go are required)"; \ + exit 1 +. endif +# Download all required build dependencies to GOMODCACHE. +go-post-fetch: @${ECHO_MSG} "===> Fetching ${GO_MODNAME} dependencies"; @(cd ${DISTDIR}/${DIST_SUBDIR}; \ [ -e go.mod ] || ${RLN} ${GO_MODFILE} go.mod; \ ${SETENV} ${GO_ENV} GOPROXY=${GO_GOPROXY} ${GO_CMD} mod download -x all) . endif -. if !target(post-extract) -. if empty(go_ARGS) -post-extract: +_USES_extract+= 800:go-post-extract +. if empty(go_ARGS) +# Legacy (GOPATH) build mode, setup directory structure expected by Go for the main module. +go-post-extract: @${MKDIR} ${GO_WRKSRC:H} @${LN} -sf ${WRKSRC} ${GO_WRKSRC} -. elif ${go_ARGS:Mmodules} && defined(GO_MODULE) -post-extract: +. elif ${go_ARGS:Mmodules} && defined(GO_MODULE) +# Module-aware build mode. Although not strictly necessary (all build dependencies should be +# already in MODCACHE), vendor them so we can patch them if needed. +go-post-extract: @${ECHO_MSG} "===> Tidying ${GO_MODNAME} dependencies"; @(cd ${GO_WRKSRC}; ${SETENV} ${GO_ENV} GOPROXY=${GO_MODCACHE} ${GO_CMD} mod tidy -e) @${ECHO_MSG} "===> Vendoring ${GO_MODNAME} dependencies"; @(cd ${GO_WRKSRC}; ${SETENV} ${GO_ENV} GOPROXY=${GO_MODCACHE} ${GO_CMD} mod vendor -e) -. endif . endif . if !target(do-build) && empty(go_ARGS:Mno_targets)