diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-10-19 09:14:25 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-10-20 16:55:18 +0300 |
commit | b93774f6586125a8865910832db4fceddd5d76c2 (patch) | |
tree | 6fa500a58268cf35da0c0345f5c04c5399504a03 | |
parent | aec413230e6bce8782ae72d95d2d3cb312ebe923 (diff) |
Makefile: Stop installing binaries into source dir
With commit eb6fd6056 (Makefile: Stop installing binaries into source
dir, 2021-05-07), we stopped installing Gitaly binaries into its root
directory given that all users should either use the installed location,
or alternatively use the directory in "_build/bin". This change had been
reverted due to a regression, where the init.d script in Rails was still
using the old location of Gitaly [1]. The issue has since been fixed by
adjusting paths in the script to point into our build directory.
Reintroduce the change and stop installing binaries into the root
directory. To avoid existing installations from silently continuing to
use the old, outdated binaries, we also delete them from the source
directory.
[1]: https://gitlab.com/gitlab-org/gitlab/-/issues/331758
-rw-r--r-- | .gitignore | 12 | ||||
-rw-r--r-- | Makefile | 16 |
2 files changed, 11 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore index f202b4557..8e0817d8f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,3 @@ -# Top-level executables -/gitaly -/gitaly-backup -/gitaly-blackbox -/gitaly-debug -/gitaly-git2go-v* -/gitaly-hooks -/gitaly-lfs-smudge -/gitaly-ssh -/gitaly-wrapper -/praefect - # Generic artifacts /_build/ /*.deb @@ -253,10 +253,8 @@ export CGO_LDFLAGS_ALLOW = -D_THREAD_SAFE .SECONDARY: .PHONY: all -## Default target which builds and installs Gitaly binaries into the root -## source directory. -all: INSTALL_DEST_DIR = ${SOURCE_DIR} -all: install +## Default target which builds Gitaly. +all: build ## Print help about available targets and variables. help: @@ -282,6 +280,14 @@ help: .PHONY: build ## Build Go binaries and install required Ruby Gems. build: ${SOURCE_DIR}/.ruby-bundle libgit2 + ${Q}# We used to install Gitaly binaries into the source directory by default when executing + ${Q}# "make" or "make all", which has been changed in v14.5 to only build binaries into + ${Q}# `_build/bin`. In order to quickly fail in case any source install still refers to these + ${Q}# old binaries, we delete them from the source directory. Otherwise, it may happen that a + ${Q}# source install continues to use the old set of binaries that wasn't updated at all. + ${Q}# This safety guard can go away in v14.6. + ${Q}rm -f $(addprefix ${SOURCE_DIR}/,$(notdir $(call find_commands)) gitaly-git2go-v14) + go install ${GO_LDFLAGS} -tags "${GO_BUILD_TAGS}" $(addprefix ${GITALY_PACKAGE}/cmd/, $(call find_commands)) ${Q}# We use version suffix for the gitaly-git2go binary to support compatibility contract between ${Q}# gitaly and gitaly-git2go during upgrade deployment. @@ -380,7 +386,7 @@ notice: ${SOURCE_DIR}/NOTICE .PHONY: clean ## Clean up build artifacts. clean: - rm -rf ${BUILD_DIR} ${SOURCE_DIR}/internal/testhelper/testdata/data/ ${SOURCE_DIR}/ruby/.bundle/ ${SOURCE_DIR}/ruby/vendor/bundle/ $(addprefix ${SOURCE_DIR}/, $(notdir $(call find_commands))) + rm -rf ${BUILD_DIR} ${SOURCE_DIR}/internal/testhelper/testdata/data/ ${SOURCE_DIR}/ruby/.bundle/ ${SOURCE_DIR}/ruby/vendor/bundle/ .PHONY: clean-ruby-vendor-go clean-ruby-vendor-go: |