lorax-wrapper: Put all log files into compose logs
Tell lorax to use a specific directory for log files so that we preserve them despite koji not having any idea about them. Fixes: #457 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
4427769f6a
commit
9a72ea8f6d
@ -28,7 +28,7 @@ from productmd.images import Image
|
||||
|
||||
from pungi.arch import get_valid_arches
|
||||
from pungi.util import get_buildroot_rpms, get_volid, get_arch_variant_data
|
||||
from pungi.util import get_file_size, get_mtime, failable
|
||||
from pungi.util import get_file_size, get_mtime, failable, makedirs
|
||||
from pungi.wrappers.lorax import LoraxWrapper
|
||||
from pungi.wrappers.kojiwrapper import KojiWrapper
|
||||
from pungi.wrappers import iso
|
||||
@ -64,6 +64,13 @@ class BuildinstallPhase(PhaseBase):
|
||||
if not data.get('nomacboot', True):
|
||||
nomacboot = False
|
||||
output_dir = os.path.join(output_dir, variant.uid)
|
||||
|
||||
# The paths module will modify the filename (by inserting arch). But we
|
||||
# only care about the directory anyway.
|
||||
log_filename = 'buildinstall-%s-logs/dumym' % variant.uid
|
||||
log_dir = os.path.dirname(self.compose.paths.log.log_file(arch, log_filename))
|
||||
makedirs(log_dir)
|
||||
|
||||
lorax = LoraxWrapper()
|
||||
lorax_cmd = lorax.get_lorax_cmd(self.compose.conf["release_name"],
|
||||
self.compose.conf["release_version"],
|
||||
@ -77,7 +84,8 @@ class BuildinstallPhase(PhaseBase):
|
||||
volid=volid,
|
||||
nomacboot=nomacboot,
|
||||
bugurl=bugurl,
|
||||
noupgrade=noupgrade)
|
||||
noupgrade=noupgrade,
|
||||
log_dir=log_dir)
|
||||
return 'rm -rf %s && %s' % (pipes.quote(output_dir),
|
||||
' '.join([pipes.quote(x) for x in lorax_cmd]))
|
||||
|
||||
|
@ -25,7 +25,8 @@ class LoraxWrapper(object):
|
||||
variant=None, bugurl=None, nomacboot=False, noupgrade=False,
|
||||
is_final=False, buildarch=None, volid=None, buildinstallpackages=None,
|
||||
add_template=None, add_arch_template=None,
|
||||
add_template_var=None, add_arch_template_var=None):
|
||||
add_template_var=None, add_arch_template_var=None,
|
||||
log_dir=None):
|
||||
cmd = ["lorax"]
|
||||
cmd.append("--product=%s" % product)
|
||||
cmd.append("--version=%s" % version)
|
||||
@ -63,6 +64,9 @@ class LoraxWrapper(object):
|
||||
cmd.extend(process_args('--add-template-var=%s', add_template_var))
|
||||
cmd.extend(process_args('--add-arch-template-var=%s', add_arch_template_var))
|
||||
|
||||
if log_dir:
|
||||
cmd.append('--logfile=%s' % os.path.join(log_dir, 'lorax.log'))
|
||||
|
||||
output_dir = os.path.abspath(output_dir)
|
||||
cmd.append(output_dir)
|
||||
|
||||
|
@ -88,17 +88,20 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
self.topdir + '/work/x86_64/buildinstall/Server',
|
||||
buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
bugurl=None),
|
||||
bugurl=None,
|
||||
log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1', self.topdir + '/work/amd64/repo',
|
||||
self.topdir + '/work/amd64/buildinstall/Server',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
bugurl=None),
|
||||
bugurl=None,
|
||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1', self.topdir + '/work/amd64/repo',
|
||||
self.topdir + '/work/amd64/buildinstall/Client',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Client', buildinstallpackages=[],
|
||||
bugurl=None)])
|
||||
bugurl=None,
|
||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')])
|
||||
self.assertItemsEqual(
|
||||
get_volid.mock_calls,
|
||||
[mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='DVD'),
|
||||
@ -139,7 +142,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
self.topdir + '/work/amd64/buildinstall/Client',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Client', buildinstallpackages=[],
|
||||
bugurl=None)],
|
||||
bugurl=None,
|
||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')],
|
||||
any_order=True)
|
||||
self.assertItemsEqual(
|
||||
get_volid.mock_calls,
|
||||
@ -229,17 +233,20 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
self.topdir + '/work/x86_64/buildinstall/Server',
|
||||
buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
bugurl='http://example.com'),
|
||||
bugurl='http://example.com',
|
||||
log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1', self.topdir + '/work/amd64/repo',
|
||||
self.topdir + '/work/amd64/buildinstall/Server',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
bugurl=None),
|
||||
bugurl=None,
|
||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1', self.topdir + '/work/amd64/repo',
|
||||
self.topdir + '/work/amd64/buildinstall/Client',
|
||||
buildarch='amd64', is_final=True, nomacboot=False, noupgrade=True,
|
||||
volid='vol_id', variant='Client', buildinstallpackages=[],
|
||||
bugurl=None)])
|
||||
bugurl=None,
|
||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')])
|
||||
self.assertItemsEqual(
|
||||
get_volid.mock_calls,
|
||||
[mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='dvd'),
|
||||
@ -289,17 +296,20 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
self.topdir + '/work/x86_64/buildinstall/Server',
|
||||
buildarch='x86_64', is_final=True, nomacboot=False, noupgrade=False,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
bugurl=None),
|
||||
bugurl=None,
|
||||
log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1', self.topdir + '/work/amd64/repo',
|
||||
self.topdir + '/work/amd64/buildinstall/Server',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
bugurl=None),
|
||||
bugurl=None,
|
||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1', self.topdir + '/work/amd64/repo',
|
||||
self.topdir + '/work/amd64/buildinstall/Client',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False,
|
||||
volid='vol_id', variant='Client', buildinstallpackages=[],
|
||||
bugurl=None)])
|
||||
bugurl=None,
|
||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')])
|
||||
self.assertItemsEqual(
|
||||
get_volid.mock_calls,
|
||||
[mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='dvd'),
|
||||
|
@ -41,7 +41,8 @@ class LoraxWrapperTest(unittest.TestCase):
|
||||
add_template=['t1', 't2'],
|
||||
add_arch_template=['ta1', 'ta2'],
|
||||
add_template_var=['v1', 'v2'],
|
||||
add_arch_template_var=['va1', 'va2'])
|
||||
add_arch_template_var=['va1', 'va2'],
|
||||
log_dir='/tmp')
|
||||
|
||||
self.assertEqual(cmd[0], 'lorax')
|
||||
self.assertItemsEqual(cmd[1:],
|
||||
@ -56,6 +57,7 @@ class LoraxWrapperTest(unittest.TestCase):
|
||||
'--add-arch-template=ta1', '--add-arch-template=ta2',
|
||||
'--add-template-var=v1', '--add-template-var=v2',
|
||||
'--add-arch-template-var=va1', '--add-arch-template-var=va2',
|
||||
'--logfile=/tmp/lorax.log',
|
||||
'/mnt/output_dir'])
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user