summaryrefslogtreecommitdiff
path: root/src/buildstream/source.py
diff options
context:
space:
mode:
authorDarius Makovsky <traveltissues@protonmail.com>2019-11-06 09:29:49 +0000
committerDarius Makovsky <traveltissues@protonmail.com>2019-11-11 13:44:52 +0000
commitc76c918a7febda4ef4253f8a9a957276d8ebb614 (patch)
tree3e3b93870fa395e7ea1c318daafcf6125212aa2d /src/buildstream/source.py
parente0ec80385502d04bbed8fa879b1e9db0f674018b (diff)
downloadbuildstream-c76c918a7febda4ef4253f8a9a957276d8ebb614.tar.gz
Add _is_trackable() method to Source()
This method reports whether the source can be tracked. This would be false for sources advertising BST_KEY_REQUIRES_STAGE. Element tracking can be skipped if none of the held sources can be tracked. This is determined by the value of the `Element.__tracking_scheduled` attribute which is set in `Element._schedule_tracking()`. This is set to `True` if at least one source can be tracked. Also remove some of the tracking handling from `_stream._load` to `_stream.track` where it is more relevant. closes #1186
Diffstat (limited to 'src/buildstream/source.py')
-rw-r--r--src/buildstream/source.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/buildstream/source.py b/src/buildstream/source.py
index 5321363a4..05a1ae464 100644
--- a/src/buildstream/source.py
+++ b/src/buildstream/source.py
@@ -1087,6 +1087,16 @@ class Source(Plugin):
return new_ref
+ # _is_trackable()
+ #
+ # Returns:
+ # (bool): Whether this source is trackable
+ #
+ def _is_trackable(self) -> bool:
+ """Report whether this source can be tracked."""
+ # sources that require staging to generate keys cannot be tracked
+ return not self.BST_KEY_REQUIRES_STAGE
+
# _requires_previous_sources()
#
# If a plugin requires access to previous sources at track or fetch time,