From 23c454ff67c6b20190ca75a7184ce18a1467ea5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Fri, 13 Jul 2018 09:27:11 +0200 Subject: [PATCH] buildinstall: Make output world readable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes it possible to run a compose as non-root user, plus removes the need for workarounds to publish the results directly. Signed-off-by: Lubomír Sedlář --- pungi/phases/buildinstall.py | 4 +++- tests/test_buildinstall.py | 27 ++++++++++++++++++--------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py index eb3a46fe..c77a07c1 100644 --- a/pungi/phases/buildinstall.py +++ b/pungi/phases/buildinstall.py @@ -465,7 +465,9 @@ class BuildinstallThread(WorkerThread): channel=runroot_channel, use_shell=True, task_id=True, packages=packages, mounts=[compose.topdir], - weight=compose.conf['runroot_weights'].get('buildinstall')) + weight=compose.conf['runroot_weights'].get('buildinstall'), + destdir=output_dir, + ) # avoid race conditions? # Kerberos authentication failed: Permission denied in replay cache code (-1765328215) diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index 648a03f8..ff333194 100644 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -745,9 +745,12 @@ class BuildinstallThreadTestCase(PungiTestCase): self.assertItemsEqual( get_runroot_cmd.mock_calls, - [mock.call('rrt', 'x86_64', self.cmd, channel=None, - use_shell=True, task_id=True, - packages=['lorax'], mounts=[self.topdir], weight=123)]) + [mock.call( + 'rrt', 'x86_64', self.cmd, channel=None, + use_shell=True, task_id=True, + packages=['lorax'], mounts=[self.topdir], weight=123, + destdir=os.path.join(self.topdir, "work/x86_64/buildinstall/Server"), + )]) self.assertItemsEqual( run_runroot_cmd.mock_calls, [mock.call(get_runroot_cmd.return_value, @@ -786,9 +789,12 @@ class BuildinstallThreadTestCase(PungiTestCase): self.assertItemsEqual( get_runroot_cmd.mock_calls, - [mock.call('rrt', 'x86_64', self.cmd, channel=None, - use_shell=True, task_id=True, - packages=['anaconda'], mounts=[self.topdir], weight=None)]) + [mock.call( + 'rrt', 'x86_64', self.cmd, channel=None, + use_shell=True, task_id=True, + packages=['anaconda'], mounts=[self.topdir], weight=None, + destdir=os.path.join(self.topdir, "work/x86_64/buildinstall"), + )]) self.assertItemsEqual( run_runroot_cmd.mock_calls, [mock.call(get_runroot_cmd.return_value, @@ -929,9 +935,12 @@ class BuildinstallThreadTestCase(PungiTestCase): self.assertItemsEqual( get_runroot_cmd.mock_calls, - [mock.call('rrt', 'x86_64', self.cmd, channel=None, - use_shell=True, task_id=True, - packages=['lorax'], mounts=[self.topdir], weight=123)]) + [mock.call( + 'rrt', 'x86_64', self.cmd, channel=None, + use_shell=True, task_id=True, + packages=['lorax'], mounts=[self.topdir], weight=123, + destdir="/buildinstall_topdir/buildinstall-%s/x86_64/Server" % os.path.basename(self.topdir), + )]) self.assertItemsEqual( run_runroot_cmd.mock_calls, [mock.call(get_runroot_cmd.return_value,