gather: Hide pid of fus process

There's an environment variable that can suppress printing of PID for
every debug message. It provides us with no real information and only
makes the log larger.

JIRA: COMPOSE-2973
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-09-26 14:13:35 +02:00
parent 4537001ff6
commit e2e8df3f09
2 changed files with 34 additions and 9 deletions

View File

@ -208,7 +208,12 @@ class GatherMethodHybrid(pungi.phases.gather.method.GatherMethodBase):
logfile = self.compose.paths.log.log_file(
arch, "hybrid-depsolver-%s-iter-%d" % (variant, step)
)
run(cmd, logfile=logfile, show_cmd=True)
# Adding this environement variable will tell GLib not to prefix
# any log messages with the PID of the fus process (which is quite
# useless for us anyway).
env = os.environ.copy()
env["G_MESSAGES_PREFIXED"] = ""
run(cmd, logfile=logfile, show_cmd=True, env=env)
output = fus.parse_output(logfile)
new_multilib = self.add_multilib(variant, arch, output)
if new_multilib:

View File

@ -331,7 +331,11 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
self.assertEqual(po.call_args_list, [mock.call(self.logfile1)])
self.assertEqual(
run.call_args_list,
[mock.call(gc.return_value, logfile=self.logfile1, show_cmd=True)],
[
mock.call(
gc.return_value, logfile=self.logfile1, show_cmd=True, env=mock.ANY
)
],
)
self.assertEqual(
gc.call_args_list,
@ -360,7 +364,11 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
self.assertEqual(po.call_args_list, [mock.call(self.logfile1)])
self.assertEqual(
run.call_args_list,
[mock.call(gc.return_value, logfile=self.logfile1, show_cmd=True)],
[
mock.call(
gc.return_value, logfile=self.logfile1, show_cmd=True, env=mock.ANY
)
],
)
self.assertEqual(
gc.call_args_list,
@ -386,8 +394,12 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
self.assertEqual(
run.call_args_list,
[
mock.call(gc.return_value, logfile=self.logfile1, show_cmd=True),
mock.call(gc.return_value, logfile=self.logfile2, show_cmd=True),
mock.call(
gc.return_value, logfile=self.logfile1, show_cmd=True, env=mock.ANY
),
mock.call(
gc.return_value, logfile=self.logfile2, show_cmd=True, env=mock.ANY
),
],
)
self.assertEqual(
@ -448,8 +460,12 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
self.assertEqual(
run.call_args_list,
[
mock.call(gc.return_value, logfile=self.logfile1, show_cmd=True),
mock.call(gc.return_value, logfile=self.logfile2, show_cmd=True),
mock.call(
gc.return_value, logfile=self.logfile1, show_cmd=True, env=mock.ANY
),
mock.call(
gc.return_value, logfile=self.logfile2, show_cmd=True, env=mock.ANY
),
],
)
self.assertEqual(
@ -541,8 +557,12 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
self.assertEqual(
run.call_args_list,
[
mock.call(gc.return_value, logfile=self.logfile1, show_cmd=True),
mock.call(gc.return_value, logfile=self.logfile2, show_cmd=True),
mock.call(
gc.return_value, logfile=self.logfile1, show_cmd=True, env=mock.ANY
),
mock.call(
gc.return_value, logfile=self.logfile2, show_cmd=True, env=mock.ANY
),
],
)
self.assertEqual(