From da0c998a8acbaef5177ccdd5d337b081b0a04f5c Mon Sep 17 00:00:00 2001 From: James Ennis Date: Thu, 8 Aug 2019 12:40:05 +0100 Subject: artifact.py,element.py: Add get_logs() methods --- src/buildstream/_artifact.py | 16 ++++++++++++++++ src/buildstream/element.py | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/src/buildstream/_artifact.py b/src/buildstream/_artifact.py index b6b07ecc1..1512a10a5 100644 --- a/src/buildstream/_artifact.py +++ b/src/buildstream/_artifact.py @@ -89,6 +89,22 @@ class Artifact(): return CasBasedDirectory(self._cas, digest=buildtree_digest) + # get_logs(): + # + # Get the paths of the artifact's logs + # + # Returns: + # (list): A list of object paths + # + def get_logs(self): + artifact = self._get_proto() + + logfile_paths = [] + for logfile in artifact.logs: + logfile_paths.append(self._cas.objpath(logfile.digest)) + + return logfile_paths + # get_extract_key(): # # Get the key used to extract the artifact diff --git a/src/buildstream/element.py b/src/buildstream/element.py index 208bc35b2..240e8ce7d 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -925,6 +925,14 @@ class Element(Plugin): self.__batch_prepare_assemble_flags = flags self.__batch_prepare_assemble_collect = collect + def get_logs(self): + """Obtain a list of log file paths + + Returns: + (list): A list of log file paths + """ + return self.__artifact.get_logs() + ############################################################# # Private Methods used in BuildStream # ############################################################# -- cgit v1.2.1