diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-04-01 08:00:39 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-04-01 08:00:39 +0300 |
commit | 63c6595f55431a61ee90ed93b02cc142a9dcae6a (patch) | |
tree | 288b6ef4ed406951bb87875e20f7e84d8ef5a537 | |
parent | 75df63408a6fd1f5ef0b4520100242b31e030c16 (diff) |
Makefile: Fix indeterministic sorting order of Git patches
With 3f6d4ca0f (Makefile: Group Git patches by version, 2022-03-31) we
have started to collect Git patches we want to apply by using the
`wildcard` function. This has broken compilation downstream though in
both CNG and Omnibus, where patches seemingly don't apply correctly
anymore.
The root cause of this may be an incompatibility in GNU Make: I'm using
GNU Make 4.3 on my system, which is sorting files returned by `wildcard`
[1]. Reversely, any systems which use older versions do _not_ sort them,
and thus the order in which we apply patches is indeterministic.
This has two consequences:
1. Applying patches may fail altogether because they are dependent
on one another.
2. With intedeterministic sorting order we may repeatedly rebuild
the Git versions because our `.version` file changes every time.
Fix this incompatibility by sorting the patches.
[1]: http://git.savannah.gnu.org/cgit/make.git/tree/NEWS#n187
Changelog: fixed
-rw-r--r-- | Makefile | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -133,7 +133,7 @@ ifeq (${GIT_VERSION:default=},) # Before adding custom patches, please read doc/PROCESS.md#Patching-git # first to make sure your patches meet our acceptance criteria. Patches # must be put into `_support/git-patches`. - GIT_PATCHES := $(wildcard ${SOURCE_DIR}/_support/git-patches/v2.35.1.gl1/*) + GIT_PATCHES := $(sort $(wildcard ${SOURCE_DIR}/_support/git-patches/v2.35.1.gl1/*)) else # Support both vX.Y.Z and X.Y.Z version patterns, since callers across GitLab # use both. @@ -568,13 +568,13 @@ ${GIT_PREFIX}/bin/git: ${DEPENDENCY_DIR}/git-${GIT_VERSION}.${GIT_EXTRA_VERSION} ${Q}env -u PROFILE -u MAKEFLAGS -u GIT_VERSION ${MAKE} -C "$(<D)" -j$(shell nproc) prefix=${GIT_PREFIX} ${GIT_BUILD_OPTIONS} install ${Q}touch $@ -${BUILD_DIR}/bin/gitaly-%: override GIT_PATCHES := $(wildcard ${SOURCE_DIR}/_support/git-patches/v2.33.1.gl3/*) +${BUILD_DIR}/bin/gitaly-%: override GIT_PATCHES := $(sort $(wildcard ${SOURCE_DIR}/_support/git-patches/v2.33.1.gl3/*)) ${BUILD_DIR}/bin/gitaly-%: override GIT_VERSION = v2.33.1 ${BUILD_DIR}/bin/gitaly-%: override GIT_EXTRA_VERSION = gl3 ${BUILD_DIR}/bin/gitaly-%: ${DEPENDENCY_DIR}/git-v2.33.1.gl3/% | ${BUILD_DIR}/bin ${Q}install $< $@ -${BUILD_DIR}/bin/gitaly-%-v2.35.1.gl1: override GIT_PATCHES := $(wildcard ${SOURCE_DIR}/_support/git-patches/v2.35.1.gl1/*) +${BUILD_DIR}/bin/gitaly-%-v2.35.1.gl1: override GIT_PATCHES := $(sort $(wildcard ${SOURCE_DIR}/_support/git-patches/v2.35.1.gl1/*)) ${BUILD_DIR}/bin/gitaly-%-v2.35.1.gl1: override GIT_VERSION = v2.35.1 ${BUILD_DIR}/bin/gitaly-%-v2.35.1.gl1: override GIT_EXTRA_VERSION = gl1 ${BUILD_DIR}/bin/gitaly-%-v2.35.1.gl1: ${DEPENDENCY_DIR}/git-v2.35.1.gl1/% | ${BUILD_DIR}/bin |