diff options
author | Tristan van Berkom <tristan@codethink.co.uk> | 2020-09-24 17:56:15 +0900 |
---|---|---|
committer | Tristan van Berkom <tristan@codethink.co.uk> | 2020-09-24 18:09:58 +0900 |
commit | fad0b9ded9b945d4ae54bc0c620e750ab57d327e (patch) | |
tree | c534c2e14f090b5abe41199c96f57b43c3ef7100 /src/buildstream/_elementsources.py | |
parent | b583317c7954d29fce60728486537e945e0d9c28 (diff) | |
download | buildstream-fad0b9ded9b945d4ae54bc0c620e750ab57d327e.tar.gz |
_elementsources.py: Raise SkipJob() when tracking is unimplemented by all sources
This ensures we get a SKIP message instead of a SUCCESS message when
tracking an element where all of it's sources did not implement track(),
which is the case for sources like `local`, `workspace` or `patch`.
Diffstat (limited to 'src/buildstream/_elementsources.py')
-rw-r--r-- | src/buildstream/_elementsources.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/buildstream/_elementsources.py b/src/buildstream/_elementsources.py index c030591f8..eed847e75 100644 --- a/src/buildstream/_elementsources.py +++ b/src/buildstream/_elementsources.py @@ -20,6 +20,7 @@ from contextlib import contextmanager from typing import TYPE_CHECKING, Iterator from . import _cachekey, utils +from ._exceptions import SkipJob from ._context import Context from ._protos.buildstream.v2 import source_pb2 from .plugin import Plugin @@ -109,6 +110,12 @@ class ElementSources: ) source.warn("Updated reference will be ignored as source has open workspace", detail=detail) + # Sources which do not implement track() will return None, produce + # a SKIP message in the UI if all sources produce None + # + if all(ref is None for _, ref in refs): + raise SkipJob("Element sources are not trackable") + return refs # stage_and_cache(): |