diff options
author | James Ennis <james.ennis@codethink.co.uk> | 2019-08-16 11:05:52 +0100 |
---|---|---|
committer | James Ennis <james.ennis@codethink.co.uk> | 2019-08-27 15:21:34 +0100 |
commit | abbcc263563d6c3bd7b76f815576bf6f2da96707 (patch) | |
tree | 47b4a4ca62287a0439db13e0710a3446e0ebc887 /src/buildstream/_frontend/widget.py | |
parent | 84fc72e064c2eebf6e0e2179cb482ceecac6ea9b (diff) | |
download | buildstream-abbcc263563d6c3bd7b76f815576bf6f2da96707.tar.gz |
cli.py: Introduce bst artifact show
bst artifact show can be used to determine which element names,
artifact refs (also by glob expression) are present within the
artifact cache.
Diffstat (limited to 'src/buildstream/_frontend/widget.py')
-rw-r--r-- | src/buildstream/_frontend/widget.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/buildstream/_frontend/widget.py b/src/buildstream/_frontend/widget.py index 955680f9b..85fb00768 100644 --- a/src/buildstream/_frontend/widget.py +++ b/src/buildstream/_frontend/widget.py @@ -827,3 +827,38 @@ class LogLine(Widget): text += '\n' return text + + # show_state_of_artifacts() + # + # Show the cached status of artifacts + # + # Example output: + # + # "cached foo.bst" <- If cached locally + # "failed foo.bst" <- If cached locally as a failure + # "available foo.bst" <- If available to download from a remote + # "not cached foo.bst" <- If not cached/available remotely. + # + # Note that artifact names may also be displayed here. + # + # Args: + # targets (list [Element]): Elements (or ArtifactElements) we wish to show the + # cached status of + # + def show_state_of_artifacts(self, targets): + report = '' + p = Profile() + for element in targets: + line = '%{state: >12} %{name}' + line = p.fmt_subst(line, 'name', element.name, fg='yellow') + + if element._cached_success(): + line = p.fmt_subst(line, 'state', "cached", fg='magenta') + elif element._cached(): + line = p.fmt_subst(line, 'state', "failed", fg='red') + else: + line = p.fmt_subst(line, 'state', "not cached", fg='bright_red') + + report += line + '\n' + + return report |