From cc3fc8ebb7316a2c0c0c34eabbe680bbc54a5efa Mon Sep 17 00:00:00 2001 From: Karl Fessel Date: Mon, 12 Apr 2021 12:32:49 +0200 Subject: [PATCH] makesystem: clone pkgs without history there is no git clone left since git clone does not support getting specific commits ->: - init empty repo, - setup remote origin - configure - fetch - checkout --- pkg/pkg.mk | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/pkg.mk b/pkg/pkg.mk index 96494f53cd..3825340236 100644 --- a/pkg/pkg.mk +++ b/pkg/pkg.mk @@ -128,11 +128,24 @@ $(PKG_DOWNLOADED): $(MAKEFILE_LIST) | $(PKG_SOURCE_DIR)/.git fi echo $(PKG_VERSION) > $@ +ifeq ($(GIT_CACHE_DIR),$(wildcard $(GIT_CACHE_DIR))) $(PKG_SOURCE_DIR)/.git: | $(PKG_CUSTOM_PREPARED) $(info [INFO] cloning $(PKG_NAME)) $(Q)rm -Rf $(PKG_SOURCE_DIR) $(Q)mkdir -p $(PKG_SOURCE_DIR) $(Q)$(GITCACHE) clone $(PKG_URL) $(PKG_VERSION) $(PKG_SOURCE_DIR) +else +$(PKG_SOURCE_DIR)/.git: | $(PKG_CUSTOM_PREPARED) + $(info [INFO] cloning without cache $(PKG_NAME)) + $(Q)rm -Rf $(PKG_SOURCE_DIR) + $(Q)mkdir -p $(PKG_SOURCE_DIR) + $(Q)git init -q $(PKG_SOURCE_DIR) + $(Q)$(GIT_IN_PKG) remote add origin $(PKG_URL) + $(Q)$(GIT_IN_PKG) config extensions.partialClone origin + $(Q)$(GIT_IN_PKG) config advice.detachedHead false + $(Q)$(GIT_IN_PKG) fetch --depth=1 -t --filter=blob:none origin $(PKG_VERSION) + $(Q)$(GIT_IN_PKG) checkout $(PKG_VERSION) +endif ifeq ($(PKG_SOURCE_DIR),$(PKG_BUILD_DIR)) # This is the case for packages that are built within their source directory