git: 1e0e936bbf78 - main - devel/gitaly: update to 16.3.0

From: Matthias Fechner <mfechner_at_FreeBSD.org>
Date: Fri, 08 Sep 2023 10:35:33 UTC
The branch main has been updated by mfechner:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1e0e936bbf78c5bf2b0e034e65f90e333f263cb0

commit 1e0e936bbf78c5bf2b0e034e65f90e333f263cb0
Author:     Matthias Fechner <mfechner@FreeBSD.org>
AuthorDate: 2023-09-02 09:12:12 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2023-09-08 10:34:39 +0000

    devel/gitaly: update to 16.3.0
    
    Required for gitlab-ce 16.3.
    Use an internal libgit2 as the FreeBSD installed version is to new
    but git2go does not support a newer version yet:
    https://github.com/libgit2/git2go/issues/951
    
    Changelog:
    https://gitlab.com/gitlab-org/gitaly/-/blob/master/CHANGELOG.md
---
 devel/gitaly/Makefile                        | 21 ++++++++++----
 devel/gitaly/distinfo                        | 12 ++++----
 devel/gitaly/files/patch-Makefile            | 42 ++++++++++++++++------------
 devel/gitaly/files/patch-config.toml.example | 10 +++----
 4 files changed, 52 insertions(+), 33 deletions(-)

diff --git a/devel/gitaly/Makefile b/devel/gitaly/Makefile
index ddb908249092..ab8a292ceb83 100644
--- a/devel/gitaly/Makefile
+++ b/devel/gitaly/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	gitaly
-DISTVERSION=	16.1.5
+DISTVERSION=	16.3.0
 DISTVERSIONPREFIX=	v
 CATEGORIES=	devel
 
@@ -15,14 +15,16 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 # it fixes segfaults reported here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259848
 
 # define dependencies that are required for build and run under MY_DEPENDS
-MY_DEPENDS=	git>=2.40.1:devel/git
+MY_DEPENDS=	git>=2.41.0:devel/git
 BUILD_DEPENDS=	bash>0:shells/bash \
+		${LOCALBASE}/bin/cmake:devel/cmake-core \
 		${MY_DEPENDS}
 RUN_DEPENDS=	${MY_DEPENDS} \
 		gitlab-shell>=14.17.0:devel/gitlab-shell
-LIB_DEPENDS=	libgit2.so:devel/libgit2
+LIB_DEPENDS=	libpcre2-8.so:devel/pcre2 \
+		libhttp_parser.so:www/http-parser
 
-USES=		cpe gmake go:modules,no_targets pkgconfig
+USES=		cpe gmake go:modules,no_targets iconv pkgconfig ssl
 
 CPE_VENDOR=	gitlab
 
@@ -33,6 +35,10 @@ MAKE_ENV+=	${GO_ENV}
 USE_GITLAB=	yes
 GL_ACCOUNT=	gitlab-org
 
+USE_GITHUB=	nodefault
+# Check used version here: https://gitlab.com/gitlab-org/gitaly/-/blob/v16.3.1/Makefile#L181
+GH_TUPLE=	libgit2:libgit2:v1.5.1:build_deps_libgit2_source
+
 # for go dependencies
 # Gitlab hosts there dependencies on their own platform and not on go-proxy
 # so we download the required go.mod file from gitlab
@@ -52,6 +58,11 @@ go-post-fetch:
 		${SETENV} ${GO_ENV} GOPROXY=${GO_GOPROXY} ${GO_CMD} mod download -x all)
 # ---------------------------
 
+post-extract:
+	${MKDIR} ${WRKSRC}/_build/deps/libgit2
+	@${RM} -r ${WORKSRC}/_build/deps/libgit2/source
+	@${RLN} ${WRKSRC_build_deps_libgit2_source} ${WRKSRC}/_build/deps/libgit2/source
+
 post-patch:
 	${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|" ${WRKSRC}/config.toml.example
 	${MV} ${WRKSRC}/config.toml.example ${WRKSRC}/config.toml.sample
@@ -60,7 +71,7 @@ do-install:
 	${MKDIR} ${STAGEDIR}${DATADIR}
 	${MKDIR} ${STAGEDIR}${DATADIR}/bin
 	${FIND} ${WRKSRC} -name '*.orig' -delete
-	(cd ${WRKSRC}/_build/bin/ && ${COPYTREE_SHARE} .  ${STAGEDIR}${DATADIR}/bin && \
+	(cd ${WRKSRC}/_build/bin/ && ${COPYTREE_BIN} .  ${STAGEDIR}${DATADIR}/bin && \
 	cd ${WRKSRC} && ${COPYTREE_SHARE} config.toml.sample  ${STAGEDIR}${DATADIR})
 
 post-install:
diff --git a/devel/gitaly/distinfo b/devel/gitaly/distinfo
index 04afc4aedb6d..a6a4f9d1b818 100644
--- a/devel/gitaly/distinfo
+++ b/devel/gitaly/distinfo
@@ -1,5 +1,7 @@
-TIMESTAMP = 1693546702
-SHA256 (go/devel_gitaly/gitaly-v16.1.5/go.mod) = 869d038756ee3f440edad81f05654cccb15a563cc4bbaee1971055ab280ebe3c
-SIZE (go/devel_gitaly/gitaly-v16.1.5/go.mod) = 10223
-SHA256 (go/devel_gitaly/gitaly-v16.1.5/gitaly-v16.1.5.tar.bz2) = 5ee7a0f62c25d1367a1788a2bea829c4e876a0165f69cf65bf29e8b95721ddcb
-SIZE (go/devel_gitaly/gitaly-v16.1.5/gitaly-v16.1.5.tar.bz2) = 2645668
+TIMESTAMP = 1693571940
+SHA256 (go/devel_gitaly/gitaly-v16.3.0/go.mod) = 90b3743fb25526e4b77aeca1a9b00d0a99c5288da835d80bf29121fb2a211db2
+SIZE (go/devel_gitaly/gitaly-v16.3.0/go.mod) = 10532
+SHA256 (go/devel_gitaly/gitaly-v16.3.0/libgit2-libgit2-v1.5.1_GH0.tar.gz) = 7074f1e2697992b82402501182db254fe62d64877b12f6e4c64656516f4cde88
+SIZE (go/devel_gitaly/gitaly-v16.3.0/libgit2-libgit2-v1.5.1_GH0.tar.gz) = 5895483
+SHA256 (go/devel_gitaly/gitaly-v16.3.0/gitaly-v16.3.0.tar.bz2) = d21c2eeb36018c423f6612362a542873e33e2c1938a76fd6c29f3b4519bfa14d
+SIZE (go/devel_gitaly/gitaly-v16.3.0/gitaly-v16.3.0.tar.bz2) = 2461594
diff --git a/devel/gitaly/files/patch-Makefile b/devel/gitaly/files/patch-Makefile
index 68da5f620614..b9ed01951a7f 100644
--- a/devel/gitaly/files/patch-Makefile
+++ b/devel/gitaly/files/patch-Makefile
@@ -1,19 +1,25 @@
---- Makefile.orig	2023-04-21 08:04:56 UTC
+--- Makefile.orig	2023-08-21 09:20:49 UTC
 +++ Makefile
-@@ -573,7 +573,7 @@ ${BUILD_DIR}/bin/%: ${BUILD_DIR}/intermediate/% | ${BU
- 	@ # This fallback is unique but non-deterministic, making it sufficient to avoid generating the
- 	@ # GNU build-id from the empty string and causing guaranteed collisions.
- 	${Q}GO_BUILD_ID=$$(go tool buildid "$<" || openssl rand -hex 32) && \
--	GNU_BUILD_ID=$$(echo $$GO_BUILD_ID | sha1sum | cut -d' ' -f1) && \
-+	GNU_BUILD_ID=$$(echo $$GO_BUILD_ID | sha1 | cut -d' ' -f1) && \
- 	if test "${OS}" = "Linux"; then \
- 		go run "${SOURCE_DIR}"/tools/replace-buildid \
- 			-input "$<" -input-build-id "${TEMPORARY_BUILD_ID}" \
-@@ -599,7 +599,6 @@ ${BUILD_DIR}/intermediate/gitaly:            GO_BUILD_
- ${BUILD_DIR}/intermediate/gitaly:            remove-legacy-go-mod ${GITALY_PACKED_EXECUTABLES}
- ${BUILD_DIR}/intermediate/praefect:          GO_BUILD_TAGS = ${SERVER_BUILD_TAGS}
- ${BUILD_DIR}/intermediate/gitaly-git2go:     GO_BUILD_TAGS = ${GIT2GO_BUILD_TAGS}
--${BUILD_DIR}/intermediate/gitaly-git2go:     libgit2
- ${BUILD_DIR}/intermediate/%:                 clear-go-build-cache-if-needed .FORCE
- 	@ # We're building intermediate binaries first which contain a fixed build ID
- 	@ # of "TEMP_GITALY_BUILD_ID". In the final binary we replace this build ID with
+@@ -628,16 +628,16 @@ ${DEPENDENCY_DIR}/protoc.version: dependency-version |
+ 	${Q}[ x"$$(cat "$@" 2>/dev/null)" = x"${PROTOC_VERSION} ${PROTOC_BUILD_OPTIONS}" ] || >$@ echo -n "${PROTOC_VERSION} ${PROTOC_BUILD_OPTIONS}"
+ 
+ ${LIBGIT2_INSTALL_DIR}/lib/libgit2.a: ${DEPENDENCY_DIR}/libgit2.version
+-	${Q}${GIT} -c init.defaultBranch=master init ${GIT_QUIET} ${LIBGIT2_SOURCE_DIR}
+-	${Q}${GIT} -C "${LIBGIT2_SOURCE_DIR}" config remote.origin.url ${LIBGIT2_REPO_URL}
+-	${Q}${GIT} -C "${LIBGIT2_SOURCE_DIR}" config remote.origin.tagOpt --no-tags
+-	${Q}${GIT} -C "${LIBGIT2_SOURCE_DIR}" fetch --depth 1 ${GIT_QUIET} origin ${LIBGIT2_VERSION}
+-	${Q}${GIT} -C "${LIBGIT2_SOURCE_DIR}" checkout ${GIT_QUIET} --detach FETCH_HEAD
++	#${Q}${GIT} -c init.defaultBranch=master init ${GIT_QUIET} ${LIBGIT2_SOURCE_DIR}
++	#${Q}${GIT} -C "${LIBGIT2_SOURCE_DIR}" config remote.origin.url ${LIBGIT2_REPO_URL}
++	#${Q}${GIT} -C "${LIBGIT2_SOURCE_DIR}" config remote.origin.tagOpt --no-tags
++	#${Q}${GIT} -C "${LIBGIT2_SOURCE_DIR}" fetch --depth 1 ${GIT_QUIET} origin ${LIBGIT2_VERSION}
++	#${Q}${GIT} -C "${LIBGIT2_SOURCE_DIR}" checkout ${GIT_QUIET} --detach FETCH_HEAD
+ 	${Q}rm -rf ${LIBGIT2_BUILD_DIR}
+ 	${Q}mkdir -p ${LIBGIT2_BUILD_DIR}
+ 	${Q}cd ${LIBGIT2_BUILD_DIR} && cmake ${LIBGIT2_SOURCE_DIR} ${LIBGIT2_BUILD_OPTIONS}
+ 	${Q}CMAKE_BUILD_PARALLEL_LEVEL=$(shell nproc) cmake --build ${LIBGIT2_BUILD_DIR} --target install
+-	go install -a github.com/libgit2/git2go/${GIT2GO_VERSION}
++	#go install -a github.com/libgit2/git2go/${GIT2GO_VERSION}
+ 
+ # This target is responsible for checking out Git sources. In theory, we'd only
+ # need to depend on the source directory. But given that the source directory
diff --git a/devel/gitaly/files/patch-config.toml.example b/devel/gitaly/files/patch-config.toml.example
index 7df2f61fefe4..6b6db835cd9f 100644
--- a/devel/gitaly/files/patch-config.toml.example
+++ b/devel/gitaly/files/patch-config.toml.example
@@ -1,4 +1,4 @@
---- config.toml.example.orig	2023-04-21 08:04:56 UTC
+--- config.toml.example.orig	2023-08-21 09:20:49 UTC
 +++ config.toml.example
 @@ -2,10 +2,10 @@
  # Documentation lives at https://docs.gitlab.com/ee/administration/gitaly/ and
@@ -34,8 +34,8 @@
 +bin_path = "%%PREFIX%%/bin/git"
  # catfile_cache_size = 100
  #
- # # Set this setting to `true` to start ignoring gitconfig files installed in
-@@ -51,7 +51,7 @@ bin_dir = "/home/git/gitaly/_build/bin"
+ # [[git.config]]
+@@ -44,7 +44,7 @@ bin_dir = "/home/git/gitaly/_build/bin"
  
  [[storage]]
  name = "default"
@@ -44,7 +44,7 @@
  
  # # You can optionally configure more storages for this Gitaly instance to serve up
  #
-@@ -61,9 +61,9 @@ path = "/home/git/repositories"
+@@ -54,9 +54,9 @@ path = "/home/git/repositories"
  #
  
  # # You can optionally configure Gitaly to output JSON-formatted log messages to stdout
@@ -56,7 +56,7 @@
  # format = "json"
  # # Optional: Set log level to only log entries with that severity or above
  # # One of, in order: debug, info, warn, errror, fatal, panic
-@@ -79,14 +79,14 @@ dir = "/home/git/gitlab/log"
+@@ -72,14 +72,14 @@ dir = "/home/git/gitlab/log"
  
  [gitlab-shell]
  # The directory where gitlab-shell is installed