summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarius Makovsky <traveltissues@protonmail.com>2019-11-07 11:15:55 +0000
committerDarius Makovsky <traveltissues@protonmail.com>2019-11-07 12:41:19 +0000
commita271293f1cb4bba70a28e0fbfd11989cdbcd87be (patch)
tree0374b3e693670280ae8b7487f94f28f0abe72c51
parente82e1387292efc3b71602012a119cd9f4e6937b0 (diff)
downloadbuildstream-traveltissues/1186-4.tar.gz
-rw-r--r--src/buildstream/element.py27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index ab4cad69c..c8d067675 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -257,8 +257,6 @@ class Element(Plugin):
self.__cached_remotely = None # Whether the element is cached remotely
# List of Sources
self.__sources = [] # type: List[Source]
- # At least one of the sources can be tracked (bool)
- self.__has_trackable_sources = None # type: ignore
self.__weak_cache_key = None # Our cached weak cache key
self.__strict_cache_key = None # Our cached cache key for strict builds
self.__artifacts = context.artifactcache # Artifact cache
@@ -1333,25 +1331,22 @@ class Element(Plugin):
# and reinterrogation of element state after tracking of elements
# succeeds.
#
- # If `__has_trackable_sources` is not set, then we haven't yet determined
- # if this element has sources that can be tracked. Set it to True if
- # at least one source advertises that it can be tracked and False
- # otherwise. If it is True then also set `__tracking_scheduled` to True.
+ # This method should return the value of `__tracking_scheduled` to callers
+ # that the element was marked for tracking.
#
- # Return the value `__has_trackable_sources` to communicate this to callers.
+ # If `__tracking_scheduled` is not already determined then set it to `True`
+ # if at least one source advertises that it can be tracked.
#
# Returns:
- # (bool): value of self.__has_trackable_sources
+ # (bool): value of the `__tracking_scheduled` attribute
#
def _schedule_tracking(self) -> bool:
- # Scheduling tracking does not make sense in cases where no sources
- # can be tracked.
- if self.__has_trackable_sources is None:
- self.__has_trackable_sources = any(source.is_trackable() for source in self.__sources)
-
- if self.__has_trackable_sources:
- self.__tracking_scheduled = True
- return self.__has_trackable_sources
+ # if the tracking schedule is already determined then this can be skipped
+ if self.__tracking_scheduled is not True:
+ # Tracking does not make sense in cases where no sources can be tracked.
+ if any(source.is_trackable() for source in self.__sources):
+ self.__tracking_scheduled = True
+ return self.__tracking_scheduled
# _tracking_done():
#