[createiso] Add back running isohybrid on x86 disk images

rhbz#1331317 when we refactored how we make dvds in
df400002d8 we lost the ability to boot
the dvd as a disk image.

Signed-off-by: Dennis Gilmore <dennis@ausil.us>
This commit is contained in:
Dennis Gilmore 2016-04-28 16:27:19 -05:00 committed by Lubomír Sedlář
parent b949bfd615
commit 5c4d3a5196
3 changed files with 60 additions and 2 deletions

View File

@ -45,6 +45,15 @@ def implant_md5(iso, opts):
shortcuts.run(cmd, stdout=True, show_cmd=True, workdir=opts.output_dir)
def run_isohybrid(iso, opts):
"""If the image is bootable, it needs to include an MBR or GPT so that it
can actually be booted. This is done by running isohybrid on the image.
"""
if opts.buildinstall_method and opts.arch in ["x86_64", "i386"]:
cmd = iso.get_isohybrid_cmd(opts.iso_name, opts.arch)
shortcuts.run(cmd, stdout=True, show_cmd=True, workdir=opts.output_dir)
def make_manifest(iso, opts):
shortcuts.run(iso.get_manifest_cmd(opts.iso_name), stdout=True,
show_cmd=True, workdir=opts.output_dir)
@ -68,6 +77,7 @@ def make_jigdo(opts):
def run(opts):
iso = IsoWrapper()
make_image(iso, opts)
run_isohybrid(iso, opts)
implant_md5(iso, opts)
make_manifest(iso, opts)
if opts.jigdo_dir:

View File

@ -205,6 +205,15 @@ class IsoWrapper(kobo.log.LoggingBase):
result = line.rsplit(":")[-1].strip()
return result
def get_isohybrid_cmd(self, iso_path, arch):
# isohybrid is in syslinux which is x86 only
cmd = ["/usr/bin/isohybrid"]
# uefi is only supported on x86_64
if arch == "x86_64":
cmd.append("--uefi")
cmd.append(iso_path)
return cmd
def get_manifest_cmd(self, iso_name):
return "isoinfo -R -f -i %s | grep -v '/TRANS.TBL$' | sort >> %s.manifest" % (pipes.quote(iso_name), pipes.quote(iso_name))

View File

@ -13,7 +13,7 @@ from tests import helpers
from pungi import createiso
class OstreeScriptTest(helpers.PungiTestCase):
class CreateIsoScriptTest(helpers.PungiTestCase):
def assertEqualCalls(self, actual, expected):
self.assertEqual(len(actual), len(expected))
@ -21,7 +21,7 @@ class OstreeScriptTest(helpers.PungiTestCase):
self.assertEqual(x, y)
def setUp(self):
super(OstreeScriptTest, self).setUp()
super(CreateIsoScriptTest, self).setUp()
self.outdir = os.path.join(self.topdir, 'isos')
@mock.patch('kobo.shortcuts.run')
@ -79,12 +79,51 @@ class OstreeScriptTest(helpers.PungiTestCase):
show_cmd=True, stdout=True, workdir=self.outdir),
mock.call(['pungi-pylorax-find-templates', '/usr/share/lorax'],
show_cmd=True, stdout=True),
mock.call(['/usr/bin/isohybrid', '--uefi', 'DP-1.0-20160405.t.3-x86_64.iso'],
show_cmd=True, stdout=True, workdir=self.outdir),
mock.call(['/usr/bin/implantisomd5', 'DP-1.0-20160405.t.3-x86_64.iso'],
show_cmd=True, stdout=True, workdir=self.outdir),
mock.call('isoinfo -R -f -i DP-1.0-20160405.t.3-x86_64.iso | grep -v \'/TRANS.TBL$\' | sort >> DP-1.0-20160405.t.3-x86_64.iso.manifest',
show_cmd=True, stdout=True, workdir=self.outdir)]
)
@mock.patch('kobo.shortcuts.run')
def test_bootable_run_on_i386(self, run):
# This will call isohybrid, but not with --uefi switch
run.return_value = (0, '/usr/share/lorax')
createiso.main([
'--output-dir={}'.format(self.outdir),
'--iso-name=DP-1.0-20160405.t.3-i386.iso',
'--volid=DP-1.0-20160405.t.3',
'--graft-points=graft-list',
'--arch=i386',
'--buildinstall-method=lorax',
])
self.maxDiff = None
self.assertItemsEqual(
run.call_args_list,
[mock.call(['/usr/bin/genisoimage', '-untranslated-filenames',
'-volid', 'DP-1.0-20160405.t.3', '-J', '-joliet-long',
'-rational-rock', '-translation-table',
'-input-charset', 'utf-8', '-x', './lost+found',
'-b', 'isolinux/isolinux.bin', '-c', 'isolinux/boot.cat',
'-no-emul-boot',
'-boot-load-size', '4', '-boot-info-table',
'-o', 'DP-1.0-20160405.t.3-i386.iso',
'-graft-points', '-path-list', 'graft-list'],
show_cmd=True, stdout=True, workdir=self.outdir),
mock.call(['pungi-pylorax-find-templates', '/usr/share/lorax'],
show_cmd=True, stdout=True),
mock.call(['/usr/bin/isohybrid', 'DP-1.0-20160405.t.3-i386.iso'],
show_cmd=True, stdout=True, workdir=self.outdir),
mock.call(['/usr/bin/implantisomd5', 'DP-1.0-20160405.t.3-i386.iso'],
show_cmd=True, stdout=True, workdir=self.outdir),
mock.call('isoinfo -R -f -i DP-1.0-20160405.t.3-i386.iso | grep -v \'/TRANS.TBL$\' | sort >> DP-1.0-20160405.t.3-i386.iso.manifest',
show_cmd=True, stdout=True, workdir=self.outdir)]
)
@mock.patch('kobo.shortcuts.run')
def test_bootable_run_ppc64(self, run):
run.return_value = (0, '/usr/share/lorax')