git: 70088cbc8dcb - main - net/gitlab-agent: fix build as none-root user

From: Matthias Fechner <mfechner_at_FreeBSD.org>
Date: Fri, 18 Sep 2026 04:13:52 UTC
The branch main has been updated by mfechner:

URL: https://cgit.FreeBSD.org/ports/commit/?id=70088cbc8dcbaaee4ddd628be935c892c421efba

commit 70088cbc8dcbaaee4ddd628be935c892c421efba
Author:     Matthias Fechner <mfechner@FreeBSD.org>
AuthorDate: 2026-09-17 16:09:30 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2026-09-18 04:12:55 +0000

    net/gitlab-agent: fix build as none-root user
---
 net/gitlab-agent/Makefile | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/net/gitlab-agent/Makefile b/net/gitlab-agent/Makefile
index 7255ded1a3af..2c162ace5c2e 100644
--- a/net/gitlab-agent/Makefile
+++ b/net/gitlab-agent/Makefile
@@ -36,15 +36,17 @@ PLIST_FILES=	bin/kas
 # it. Extract the subtree from the main tarball first (this runs before
 # go-post-fetch).
 post-fetch:
-	@${MKDIR} ${DISTDIR}/${DIST_SUBDIR}
-	cd ${DISTDIR}/${DIST_SUBDIR} && \
-		${TAR} -xf ${DISTDIR}/${DIST_SUBDIR}/${DISTNAME}.tar.bz2 \
-		--strip-components 1 --no-same-owner --no-same-permissions \
-		${DISTNAME}/pkg/autoflow
-	cd ${DISTDIR}/${DIST_SUBDIR} && \
-		${TAR} -xf ${DISTDIR}/${DIST_SUBDIR}/${DISTNAME}.tar.bz2 \
-		--strip-components 1 --no-same-owner --no-same-permissions \
-		${DISTNAME}/pkg/tunnel
+	if [ ! -d "${DISTDIR}/${DIST_SUBDIR}/pkg" ]; then \
+		${MKDIR} ${DISTDIR}/${DIST_SUBDIR} && \
+		cd ${DISTDIR}/${DIST_SUBDIR} && \
+			${TAR} -xf "${DISTDIR}/${DIST_SUBDIR}/${DISTNAME}.tar.bz2" \
+			--strip-components 1 --no-same-owner --no-same-permissions \
+			"${DISTNAME}/pkg/autoflow/go.mod" "${DISTNAME}/pkg/autoflow/go.sum" && \
+		cd ${DISTDIR}/${DIST_SUBDIR} && \
+			${TAR} -xf ${DISTDIR}/${DIST_SUBDIR}/${DISTNAME}.tar.bz2 \
+			--strip-components 1 --no-same-owner --no-same-permissions \
+			"${DISTNAME}/pkg/tunnel/go.mod" "${DISTNAME}/pkg/tunnel/go.sum"; \
+	fi
 
 do-install:
 	${INSTALL_PROGRAM} ${WRKDIR}/bin/kas ${STAGEDIR}${PREFIX}/bin/kas