summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2018-12-10 10:42:45 +0000
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-12-10 10:42:45 +0000
commitf70eba734a937f54719de657ca1c38a9b7801e0c (patch)
tree26696ced20508b09b1809dd2c17388a3b40e254b
parentdc85c5e7507cffb6cfa6185d599033ab4404e980 (diff)
parent839ef77400635bac930344d1f5f3ba3cbb682139 (diff)
downloadbuildstream-f70eba734a937f54719de657ca1c38a9b7801e0c.tar.gz
Merge branch 'tristan/avoid-unused-submodules-1.2' into 'bst-1.2'
[backport 1.2] Avoid downloading unused git submodules See merge request BuildStream/buildstream!1001
-rw-r--r--buildstream/plugins/sources/git.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py
index de0376776..1ff2f3287 100644
--- a/buildstream/plugins/sources/git.py
+++ b/buildstream/plugins/sources/git.py
@@ -421,13 +421,7 @@ class GitSource(Source):
with self.timed_activity("Staging {}".format(self.mirror.url), silent_nested=True):
self.mirror.stage(directory)
for mirror in self.submodules:
- if mirror.path in self.submodule_checkout_overrides:
- checkout = self.submodule_checkout_overrides[mirror.path]
- else:
- checkout = self.checkout_submodules
-
- if checkout:
- mirror.stage(directory)
+ mirror.stage(directory)
def get_source_fetchers(self):
yield self.mirror
@@ -465,6 +459,10 @@ class GitSource(Source):
#
for path, url in self.mirror.submodule_list():
+ # Completely ignore submodules which are disabled for checkout
+ if self.ignore_submodule(path):
+ continue
+
# Allow configuration to override the upstream
# location of the submodules.
override_url = self.submodule_overrides.get(path)
@@ -478,6 +476,16 @@ class GitSource(Source):
self.submodules = submodules
+ # Checks whether the plugin configuration has explicitly
+ # configured this submodule to be ignored
+ def ignore_submodule(self, path):
+ try:
+ checkout = self.submodule_checkout_overrides[path]
+ except KeyError:
+ checkout = self.checkout_submodules
+
+ return not checkout
+
# Plugin entry point
def setup():