summaryrefslogtreecommitdiff
path: root/src/buildstream/_frontend
diff options
context:
space:
mode:
authorJames Ennis <james.ennis@codethink.co.uk>2019-08-08 12:40:53 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-08-09 09:50:15 +0000
commit0b18d8207e46dbf0420eb0ae329b5346e80c7b7b (patch)
tree0fc5d79b7fbbd1d1dd00be9dd6937425fb3db60d /src/buildstream/_frontend
parentda0c998a8acbaef5177ccdd5d337b081b0a04f5c (diff)
downloadbuildstream-0b18d8207e46dbf0420eb0ae329b5346e80c7b7b.tar.gz
Frontend: Fix bst artifact log
This command now fetches the absolute paths of the log files in the local CAS cache and opens a pager for each path. The test has also been updated to ensure that a log file is actually obtained.
Diffstat (limited to 'src/buildstream/_frontend')
-rw-r--r--src/buildstream/_frontend/cli.py26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index 81ee4ad83..220d10477 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -1,8 +1,6 @@
import os
import sys
-from contextlib import ExitStack
from functools import partial
-from tempfile import TemporaryDirectory
import fcntl
import click
@@ -1196,23 +1194,13 @@ def artifact_log(app, artifacts):
# they are not somehow escaped.
with app.initialized():
- logsdirs = app.stream.artifact_log(artifacts)
-
- with ExitStack() as stack:
- extractdirs = []
- for logsdir in logsdirs:
- # NOTE: If reading the logs feels unresponsive, here would be a good place
- # to provide progress information.
- td = stack.enter_context(TemporaryDirectory())
- logsdir.export_files(td, can_link=True)
- extractdirs.append(td)
-
- for extractdir in extractdirs:
- for log in (os.path.join(extractdir, log) for log in os.listdir(extractdir)):
- # NOTE: Should click gain the ability to pass files to the pager this can be optimised.
- with open(log) as f:
- data = f.read()
- click.echo_via_pager(data)
+ log_file_paths = app.stream.artifact_log(artifacts)
+
+ for log in log_file_paths:
+ with open(log) as f:
+ data = f.read()
+
+ click.echo_via_pager(data)
###################################################################