createiso: Make ISO level more granular
Make it possible to set the level separately for each variant and architecture. JIRA: RHELCMP-9341 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
13ea8e5834
commit
11fa342507
@ -1286,7 +1286,9 @@ Options
|
|||||||
suffix (using multiples of 1024).
|
suffix (using multiples of 1024).
|
||||||
|
|
||||||
**iso_level**
|
**iso_level**
|
||||||
(*int*) [optional] -- Set the ISO9660 conformance level. Valid numbers are 1 to 4.
|
(*int|list*) [optional] -- Set the ISO9660 conformance level. This is
|
||||||
|
either a global single value (a number from 1 to 4), or a variant/arch
|
||||||
|
mapping.
|
||||||
|
|
||||||
**split_iso_reserve** = 10MiB
|
**split_iso_reserve** = 10MiB
|
||||||
(*int|str*) -- how much free space should be left on each disk. The format
|
(*int|str*) -- how much free space should be left on each disk. The format
|
||||||
|
@ -760,8 +760,10 @@ def make_schema():
|
|||||||
"createiso_break_hardlinks": {"type": "boolean", "default": False},
|
"createiso_break_hardlinks": {"type": "boolean", "default": False},
|
||||||
"createiso_use_xorrisofs": {"type": "boolean", "default": False},
|
"createiso_use_xorrisofs": {"type": "boolean", "default": False},
|
||||||
"iso_level": {
|
"iso_level": {
|
||||||
"type": "number",
|
"anyOf": [
|
||||||
"enum": [1, 2, 3, 4],
|
{"type": "number", "enum": [1, 2, 3, 4]},
|
||||||
|
_variant_arch_mapping({"type": "number", "enum": [1, 2, 3, 4]}),
|
||||||
|
],
|
||||||
},
|
},
|
||||||
"iso_hfs_ppc64le_compatible": {"type": "boolean", "default": True},
|
"iso_hfs_ppc64le_compatible": {"type": "boolean", "default": True},
|
||||||
"multilib": _variant_arch_mapping(
|
"multilib": _variant_arch_mapping(
|
||||||
|
@ -338,7 +338,7 @@ class CreateisoPhase(PhaseLoggerMixin, PhaseBase):
|
|||||||
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"),
|
use_xorrisofs=self.compose.conf.get("createiso_use_xorrisofs"),
|
||||||
iso_level=self.compose.conf.get("iso_level"),
|
iso_level=get_iso_level_config(self.compose, variant, arch),
|
||||||
)
|
)
|
||||||
|
|
||||||
if bootable:
|
if bootable:
|
||||||
@ -821,3 +821,15 @@ class OldFileLinker(object):
|
|||||||
"""Clean up all files created by this instance."""
|
"""Clean up all files created by this instance."""
|
||||||
for f in self.linked_files:
|
for f in self.linked_files:
|
||||||
os.unlink(f)
|
os.unlink(f)
|
||||||
|
|
||||||
|
|
||||||
|
def get_iso_level_config(compose, variant, arch):
|
||||||
|
"""
|
||||||
|
Get configured ISO level for this variant and architecture.
|
||||||
|
"""
|
||||||
|
level = compose.conf.get("iso_level")
|
||||||
|
if isinstance(level, list):
|
||||||
|
level = None
|
||||||
|
for c in get_arch_variant_data(compose.conf, "iso_level", arch, variant):
|
||||||
|
level = c
|
||||||
|
return level
|
||||||
|
@ -32,6 +32,7 @@ from pungi.phases.createiso import (
|
|||||||
load_and_tweak_treeinfo,
|
load_and_tweak_treeinfo,
|
||||||
compare_packages,
|
compare_packages,
|
||||||
OldFileLinker,
|
OldFileLinker,
|
||||||
|
get_iso_level_config,
|
||||||
)
|
)
|
||||||
from pungi.util import (
|
from pungi.util import (
|
||||||
failable,
|
failable,
|
||||||
@ -130,7 +131,7 @@ class ExtraIsosThread(WorkerThread):
|
|||||||
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"),
|
use_xorrisofs=compose.conf.get("createiso_use_xorrisofs"),
|
||||||
iso_level=compose.conf.get("iso_level"),
|
iso_level=get_iso_level_config(compose, variant, arch),
|
||||||
)
|
)
|
||||||
os_tree = compose.paths.compose.os_tree(arch, variant)
|
os_tree = compose.paths.compose.os_tree(arch, variant)
|
||||||
if compose.conf["create_jigdo"]:
|
if compose.conf["create_jigdo"]:
|
||||||
|
@ -109,3 +109,9 @@ extra_isos = {
|
|||||||
'filename': 'extra-{filename}',
|
'filename': 'extra-{filename}',
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iso_level = [
|
||||||
|
(".*", {
|
||||||
|
"src": 3,
|
||||||
|
}),
|
||||||
|
]
|
||||||
|
@ -1554,3 +1554,38 @@ class CreateisoPerformReusePhaseTest(helpers.PungiTestCase):
|
|||||||
mock.call.abort(),
|
mock.call.abort(),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ComposeConfGetIsoLevelTest(helpers.PungiTestCase):
|
||||||
|
def test_global_config(self):
|
||||||
|
compose = helpers.DummyCompose(self.topdir, {"iso_level": 3})
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
createiso.get_iso_level_config(
|
||||||
|
compose, compose.variants["Server"], "x86_64"
|
||||||
|
),
|
||||||
|
3,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_src_only_config(self):
|
||||||
|
compose = helpers.DummyCompose(
|
||||||
|
self.topdir,
|
||||||
|
{"iso_level": [(".*", {"src": 4})]},
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
createiso.get_iso_level_config(compose, compose.variants["Server"], "src"),
|
||||||
|
4,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_no_match(self):
|
||||||
|
compose = helpers.DummyCompose(
|
||||||
|
self.topdir,
|
||||||
|
{"iso_level": [("^Server$", {"*": 4})]},
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertIsNone(
|
||||||
|
createiso.get_iso_level_config(
|
||||||
|
compose, compose.variants["Client"], "x86_64"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user