From 6f56e69a142f8f461b8f421e6398baacb26cc38b Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz Date: Mon, 17 Jul 2023 13:16:00 -0300 Subject: [PATCH] system/nxdiag: Fix race condition during build This commit fixed a race condition that might happen by only unshallowing the Espressif HAL only after it was completely cloned. --- system/nxdiag/Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/system/nxdiag/Makefile b/system/nxdiag/Makefile index ca8f7c776..73efc4edd 100644 --- a/system/nxdiag/Makefile +++ b/system/nxdiag/Makefile @@ -67,13 +67,20 @@ ARCH_ESP_HALDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM) # If the esp-hal-3rdparty directory is not in the arch directory, then it can be # cloned to the nxdiag directory for debugging purposes. -HALDIR := $(shell if [ -d $(ARCH_ESP_HALDIR)$(DELIM).git ]; then echo "$(ARCH_ESP_HALDIR)"; else echo "$(NXDIAGDIR)$(DELIM)esp-hal-3rdparty"; fi) +HALDIR := $(shell \ + if [ -f $(ARCH_ESP_HALDIR)$(DELIM).git$(DELIM)index ]; then \ + echo "$(ARCH_ESP_HALDIR)"; \ + else \ + echo "$(NXDIAGDIR)$(DELIM)esp-hal-3rdparty"; \ + fi \ +) INFO_DEPS += espressif_prepare espressif_prepare: ifeq ($(HALDIR),$(ARCH_ESP_HALDIR)) - (cd ${HALDIR} && git fetch -q --depth=10000 && git fetch -q --tags) + @echo "Unshallowing Espressif HAL..." + (cd ${HALDIR} && git fetch --depth=10000 && git fetch --tags) endif ifdef ESPTOOL_BINDIR