diff options
author | Tristan van Berkom <tristan@codethink.co.uk> | 2020-12-10 22:34:00 +0900 |
---|---|---|
committer | Tristan van Berkom <tristan@codethink.co.uk> | 2020-12-11 15:02:47 +0900 |
commit | 66120e67e729ef8cb0a1e29905c432b7a28545f1 (patch) | |
tree | 1200cc16a8087e02df5009ec7f99270e2e470a69 | |
parent | 75eb8c1868ec0fa1cc8366ebb0b1db2db06c270f (diff) | |
download | buildstream-66120e67e729ef8cb0a1e29905c432b7a28545f1.tar.gz |
_stream.py, _frontend/widget.py: Fix weird hacktristan/fix-artifact-name-hack
When stream is asked for a list of artifacts to show for
the purpose of `bst artifact show`, it was squashing the element
name with the artifact name before it gets displayed in the
frontend.
Instead, make the special casing in the frontend.
-rw-r--r-- | src/buildstream/_frontend/widget.py | 13 | ||||
-rw-r--r-- | src/buildstream/_stream.py | 6 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/buildstream/_frontend/widget.py b/src/buildstream/_frontend/widget.py index 0f2b07ed3..0d5379f43 100644 --- a/src/buildstream/_frontend/widget.py +++ b/src/buildstream/_frontend/widget.py @@ -32,6 +32,7 @@ from .. import __version__ as bst_version from .._exceptions import BstError, ImplError from .._message import MessageType from ..storage.directory import _FileType +from .._artifactelement import ArtifactElement # These messages are printed a bit differently ERROR_MESSAGES = [MessageType.FAIL, MessageType.ERROR, MessageType.BUG] @@ -902,8 +903,18 @@ class LogLine(Widget): report = "" p = Profile() for element in targets: + + # + # Here we selectively show the element name or artifact name + # depending on whether we were asked about an artifact or an element. + # + if isinstance(element, ArtifactElement): + element_name = element.get_artifact_name() + else: + element_name = element._get_full_name() + line = "%{state: >12} %{name}" - line = p.fmt_subst(line, "name", element.name, fg="yellow") + line = p.fmt_subst(line, "name", element_name, fg="yellow") if element._cached_success(): line = p.fmt_subst(line, "state", "cached", fg="magenta") diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index b50be2a0d..0aff5fb94 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -617,12 +617,6 @@ class Stream: if self._artifacts.has_fetch_remotes(): self._pipeline.check_remotes(target_objects) - # XXX: We need to set the name of an ArtifactElement to its ref in order - # to display the expected result in the frontend - for obj in target_objects: - if isinstance(obj, ArtifactElement): - obj.name = obj.get_artifact_name() - return target_objects # artifact_log() |