diff options
Diffstat (limited to 'src/buildstream/_stream.py')
-rw-r--r-- | src/buildstream/_stream.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index cbd635af7..ad5bb89f7 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -617,6 +617,30 @@ class Stream(): return logsdirs + # artifact_list_contents() + # + # Show a list of contents of an artifact + # + # Args: + # targets (str): Targets to view the contents of + # + # Returns: + # elements_to_files (list): A list of tuples of the artifact name and it's contents + # + def artifact_list_contents(self, targets): + # Return list of Element and/or ArtifactElement objects + target_objects = self.load_selection(targets, selection=PipelineSelection.NONE, load_refs=True) + + elements_to_files = {} + for obj in target_objects: + if isinstance(obj, ArtifactElement): + obj.name = obj.get_artifact_name() + files = obj.get_artifact_relative_file_paths() + if files == []: + files = ["This element has no associated artifacts"] + elements_to_files[obj.name] = files + return elements_to_files + # artifact_delete() # # Remove artifacts from the local cache |