summaryrefslogtreecommitdiffstats
path: root/scripts
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 /scripts
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 'scripts')
-rwxr-xr-xscripts/dl_github_archive.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/dl_github_archive.py b/scripts/dl_github_archive.py
index 328d588e78..580b7cba38 100755
--- a/scripts/dl_github_archive.py
+++ b/scripts/dl_github_archive.py
@@ -239,6 +239,7 @@ class DownloadGitHubTarball(object):
self.version = args.version
self.subdir = args.subdir
self.source = args.source
+ self.submodules = args.submodules
self.url = args.url
self._init_owner_repo()
self.xhash = args.hash
@@ -249,6 +250,8 @@ class DownloadGitHubTarball(object):
def download(self):
"""Download and repack GitHub archive tarball."""
+ if self.submodules and self.submodules != ['skip']:
+ raise self._error('Fetching submodules is not yet supported')
self._init_commit_ts()
with Path(TMPDIR_DL, keep=True) as dir_dl:
# fetch tarball from GitHub
@@ -262,7 +265,7 @@ class DownloadGitHubTarball(object):
dir0 = os.path.join(dir_untar.path, tarball_prefix)
dir1 = os.path.join(dir_untar.path, self.subdir)
# submodules check
- if self._has_submodule(dir0):
+ if self.submodules != ['skip'] and self._has_submodule(dir0):
raise self._error('Fetching submodules is not yet supported')
# rename subdir
os.rename(dir0, dir1)
@@ -415,6 +418,7 @@ def main():
parser.add_argument('--version', help='Source code version')
parser.add_argument('--source', help='Source tarball filename')
parser.add_argument('--hash', help='Source tarball\'s expected sha256sum')
+ parser.add_argument('--submodules', nargs='*', help='List of submodules, or "skip"')
args = parser.parse_args()
try:
method = DownloadGitHubTarball(args)