git: 6bc8a7b91b23 - main - ports-mgmt/poudriere*: Add 'make test' metadata for port.

From: Bryan Drewery <bdrewery_at_FreeBSD.org>
Date: Tue, 23 Apr 2024 23:04:53 UTC
The branch main has been updated by bdrewery:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6bc8a7b91b23c7680944bf57f378d6434899d31f

commit 6bc8a7b91b23c7680944bf57f378d6434899d31f
Author:     Bryan Drewery <bdrewery@FreeBSD.org>
AuthorDate: 2024-04-23 14:04:23 +0000
Commit:     Bryan Drewery <bdrewery@FreeBSD.org>
CommitDate: 2024-04-23 14:04:23 +0000

    ports-mgmt/poudriere*: Add 'make test' metadata for port.
    
    This is not adding 'make test' support to Poudriere. It
    is only for the port right now.
---
 ports-mgmt/poudriere-devel/Makefile                 | 21 +++++++++++++++++++++
 .../poudriere-devel/files/patch-test_common.sh      | 19 +++++++++++++++++++
 ports-mgmt/poudriere/Makefile                       | 20 ++++++++++++++++++++
 3 files changed, 60 insertions(+)

diff --git a/ports-mgmt/poudriere-devel/Makefile b/ports-mgmt/poudriere-devel/Makefile
index cdf118816a2b..8e01abc4f4d6 100644
--- a/ports-mgmt/poudriere-devel/Makefile
+++ b/ports-mgmt/poudriere-devel/Makefile
@@ -35,6 +35,27 @@ PORTCONFIG_RUN_DEPENDS=	portconfig>0:ports-mgmt/portconfig
 QEMU_DESC=	Add qemu-user-static for non-x86 architectures
 QEMU_RUN_DEPENDS=	qemu-user-static>0:emulators/qemu-user-static
 
+
+# gmake is not strictly needed but handles test jobs better
+TEST_DEPENDS=	gmake>0:devel/gmake
+TEST_ENV=	MAKE=gmake
+MAKE_CMD=	gmake
+TEST_TARGET=	check
+TEST_ARGS=	-s
+TEST_ARGS+=	${_MAKE_JOBS}
+# ccache passthrough helps for building pkg a few hundred times.
+# ccache not added as a dependency because it is only used if setup
+# and provided in the env already.
+# XXX: Passthrough local PKGREPOSITORY dir for fetch support
+ccache_vars=	CCACHE_DIR_NON_ROOT_SAFE CCACHE_GROUP \
+		CCACHE_GID CCACHE_STATIC_PREFIX CCACHE_TEMPDIR \
+		CCACHE_DIR CCACHE_NLEVELS
+.for _cv in ${ccache_vars}
+.  if !empty(${_cv})
+TEST_ENV+=	${_cv}=${${_cv}}
+.  endif
+.endfor
+
 .include <bsd.port.options.mk>
 
 # rm -x support came in 10.0.  A bundled rm is used if not supported in base.
diff --git a/ports-mgmt/poudriere-devel/files/patch-test_common.sh b/ports-mgmt/poudriere-devel/files/patch-test_common.sh
new file mode 100644
index 000000000000..bd79c439750f
--- /dev/null
+++ b/ports-mgmt/poudriere-devel/files/patch-test_common.sh
@@ -0,0 +1,19 @@
+commit a94cfcd734a0ac81cf157378b77732a3de6b9463
+Author: Bryan Drewery <bryan@shatow.net>
+Date:   Tue Apr 23 06:29:13 2024 -0700
+
+    tests: Don't run git-log from 'make test' for Poudriere in ports
+    
+    This results in a very long lookup that returns nothing
+
+--- test/common.sh.orig	2024-04-20 03:48:57 UTC
++++ test/common.sh
+@@ -550,6 +550,7 @@ msg_debug "getpid: $$"
+ 
+ msg_debug "getpid: $$"
+ 
+-if git_get_hash_and_dirty "${abs_top_srcdir}" git_hash git_dirty; then
++if [ -r "${abs_top_srcdir}/.git" ] &&
++    git_get_hash_and_dirty "${abs_top_srcdir}" git_hash git_dirty; then
+ 	msg "Source git hash: ${git_hash} modified: ${git_dirty}"
+ fi >&2
diff --git a/ports-mgmt/poudriere/Makefile b/ports-mgmt/poudriere/Makefile
index 613e30e9fcfd..ab6a7a2d31fb 100644
--- a/ports-mgmt/poudriere/Makefile
+++ b/ports-mgmt/poudriere/Makefile
@@ -35,6 +35,26 @@ PORTCONFIG_RUN_DEPENDS=	portconfig>0:ports-mgmt/portconfig
 QEMU_DESC=	Add qemu-user-static for non-x86 architectures
 QEMU_RUN_DEPENDS=	qemu-user-static>0:emulators/qemu-user-static
 
+# gmake is not strictly needed but handles test jobs better
+TEST_DEPENDS=	gmake>0:devel/gmake
+TEST_ENV=	MAKE=gmake
+MAKE_CMD=	gmake
+TEST_TARGET=	check
+TEST_ARGS=	-s
+TEST_ARGS+=	${_MAKE_JOBS}
+# ccache passthrough helps for building pkg a few hundred times.
+# ccache not added as a dependency because it is only used if setup
+# and provided in the env already.
+# XXX: Passthrough local PKGREPOSITORY dir for fetch support
+ccache_vars=	CCACHE_DIR_NON_ROOT_SAFE CCACHE_GROUP \
+		CCACHE_GID CCACHE_STATIC_PREFIX CCACHE_TEMPDIR \
+		CCACHE_DIR CCACHE_NLEVELS
+.for _cv in ${ccache_vars}
+.  if !empty(${_cv})
+TEST_ENV+=	${_cv}=${${_cv}}
+.  endif
+.endfor
+
 .include <bsd.port.options.mk>
 
 # rm -x support came in 10.0.  A bundled rm is used if not supported in base.