summaryrefslogtreecommitdiffstats
path: root/include/download.mk
diff options
context:
space:
mode:
authorKarsten Sperling <ksperling@apple.com>2023-03-16 14:17:26 +1300
committerPetr Štetiar <ynezz@true.cz>2023-07-28 09:00:49 +0200
commit350d9a34623374b54d2f953917466a5db9ec1dc1 (patch)
tree4af73470d42da76ad1089f021c732bba83612e3a /include/download.mk
parentedd146c9202a5ef1195eafeb9e9e51f3de34c229 (diff)
downloadopenwrt-350d9a34623374b54d2f953917466a5db9ec1dc1.tar.gz
openwrt-350d9a34623374b54d2f953917466a5db9ec1dc1.tar.bz2
openwrt-350d9a34623374b54d2f953917466a5db9ec1dc1.zip
build: make git sub-modules to fetch configurable
Currently the git protocol downloads all submodules of the target repository. This can be unwieldy for repositories with a lot of submodules where only a subset are required in the context of the OpenWrt build. This change adds a PKG_SOURCE_SUBMODULES variable to configure this behavior. It takes a space-separated list of submodule paths, or the word "skip" to disable submodule downloads entirely. The default is to download all submodules, i.e. preserving current behavior. Signed-off-by: Karsten Sperling <ksperling@apple.com>
Diffstat (limited to 'include/download.mk')
-rw-r--r--include/download.mk5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/download.mk b/include/download.mk
index 9ab0b6c08f..e261b14035 100644
--- a/include/download.mk
+++ b/include/download.mk
@@ -209,6 +209,7 @@ define DownloadMethod/github_archive
--subdir="$(SUBDIR)" \
--source="$(FILE)" \
--hash="$(MIRROR_HASH)" \
+ --submodules $(SUBMODULES) \
|| ( $(call DownloadMethod/rawgit) ); \
)
endef
@@ -222,7 +223,7 @@ define DownloadMethod/rawgit
[ \! -d $(SUBDIR) ] && \
git clone $(OPTS) $(URL) $(SUBDIR) && \
(cd $(SUBDIR) && git checkout $(VERSION) && \
- git submodule update --init --recursive) && \
+ $(if $(filter skip,$(SUBMODULES)),true,git submodule update --init --recursive -- $(SUBMODULES))) && \
echo "Packing checkout..." && \
export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \
rm -rf $(SUBDIR)/.git && \
@@ -301,6 +302,7 @@ define Download/Defaults
MIRROR_MD5SUM:=x
VERSION:=
OPTS:=
+ SUBMODULES:=
endef
define Download/default
@@ -309,6 +311,7 @@ define Download/default
URL_FILE:=$(PKG_SOURCE_URL_FILE)
SUBDIR:=$(PKG_SOURCE_SUBDIR)
PROTO:=$(PKG_SOURCE_PROTO)
+ SUBMODULES:=$(PKG_SOURCE_SUBMODULES)
$(if $(PKG_SOURCE_MIRROR),MIRROR:=$(filter 1,$(PKG_MIRROR)))
$(if $(PKG_MIRROR_MD5SUM),MIRROR_MD5SUM:=$(PKG_MIRROR_MD5SUM))
$(if $(PKG_MIRROR_HASH),MIRROR_HASH:=$(PKG_MIRROR_HASH))