1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg: ensure "dynamic sparse paths" are up-to-date

This commit is contained in:
Kaspar Schleiser 2024-01-29 23:10:22 +01:00
parent 2bb2016e23
commit f9afdf86d0

View File

@ -128,8 +128,24 @@ $(PKG_DOWNLOADED): $(MAKEFILE_LIST) | $(PKG_SOURCE_DIR)/.git
fi
$(Q)echo $(PKG_VERSION) > $@
# This snippet ensures that for packages that have dynamic sparse paths (e.g.,
# pkg/cmsis), the sparse paths of the time of checkout are the same as needed
# now.
# E.g., build a) only needs CMSIS/Core. Build b) also needs CMSIS/DSP.
# If b) is built after a) and the cmsis checkout does not contain CMSIS/DSP,
# the sources need to be checked out again.
# (Inside, this is doing an ad-hoc "|$(LAZYSPONGE)", but using the python version turned out
# to be significantly slower).
ifneq (, $(PKG_SPARSE_PATHS))
PKG_SPARSE_TAG = $(PKG_SOURCE_DIR).sparse
$(PKG_SPARSE_TAG): FORCE
$(Q)if test -f $@; then \
test "$$(cat $@)" = "$(PKG_SPARSE_PATHS)" && exit 0; \
fi ; mkdir -p $$(dirname $@) && echo "$(PKG_SPARSE_PATHS)" > $@
endif
ifneq (,$(GIT_CACHE_RS))
$(PKG_SOURCE_DIR)/.git: | $(PKG_CUSTOM_PREPARED)
$(PKG_SOURCE_DIR)/.git: $(PKG_SPARSE_TAG) | $(PKG_CUSTOM_PREPARED)
$(if $(QUIETER),,$(info [INFO] cloning $(PKG_NAME)))
$(Q)rm -Rf $(PKG_SOURCE_DIR)
$(Q)$(GIT_CACHE_RS) clone --commit $(PKG_VERSION) $(addprefix --sparse-add ,$(PKG_SPARSE_PATHS)) -- $(PKG_URL) $(PKG_SOURCE_DIR)