Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohn.mcdonnell <jmcdonnell@gitlab.com>2023-02-08 08:25:02 +0300
committerjohn.mcdonnell <jmcdonnell@gitlab.com>2023-02-08 10:13:03 +0300
commit13f87e714d2addfa3e2f7ad272a8a10cf5ca67f4 (patch)
treed8898db97e7fb4df15695d9ab6892edca192efb6
parent12b02c7e26279743f140a88a0b3107422c353ce1 (diff)
Change dir to SOURCE_DIR prior to go build
Fixes https://gitlab.com/gitlab-org/gitaly/-/issues/4645 by avoiding situations where the working dir may be a symlink, but SOURCE_DIR is the resolved path.
-rw-r--r--Makefile3
1 files changed, 2 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 0e674b1c3..fb38d5942 100644
--- a/Makefile
+++ b/Makefile
@@ -618,7 +618,8 @@ ${BUILD_DIR}/intermediate/%: clear-go-build-cache-if-needed .FOR
@ # 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
@ # the computed build ID for this binary.
- ${Q}go build -o "$@" -ldflags '-B 0x${TEMPORARY_BUILD_ID} ${GO_LDFLAGS}' -tags "${GO_BUILD_TAGS}" $(addprefix ${SOURCE_DIR}/cmd/,$(@F))
+ @ # We cd to SOURCE_DIR to avoid corner cases where workdir may be a symlink
+ ${Q}cd ${SOURCE_DIR} && go build -o "$@" -ldflags '-B 0x${TEMPORARY_BUILD_ID} ${GO_LDFLAGS}' -tags "${GO_BUILD_TAGS}" $(addprefix ${SOURCE_DIR}/cmd/,$(@F))
# This is a build hack to avoid excessive rebuilding of targets. Instead of
# depending on the Makefile, we start to depend on tool versions as defined in