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:
authorWill Chandler <wchandler@gitlab.com>2022-08-01 22:11:57 +0300
committerWill Chandler <wchandler@gitlab.com>2022-08-01 22:23:05 +0300
commit2a031fdca0745417c59b15a0d6f8f2d02d4e2e2c (patch)
tree01d7835f0af4cac40006cb9029427638a4e58a07
parent445024454b60b661cc7bc7782c9e9367517f42e2 (diff)
Makefile: Check if $GOCACHE existswc-makefile-cache-exist
With 6641d296(Clean up go build cache if it exceeds a threshold, 2022-07-28) we now check if the build cache is larger than 4.7 GiB with `du -sk`. However, if `make clean` has just been executed then $GOCACHE does not exist and `make` will emit error: du: /Users/wchandler/devel/gdk/gitaly/_build/cache: No such file or directory bash: line 1: [: -gt: unary operator expected To avoid this, check if $GOCACHE is a directory before running `du`.
-rw-r--r--Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 165f46256..c6ef37e47 100644
--- a/Makefile
+++ b/Makefile
@@ -616,7 +616,7 @@ remove-legacy-go-mod:
# configured in GOCACHE_MAX_SIZE_KB.
.PHONY: clear-go-build-cache-if-needed
clear-go-build-cache-if-needed:
- ${Q}if [ $$(du -sk ${GOCACHE} | cut -f 1) -gt ${GOCACHE_MAX_SIZE_KB} ]; then go clean --cache; fi
+ ${Q}if [ -d ${GOCACHE} ] && [ $$(du -sk ${GOCACHE} | cut -f 1) -gt ${GOCACHE_MAX_SIZE_KB} ]; then go clean --cache; fi
${BUILD_DIR}/intermediate/gitaly: GO_BUILD_TAGS = ${SERVER_BUILD_TAGS}
${BUILD_DIR}/intermediate/gitaly: remove-legacy-go-mod ${GITALY_PACKED_EXECUTABLES}