diff options
author | Will Chandler <wchandler@gitlab.com> | 2022-08-01 22:11:57 +0300 |
---|---|---|
committer | Will Chandler <wchandler@gitlab.com> | 2022-08-01 22:23:05 +0300 |
commit | 2a031fdca0745417c59b15a0d6f8f2d02d4e2e2c (patch) | |
tree | 01d7835f0af4cac40006cb9029427638a4e58a07 | |
parent | 445024454b60b661cc7bc7782c9e9367517f42e2 (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-- | Makefile | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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} |