This patch takes care of writing an artifact's build log to both stdout
and a build log file if the --build-log-on-stdout flag is set.
This series uses tee to write the output to a file as well as to stdout.
Using Popen it should be straight forward to send the output to a pipe and
then read that pipe and write to wherever (stdout plus a logfile in our case).
At the moment morph uses cliapp's runcmd rather than Popen. cliapp's runcmd
is a blocking call, so we're not able to read from the pipe until the
command has completed, which prevents real time logging to a number of files.
One solution to this problem might be to spawn a thread which opens a pipe
to the command being executed, the thread then reads from the pipe and writes
to our collection of logfiles, an attempt at this can be found at ref
The test for the getter that was added to the local artifact cache may not
be worth adding: we may want to just use #pragma: no cover
Richard Ipsum (6):
Add test for get_source_metadata_filename
Add --build-log-on-stdout flag
Add logfile kwarg to staging area runcmd
Use logfile kwarg to generate build log
Make distbuild put worker logs onto stdout
distbuild/worker_build_scheduler.py | 1 +
morphlib/app.py | 3 ++
morphlib/builder2.py | 71 ++++++++++++++++++++++------------
morphlib/localartifactcache.py | 5 ++-
morphlib/localartifactcache_tests.py | 11 ++++++
morphlib/stagingarea.py | 10 ++++-
6 files changed, 75 insertions(+), 26 deletions(-)