Use xorrisofs for creating ISOs when needed

A new configuration *createiso_use_xorrisofs* is added to determine
which tool to use for creating ISOs.

By default, createiso_use_xorrisofs = False and genisoimage will be used.
When set to True, xorrisofs will be used.

JIRA: RHELCMP-2875
Fixes: https://pagure.io/pungi/issue/1130

Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
Haibo Lin 2020-11-16 11:56:53 +08:00
parent c27e21ccf8
commit 4c88e7dc0e
7 changed files with 33 additions and 4 deletions

View File

@ -1222,6 +1222,10 @@ Options
The staging directory is deleted when ISO is successfully created. In that The staging directory is deleted when ISO is successfully created. In that
case the same task to create the ISO will not be re-runnable. case the same task to create the ISO will not be re-runnable.
**createiso_use_xorrisofs** = False
(*bool*) -- when set to True, use ``xorrisofs`` for creating ISOs instead
of ``genisoimage``.
**iso_size** = 4700000000 **iso_size** = 4700000000
(*int|str*) -- size of ISO image. The value should either be an integer (*int|str*) -- size of ISO image. The value should either be an integer
meaning size in bytes, or it can be a string with ``k``, ``M``, ``G`` meaning size in bytes, or it can be a string with ``k``, ``M``, ``G``

View File

@ -78,7 +78,17 @@ def is_genisoimage_needed(conf):
"""This is only needed locally for createiso without runroot. """This is only needed locally for createiso without runroot.
""" """
runroot_tag = conf.get("runroot_tag", "") runroot_tag = conf.get("runroot_tag", "")
if runroot_tag: if runroot_tag or conf.get("createiso_use_xorrisofs"):
return False
return True
def is_xorrisofs_needed(conf):
"""This is only needed locally for createiso without runroot and
createiso_use_xorrisofs=True.
"""
runroot_tag = conf.get("runroot_tag", "")
if runroot_tag or not conf.get("createiso_use_xorrisofs"):
return False return False
return True return True
@ -96,6 +106,7 @@ tools = [
("isomd5sum", "/usr/bin/checkisomd5", None), ("isomd5sum", "/usr/bin/checkisomd5", None),
("jigdo", "/usr/bin/jigdo-lite", is_jigdo_needed), ("jigdo", "/usr/bin/jigdo-lite", is_jigdo_needed),
("genisoimage", "/usr/bin/genisoimage", is_genisoimage_needed), ("genisoimage", "/usr/bin/genisoimage", is_genisoimage_needed),
("xorriso", "/usr/bin/xorrisofs", is_xorrisofs_needed),
("syslinux", "/usr/bin/isohybrid", is_isohybrid_needed), ("syslinux", "/usr/bin/isohybrid", is_isohybrid_needed),
# createrepo, modifyrepo and mergerepo are not needed by default, only when # createrepo, modifyrepo and mergerepo are not needed by default, only when
# createrepo_c is not configured # createrepo_c is not configured
@ -732,6 +743,7 @@ def make_schema():
{"type": "boolean", "default": False} {"type": "boolean", "default": False}
), ),
"createiso_break_hardlinks": {"type": "boolean", "default": False}, "createiso_break_hardlinks": {"type": "boolean", "default": False},
"createiso_use_xorrisofs": {"type": "boolean", "default": False},
"iso_hfs_ppc64le_compatible": {"type": "boolean", "default": True}, "iso_hfs_ppc64le_compatible": {"type": "boolean", "default": True},
"multilib": _variant_arch_mapping( "multilib": _variant_arch_mapping(
{"$ref": "#/definitions/list_of_strings"} {"$ref": "#/definitions/list_of_strings"}

View File

@ -24,6 +24,7 @@ CreateIsoOpts = namedtuple(
"supported", "supported",
"os_tree", "os_tree",
"hfs_compat", "hfs_compat",
"use_xorrisofs",
], ],
) )
CreateIsoOpts.__new__.__defaults__ = (None,) * len(CreateIsoOpts._fields) CreateIsoOpts.__new__.__defaults__ = (None,) * len(CreateIsoOpts._fields)

View File

@ -171,6 +171,7 @@ class CreateisoPhase(PhaseLoggerMixin, PhaseBase):
arch=arch, arch=arch,
supported=self.compose.supported, supported=self.compose.supported,
hfs_compat=self.compose.conf["iso_hfs_ppc64le_compatible"], hfs_compat=self.compose.conf["iso_hfs_ppc64le_compatible"],
use_xorrisofs=self.compose.conf.get("createiso_use_xorrisofs"),
) )
if bootable: if bootable:
@ -326,7 +327,11 @@ def add_iso_to_metadata(
def run_createiso_command( def run_createiso_command(
num, compose, bootable, arch, cmd, mounts, log_file, with_jigdo=True num, compose, bootable, arch, cmd, mounts, log_file, with_jigdo=True
): ):
packages = ["coreutils", "genisoimage", "isomd5sum"] packages = [
"coreutils",
"xorriso" if compose.conf.get("createiso_use_xorrisofs") else "genisoimage",
"isomd5sum",
]
if with_jigdo and compose.conf["create_jigdo"]: if with_jigdo and compose.conf["create_jigdo"]:
packages.append("jigdo") packages.append("jigdo")
if bootable: if bootable:

View File

@ -114,6 +114,7 @@ class ExtraIsosThread(WorkerThread):
arch=arch, arch=arch,
supported=compose.supported, supported=compose.supported,
hfs_compat=compose.conf["iso_hfs_ppc64le_compatible"], hfs_compat=compose.conf["iso_hfs_ppc64le_compatible"],
use_xorrisofs=compose.conf.get("createiso_use_xorrisofs"),
) )
if compose.conf["create_jigdo"]: if compose.conf["create_jigdo"]:
jigdo_dir = compose.paths.compose.jigdo_dir(arch, variant) jigdo_dir = compose.paths.compose.jigdo_dir(arch, variant)

View File

@ -145,6 +145,7 @@ def get_mkisofs_cmd(
boot_args=None, boot_args=None,
input_charset="utf-8", input_charset="utf-8",
graft_points=None, graft_points=None,
use_xorrisofs=False,
): ):
# following options are always enabled # following options are always enabled
untranslated_filenames = True untranslated_filenames = True
@ -153,7 +154,7 @@ def get_mkisofs_cmd(
joliet_long = True joliet_long = True
rock = True rock = True
cmd = ["/usr/bin/genisoimage"] cmd = ["/usr/bin/xorrisofs" if use_xorrisofs else "/usr/bin/genisoimage"]
if appid: if appid:
cmd.extend(["-appid", appid]) cmd.extend(["-appid", appid])
@ -178,7 +179,7 @@ def get_mkisofs_cmd(
if verbose: if verbose:
cmd.append("-verbose") cmd.append("-verbose")
if translation_table: if not use_xorrisofs and translation_table:
cmd.append("-translation-table") cmd.append("-translation-table")
if input_charset: if input_charset:

View File

@ -122,6 +122,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
jigdo_dir="%s/compose/Server/x86_64/jigdo" % self.topdir, jigdo_dir="%s/compose/Server/x86_64/jigdo" % self.topdir,
os_tree="%s/compose/Server/x86_64/os" % self.topdir, os_tree="%s/compose/Server/x86_64/os" % self.topdir,
hfs_compat=True, hfs_compat=True,
use_xorrisofs=False,
) )
], ],
) )
@ -247,6 +248,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
jigdo_dir="%s/compose/Server/x86_64/jigdo" % self.topdir, jigdo_dir="%s/compose/Server/x86_64/jigdo" % self.topdir,
os_tree="%s/compose/Server/x86_64/os" % self.topdir, os_tree="%s/compose/Server/x86_64/os" % self.topdir,
hfs_compat=True, hfs_compat=True,
use_xorrisofs=False,
), ),
CreateIsoOpts( CreateIsoOpts(
output_dir="%s/compose/Server/source/iso" % self.topdir, output_dir="%s/compose/Server/source/iso" % self.topdir,
@ -258,6 +260,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
jigdo_dir="%s/compose/Server/source/jigdo" % self.topdir, jigdo_dir="%s/compose/Server/source/jigdo" % self.topdir,
os_tree="%s/compose/Server/source/tree" % self.topdir, os_tree="%s/compose/Server/source/tree" % self.topdir,
hfs_compat=True, hfs_compat=True,
use_xorrisofs=False,
), ),
], ],
) )
@ -389,6 +392,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
jigdo_dir="%s/compose/Server/source/jigdo" % self.topdir, jigdo_dir="%s/compose/Server/source/jigdo" % self.topdir,
os_tree="%s/compose/Server/source/tree" % self.topdir, os_tree="%s/compose/Server/source/tree" % self.topdir,
hfs_compat=True, hfs_compat=True,
use_xorrisofs=False,
) )
], ],
) )
@ -495,6 +499,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
jigdo_dir="%s/compose/Server/x86_64/jigdo" % self.topdir, jigdo_dir="%s/compose/Server/x86_64/jigdo" % self.topdir,
os_tree="%s/compose/Server/x86_64/os" % self.topdir, os_tree="%s/compose/Server/x86_64/os" % self.topdir,
hfs_compat=False, hfs_compat=False,
use_xorrisofs=False,
) )
], ],
) )