[ostree-installer] Copy all lorax outputs

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-04-08 12:48:42 +02:00
parent 1bf4bec32c
commit f17b5e13ad
2 changed files with 17 additions and 7 deletions

View File

@ -4,6 +4,8 @@ import os
from kobo.threads import ThreadPool, WorkerThread from kobo.threads import ThreadPool, WorkerThread
import shutil import shutil
from productmd import images from productmd import images
import pipes
from kobo import shortcuts
from .base import ConfigGuardedPhase from .base import ConfigGuardedPhase
from .. import util from .. import util
@ -72,6 +74,8 @@ class OstreeInstallerThread(WorkerThread):
iso_path = compose.paths.compose.iso_path(arch, variant, filename) iso_path = compose.paths.compose.iso_path(arch, variant, filename)
boot_iso = os.path.join(output_dir, 'images', 'boot.iso') boot_iso = os.path.join(output_dir, 'images', 'boot.iso')
shortcuts.run('cp -av %s/* %s/' %
(pipes.quote(output_dir), pipes.quote(os.path.dirname(iso_path))))
try: try:
os.link(boot_iso, iso_path) os.link(boot_iso, iso_path)
except OSError: except OSError:

View File

@ -100,6 +100,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
self.assertEqual(compose.im.add.mock_calls, self.assertEqual(compose.im.add.mock_calls,
[mock.call('Everything', 'x86_64', image)]) [mock.call('Everything', 'x86_64', image)])
@mock.patch('kobo.shortcuts.run')
@mock.patch('productmd.images.Image') @mock.patch('productmd.images.Image')
@mock.patch('pungi.util.get_mtime') @mock.patch('pungi.util.get_mtime')
@mock.patch('pungi.util.get_file_size') @mock.patch('pungi.util.get_file_size')
@ -107,7 +108,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
@mock.patch('os.link') @mock.patch('os.link')
@mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper')
def test_run(self, KojiWrapper, link, IsoWrapper, def test_run(self, KojiWrapper, link, IsoWrapper,
get_file_size, get_mtime, ImageCls): get_file_size, get_mtime, ImageCls, run):
compose = helpers.DummyCompose(self.topdir, { compose = helpers.DummyCompose(self.topdir, {
'release_name': 'Fedora', 'release_name': 'Fedora',
'release_version': 'Rawhide', 'release_version': 'Rawhide',
@ -161,15 +162,18 @@ class OstreeThreadTest(helpers.PungiTestCase):
disc_type='dvd', format='Fedora-Atomic.iso')]) disc_type='dvd', format='Fedora-Atomic.iso')])
self.assertTrue(os.path.isdir(self.topdir + '/work/x86_64/Everything/')) self.assertTrue(os.path.isdir(self.topdir + '/work/x86_64/Everything/'))
self.assertFalse(os.path.isdir(self.topdir + '/work/x86_64/Everything/ostree_installer')) self.assertFalse(os.path.isdir(self.topdir + '/work/x86_64/Everything/ostree_installer'))
self.assertEqual(run.call_args_list,
[mock.call('cp -av {0}/work/x86_64/Everything/ostree_installer/* {0}/compose/Everything/x86_64/iso/'.format(self.topdir))])
@mock.patch('kobo.shortcuts.run')
@mock.patch('productmd.images.Image') @mock.patch('productmd.images.Image')
@mock.patch('pungi.util.get_mtime') @mock.patch('pungi.util.get_mtime')
@mock.patch('pungi.util.get_file_size') @mock.patch('pungi.util.get_file_size')
@mock.patch('pungi.wrappers.iso.IsoWrapper') @mock.patch('pungi.wrappers.iso.IsoWrapper')
@mock.patch('os.link') @mock.patch('os.link')
@mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper')
def test_run_with_implicit_release(self, KojiWrapper, link, def test_run_with_implicit_release(self, KojiWrapper, link, IsoWrapper,
IsoWrapper, get_file_size, get_mtime, ImageCls): get_file_size, get_mtime, ImageCls, run):
compose = helpers.DummyCompose(self.topdir, { compose = helpers.DummyCompose(self.topdir, {
'release_name': 'Fedora', 'release_name': 'Fedora',
'release_version': 'Rawhide', 'release_version': 'Rawhide',
@ -241,14 +245,15 @@ class OstreeThreadTest(helpers.PungiTestCase):
[mock.call('x86_64', compose.variants['Everything'], [mock.call('x86_64', compose.variants['Everything'],
disc_type='dvd', format=None)]) disc_type='dvd', format=None)])
@mock.patch('kobo.shortcuts.run')
@mock.patch('productmd.images.Image') @mock.patch('productmd.images.Image')
@mock.patch('pungi.util.get_mtime') @mock.patch('pungi.util.get_mtime')
@mock.patch('pungi.util.get_file_size') @mock.patch('pungi.util.get_file_size')
@mock.patch('pungi.wrappers.iso.IsoWrapper') @mock.patch('pungi.wrappers.iso.IsoWrapper')
@mock.patch('os.link') @mock.patch('os.link')
@mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper')
def test_fail_crash(self, KojiWrapper, link, def test_fail_crash(self, KojiWrapper, link, IsoWrapper, get_file_size,
IsoWrapper, get_file_size, get_mtime, ImageCls): get_mtime, ImageCls, run):
compose = helpers.DummyCompose(self.topdir, { compose = helpers.DummyCompose(self.topdir, {
'release_name': 'Fedora', 'release_name': 'Fedora',
'release_version': 'Rawhide', 'release_version': 'Rawhide',
@ -275,14 +280,15 @@ class OstreeThreadTest(helpers.PungiTestCase):
mock.call('BOOM') mock.call('BOOM')
]) ])
@mock.patch('kobo.shortcuts.run')
@mock.patch('productmd.images.Image') @mock.patch('productmd.images.Image')
@mock.patch('pungi.util.get_mtime') @mock.patch('pungi.util.get_mtime')
@mock.patch('pungi.util.get_file_size') @mock.patch('pungi.util.get_file_size')
@mock.patch('pungi.wrappers.iso.IsoWrapper') @mock.patch('pungi.wrappers.iso.IsoWrapper')
@mock.patch('os.link') @mock.patch('os.link')
@mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper')
def test_fail_runroot_fail(self, KojiWrapper, link, def test_fail_runroot_fail(self, KojiWrapper, link, IsoWrapper,
IsoWrapper, get_file_size, get_mtime, ImageCls): get_file_size, get_mtime, ImageCls, run):
compose = helpers.DummyCompose(self.topdir, { compose = helpers.DummyCompose(self.topdir, {
'release_name': 'Fedora', 'release_name': 'Fedora',
'release_version': 'Rawhide', 'release_version': 'Rawhide',