Combine mock stderr and stdout logs

Mock doesn't normally log anything to stdout - so it's confusing to mention
separate logs in the messages. Combine the two output streams together.
(This is what koji does as well.)
This commit is contained in:
Owen W. Taylor
2020-10-29 10:20:54 -04:00
parent cd5cf28ce2
commit debfd8a5c5
3 changed files with 17 additions and 24 deletions

View File

@@ -646,11 +646,9 @@ class MockModuleBuilder(GenericBuilder):
mock_config = os.path.join(
self.configdir, "mock-%s.cfg" % str(threading.current_thread().name))
# Open the logs to which we will forward mock stdout/stderr.
mock_stdout_log = open(
os.path.join(self.resultsdir, artifact_name + "-mock-stdout.log"), "w")
mock_stderr_log = open(
os.path.join(self.resultsdir, artifact_name + "-mock-stderr.log"), "w")
# Open the log to which we will forward mock stdout/stderr.
mock_output_log = open(
os.path.join(self.resultsdir, artifact_name + "-mock-output.log"), "w")
srpm = artifact_name
resultsdir = builder.resultsdir
@@ -658,12 +656,11 @@ class MockModuleBuilder(GenericBuilder):
# Initialize mock.
execute_cmd(
["mock", "-v", "-r", mock_config, "--init"],
stdout=mock_stdout_log,
stderr=mock_stderr_log,
output=mock_output_log,
)
# Start the build and store results to resultsdir
builder.build(mock_stdout_log, mock_stderr_log)
builder.build(mock_output_log)
srpm = find_srpm(resultsdir)
# Emit messages simulating complete build. These messages
@@ -687,8 +684,7 @@ class MockModuleBuilder(GenericBuilder):
with open(os.path.join(resultsdir, "status.log"), "w") as f:
f.write("failed\n")
mock_stdout_log.close()
mock_stderr_log.close()
mock_output_log.close()
self._save_log(resultsdir, "state.log", artifact_name)
self._save_log(resultsdir, "root.log", artifact_name)
@@ -810,8 +806,8 @@ class BaseBuilder(object):
self.resultsdir = resultsdir
self.cmd = ["mock", "-v", "-r", config, "--no-clean", "--resultdir=%s" % resultsdir]
def build(self, stdout, stderr):
execute_cmd(self.cmd, stdout=stdout, stderr=stderr)
def build(self, output):
execute_cmd(self.cmd, output=output)
class SRPMBuilder(BaseBuilder):