From 2403e3abc6f62a1b46a1463a5adfa34a4a5f5c2c Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Wed, 10 Apr 2024 14:19:12 +0200 Subject: [PATCH 1/2] Makefile: Introduce alternating Git versions Instead of adding Make build rules and a feature flag for each new Git minor version release, simply define two versions and alternate between them. This ensures we always have a newer and an older version. Issue: https://gitlab.com/gitlab-org/gitaly/-/issues/5958 --- Makefile | 30 +++++++++++++-------------- internal/featureflag/ff_git_luigi.go | 9 ++++++++ internal/featureflag/ff_git_v244.go | 9 -------- internal/git/execution_environment.go | 6 +++--- internal/testhelper/testhelper.go | 4 ++-- 5 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 internal/featureflag/ff_git_luigi.go delete mode 100644 internal/featureflag/ff_git_v244.go diff --git a/Makefile b/Makefile index c27e9fd771..abd06f38eb 100644 --- a/Makefile +++ b/Makefile @@ -127,10 +127,10 @@ GIT_EXECUTABLES += git-http-backend ## WITH_BUNDLED_GIT=YesPlease. Can be set to an arbitrary Git revision with ## tags, branches, and commit ids. GIT_VERSION ?= -## The Git version used for bundled Git v2.43. -GIT_VERSION_2_43 ?= v2.43.2 -## The Git version used for bundled Git v2.44. -GIT_VERSION_2_44 ?= v2.44.0.gl1 +## The Git version used for bundled Git Mario +GIT_VERSION_MARIO ?= v2.43.2 +## The Git version used for bundled Git Luigi +GIT_VERSION_LUIGI ?= v2.44.0.gl1 ## Skip overriding the Git version and instead use the Git version as specified ## in the Git sources. This is required when building Git from a version that @@ -140,7 +140,7 @@ SKIP_OVERRIDING_GIT_VERSION ?= # The default version is used in case the caller does not set the variable or # if it is either set to the empty string or "default". ifeq (${GIT_VERSION:default=},) - override GIT_VERSION := ${GIT_VERSION_2_43} + override GIT_VERSION := ${GIT_VERSION_MARIO} else # Support both vX.Y.Z and X.Y.Z version patterns, since callers across GitLab # use both. @@ -291,16 +291,16 @@ install: build .PHONY: build-bundled-git ## Build bundled Git binaries. -build-bundled-git: build-bundled-git-v2.43 build-bundled-git-v2.44 -build-bundled-git-v2.43: $(patsubst %,${BUILD_DIR}/bin/gitaly-%-v2.43,${GIT_EXECUTABLES}) -build-bundled-git-v2.44: $(patsubst %,${BUILD_DIR}/bin/gitaly-%-v2.44,${GIT_EXECUTABLES}) +build-bundled-git: build-bundled-git-mario build-bundled-git-luigi +build-bundled-git-mario: $(patsubst %,${BUILD_DIR}/bin/gitaly-%-${GIT_VERSION_MARIO},${GIT_EXECUTABLES}) +build-bundled-git-luigi: $(patsubst %,${BUILD_DIR}/bin/gitaly-%-${GIT_VERSION_LUIGI},${GIT_EXECUTABLES}) .PHONY: install-bundled-git ## Install bundled Git binaries. The target directory can be modified by ## setting PREFIX and DESTDIR. -install-bundled-git: install-bundled-git-v2.43 install-bundled-git-v2.44 -install-bundled-git-v2.43: $(patsubst %,${INSTALL_DEST_DIR}/gitaly-%-v2.43,${GIT_EXECUTABLES}) -install-bundled-git-v2.44: $(patsubst %,${INSTALL_DEST_DIR}/gitaly-%-v2.44,${GIT_EXECUTABLES}) +install-bundled-git: install-bundled-git-mario install-bundled-git-luigi +install-bundled-git-mario: $(patsubst %,${INSTALL_DEST_DIR}/gitaly-%-${GIT_VERSION_MARIO},${GIT_EXECUTABLES}) +install-bundled-git-luigi: $(patsubst %,${INSTALL_DEST_DIR}/gitaly-%-${GIT_VERSION_LUIGI},${GIT_EXECUTABLES}) ifdef WITH_BUNDLED_GIT build: build-bundled-git @@ -555,12 +555,12 @@ ${DEPENDENCY_DIR}/git-distribution/git: ${DEPENDENCY_DIR}/git-distribution/Makef ${Q}env -u PROFILE -u MAKEFLAGS -u GIT_VERSION ${MAKE} -C "$( Date: Wed, 10 Apr 2024 14:53:10 +0200 Subject: [PATCH 2/2] Makefile: Exclude patch version from Git binary names Don't include the patch version and suffix in the filenames of the Git binaries. --- Makefile | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index abd06f38eb..5cc6008320 100644 --- a/Makefile +++ b/Makefile @@ -132,6 +132,14 @@ GIT_VERSION_MARIO ?= v2.43.2 ## The Git version used for bundled Git Luigi GIT_VERSION_LUIGI ?= v2.44.0.gl1 +# Carefully borrowed from https://www.gnu.org/software/make/manual/make.html#Special-Characters +dot:= . +empty:= +space:= ${empty} ${empty} +major_minor=$(subst ${space},${dot},$(wordlist 1,2,$(subst ${dot},${space},$1))) +GIT_VERSION_MARIO_M = $(call major_minor,${GIT_VERSION_MARIO}) +GIT_VERSION_LUIGI_M = $(call major_minor,${GIT_VERSION_LUIGI}) + ## Skip overriding the Git version and instead use the Git version as specified ## in the Git sources. This is required when building Git from a version that ## cannot be parsed by Gitaly. @@ -292,15 +300,15 @@ install: build .PHONY: build-bundled-git ## Build bundled Git binaries. build-bundled-git: build-bundled-git-mario build-bundled-git-luigi -build-bundled-git-mario: $(patsubst %,${BUILD_DIR}/bin/gitaly-%-${GIT_VERSION_MARIO},${GIT_EXECUTABLES}) -build-bundled-git-luigi: $(patsubst %,${BUILD_DIR}/bin/gitaly-%-${GIT_VERSION_LUIGI},${GIT_EXECUTABLES}) +build-bundled-git-mario: $(patsubst %,${BUILD_DIR}/bin/gitaly-%-${GIT_VERSION_MARIO_M},${GIT_EXECUTABLES}) +build-bundled-git-luigi: $(patsubst %,${BUILD_DIR}/bin/gitaly-%-${GIT_VERSION_LUIGI_M},${GIT_EXECUTABLES}) .PHONY: install-bundled-git ## Install bundled Git binaries. The target directory can be modified by ## setting PREFIX and DESTDIR. install-bundled-git: install-bundled-git-mario install-bundled-git-luigi -install-bundled-git-mario: $(patsubst %,${INSTALL_DEST_DIR}/gitaly-%-${GIT_VERSION_MARIO},${GIT_EXECUTABLES}) -install-bundled-git-luigi: $(patsubst %,${INSTALL_DEST_DIR}/gitaly-%-${GIT_VERSION_LUIGI},${GIT_EXECUTABLES}) +install-bundled-git-mario: $(patsubst %,${INSTALL_DEST_DIR}/gitaly-%-${GIT_VERSION_MARIO_M},${GIT_EXECUTABLES}) +install-bundled-git-luigi: $(patsubst %,${INSTALL_DEST_DIR}/gitaly-%-${GIT_VERSION_LUIGI_M},${GIT_EXECUTABLES}) ifdef WITH_BUNDLED_GIT build: build-bundled-git @@ -555,12 +563,12 @@ ${DEPENDENCY_DIR}/git-distribution/git: ${DEPENDENCY_DIR}/git-distribution/Makef ${Q}env -u PROFILE -u MAKEFLAGS -u GIT_VERSION ${MAKE} -C "$(