diff --git a/doc/configuration.rst b/doc/configuration.rst index 14947feb..880465a0 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -629,6 +629,10 @@ Options * ``squashfs_only`` -- *bool* (default ``False``) pass the --squashfs_only to Lorax. * ``configuration_file`` -- (:ref:`scm_dict `) (default empty) pass the specified configuration file to Lorax using the -c option. + * ``rootfs_type`` -- *string* (default empty) pass the ``--rootfs-type`` + option to Lorax with the provided value. If not specified, no type is + specified to Lorax, which will choose whatever default it is configured + with. **lorax_extra_sources** (*list*) -- a variant/arch mapping with urls for extra source repositories added to Lorax command line. Either one repo or a list can be specified. diff --git a/pungi/checks.py b/pungi/checks.py index 23974d07..310b078d 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -1424,6 +1424,7 @@ def make_schema(): "skip_branding": {"type": "boolean"}, "squashfs_only": {"type": "boolean"}, "configuration_file": {"$ref": "#/definitions/str_or_scm_dict"}, + "rootfs_type": {"type": "string"}, }, "additionalProperties": False, } diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py index 2ba30000..4015556a 100644 --- a/pungi/phases/buildinstall.py +++ b/pungi/phases/buildinstall.py @@ -94,6 +94,7 @@ class BuildinstallPhase(PhaseBase): squashfs_only = False configuration_file = None configuration_file_source = None + rootfs_type = None version = self.compose.conf.get( "treeinfo_version", self.compose.conf["release_version"] ) @@ -116,6 +117,7 @@ class BuildinstallPhase(PhaseBase): skip_branding = data.get("skip_branding", False) configuration_file_source = data.get("configuration_file") squashfs_only = data.get("squashfs_only", False) + rootfs_type = data.get("rootfs_type", None) if "version" in data: version = data["version"] output_dir = os.path.join(output_dir, variant.uid) @@ -171,6 +173,7 @@ class BuildinstallPhase(PhaseBase): "skip_branding": skip_branding, "squashfs_only": squashfs_only, "configuration_file": configuration_file, + "rootfs-type": rootfs_type, } else: # If the buildinstall_topdir is set, it means Koji is used for @@ -205,6 +208,7 @@ class BuildinstallPhase(PhaseBase): skip_branding=skip_branding, squashfs_only=squashfs_only, configuration_file=configuration_file, + rootfs_type=rootfs_type, ) return "rm -rf %s && %s" % ( shlex.quote(output_topdir), diff --git a/pungi/wrappers/lorax.py b/pungi/wrappers/lorax.py index 5cba4d11..f3a07884 100644 --- a/pungi/wrappers/lorax.py +++ b/pungi/wrappers/lorax.py @@ -46,6 +46,7 @@ class LoraxWrapper(object): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ): cmd = ["lorax"] cmd.append("--product=%s" % product) @@ -106,6 +107,9 @@ class LoraxWrapper(object): output_dir = os.path.abspath(output_dir) cmd.append(output_dir) + if rootfs_type: + cmd.append("--rootfs-type=%s" % rootfs_type) + # TODO: workdir return cmd diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index 8ae0941d..e75e448d 100644 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -155,6 +155,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -184,6 +185,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -213,6 +215,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), ], ) @@ -294,6 +297,7 @@ class TestBuildinstallPhase(PungiTestCase): "skip_branding": False, "squashfs_only": False, "configuration_file": None, + "rootfs-type": None, }, { "product": "Test", @@ -321,6 +325,7 @@ class TestBuildinstallPhase(PungiTestCase): "skip_branding": False, "squashfs_only": False, "configuration_file": None, + "rootfs-type": None, }, { "product": "Test", @@ -348,6 +353,7 @@ class TestBuildinstallPhase(PungiTestCase): "skip_branding": False, "squashfs_only": False, "configuration_file": None, + "rootfs-type": None, }, ] @@ -445,6 +451,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ) ], any_order=True, @@ -558,6 +565,7 @@ class TestBuildinstallPhase(PungiTestCase): "logs/x86_64/buildinstall-Server-logs", "lorax.conf", ), + rootfs_type=None, ), mock.call( "Test", @@ -586,6 +594,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=True, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -614,6 +623,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), ], ) @@ -731,6 +741,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -759,6 +770,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -787,6 +799,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), ], ) @@ -887,6 +900,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -915,6 +929,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -943,6 +958,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), ], ) @@ -1036,6 +1052,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -1064,6 +1081,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -1094,6 +1112,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), ], ) diff --git a/tests/test_lorax_wrapper.py b/tests/test_lorax_wrapper.py index e8f8f8a6..7e07e34a 100644 --- a/tests/test_lorax_wrapper.py +++ b/tests/test_lorax_wrapper.py @@ -50,6 +50,7 @@ class LoraxWrapperTest(unittest.TestCase): squashfs_only=True, configuration_file="/storage/RHEL-7.8-20200731.n.0/" + "logs/x86_64/buildinstall-Server-logs/lorax.conf", + rootfs_type="erofs", ) self.assertEqual(cmd[0], "lorax") @@ -84,6 +85,7 @@ class LoraxWrapperTest(unittest.TestCase): "--config", "/storage/RHEL-7.8-20200731.n.0/" + "logs/x86_64/buildinstall-Server-logs/lorax.conf", + "--rootfs-type=erofs", "/mnt/output_dir", ], )