[ostree-installer] Put lorax output into work dir

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-04-08 09:29:05 +02:00
parent 36e7279a5e
commit 81d84a030b
2 changed files with 14 additions and 12 deletions

View File

@ -51,13 +51,15 @@ class OstreeInstallerThread(WorkerThread):
source_variant = compose.variants[config['source_repo_from']]
source_repo = translate_path(
compose, compose.paths.compose.repository(arch, source_variant, create_dir=False))
output_dir = os.path.join(compose.paths.work.topdir(arch), variant.uid, 'ostree_installer')
util.makedirs(os.path.dirname(output_dir))
self._run_ostree_cmd(compose, variant, arch, config, source_repo)
self._run_ostree_cmd(compose, variant, arch, config, source_repo, output_dir)
disc_type = compose.conf.get('disc_types', {}).get('dvd', 'dvd')
filename = compose.get_image_name(arch, variant, disc_type=disc_type,
format=config.get('filename'))
self._copy_image(compose, variant, arch, filename)
self._copy_image(compose, variant, arch, filename, output_dir)
self._add_to_manifest(compose, variant, arch, filename)
self.pool.log_info('[DONE ] %s' % msg)
@ -66,10 +68,9 @@ class OstreeInstallerThread(WorkerThread):
return compose.image_release
return config.get('release', None)
def _copy_image(self, compose, variant, arch, filename):
def _copy_image(self, compose, variant, arch, filename, output_dir):
iso_path = compose.paths.compose.iso_path(arch, variant, filename)
source_dir = compose.paths.compose.os_tree(arch, variant)
boot_iso = os.path.join(source_dir, 'images', 'boot.iso')
boot_iso = os.path.join(output_dir, 'images', 'boot.iso')
try:
os.link(boot_iso, iso_path)
@ -100,15 +101,14 @@ class OstreeInstallerThread(WorkerThread):
pass
compose.im.add(variant.uid, arch, img)
def _run_ostree_cmd(self, compose, variant, arch, config, source_repo):
image_dir = compose.paths.compose.os_tree(arch, variant, create_dir=False)
def _run_ostree_cmd(self, compose, variant, arch, config, source_repo, output_dir):
lorax_wrapper = lorax.LoraxWrapper()
cmd = lorax_wrapper.get_lorax_cmd(
compose.conf['release_name'],
compose.conf["release_version"],
self._get_release(compose, config),
repo_baseurl=source_repo,
output_dir=image_dir,
output_dir=output_dir,
variant=variant.uid,
nomacboot=True,
buildinstallpackages=config.get('installpkgs'),

View File

@ -143,7 +143,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
'--source=file://{}/compose/Everything/x86_64/os'.format(self.topdir),
'--variant=Everything',
'--nomacboot',
self.topdir + '/compose/Everything/x86_64/os'],
self.topdir + '/work/x86_64/Everything/ostree_installer'],
channel=None, mounts=[self.topdir],
packages=['pungi', 'lorax'],
task_id=True, use_shell=True)])
@ -151,7 +151,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
[mock.call(koji.get_runroot_cmd.return_value,
log_file=self.topdir + '/logs/x86_64/ostree/runroot.log')])
self.assertEqual(link.call_args_list,
[mock.call(self.topdir + '/compose/Everything/x86_64/os/images/boot.iso',
[mock.call(self.topdir + '/work/x86_64/Everything/ostree_installer/images/boot.iso',
final_iso_path)])
self.assertEqual(get_file_size.call_args_list, [mock.call(final_iso_path)])
self.assertEqual(get_mtime.call_args_list, [mock.call(final_iso_path)])
@ -159,6 +159,8 @@ class OstreeThreadTest(helpers.PungiTestCase):
self.assertEqual(compose.get_image_name.call_args_list,
[mock.call('x86_64', compose.variants['Everything'],
disc_type='dvd', format='Fedora-Atomic.iso')])
self.assertTrue(os.path.isdir(self.topdir + '/work/x86_64/Everything/'))
self.assertFalse(os.path.isdir(self.topdir + '/work/x86_64/Everything/ostree_installer'))
@mock.patch('productmd.images.Image')
@mock.patch('pungi.util.get_mtime')
@ -222,7 +224,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
'--add-arch-template-var=ostree_repo=https://kojipkgs.fedoraproject.org/compose/atomic/Rawhide/',
'--add-arch-template-var=ostree_osname=fedora-atomic',
'--add-arch-template-var=ostree_ref=fedora-atomic/Rawhide/x86_64/docker-host',
self.topdir + '/compose/Everything/x86_64/os'],
self.topdir + '/work/x86_64/Everything/ostree_installer'],
channel=None, mounts=[self.topdir],
packages=['pungi', 'lorax'],
task_id=True, use_shell=True)])
@ -230,7 +232,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
[mock.call(koji.get_runroot_cmd.return_value,
log_file=self.topdir + '/logs/x86_64/ostree/runroot.log')])
self.assertEqual(link.call_args_list,
[mock.call(self.topdir + '/compose/Everything/x86_64/os/images/boot.iso',
[mock.call(self.topdir + '/work/x86_64/Everything/ostree_installer/images/boot.iso',
final_iso_path)])
self.assertEqual(get_file_size.call_args_list, [mock.call(final_iso_path)])
self.assertEqual(get_mtime.call_args_list, [mock.call(final_iso_path)])