diff options
Diffstat (limited to 'src/buildstream/element.py')
-rw-r--r-- | src/buildstream/element.py | 27 |
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(): # |