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 ee1ad025..1829ee50 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -1411,6 +1411,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 427c247b..17a776cf 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 44b53cc8..2032247d 100644 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -154,6 +154,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -183,6 +184,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -212,6 +214,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), ], ) @@ -293,6 +296,7 @@ class TestBuildinstallPhase(PungiTestCase): "skip_branding": False, "squashfs_only": False, "configuration_file": None, + "rootfs-type": None, }, { "product": "Test", @@ -320,6 +324,7 @@ class TestBuildinstallPhase(PungiTestCase): "skip_branding": False, "squashfs_only": False, "configuration_file": None, + "rootfs-type": None, }, { "product": "Test", @@ -347,6 +352,7 @@ class TestBuildinstallPhase(PungiTestCase): "skip_branding": False, "squashfs_only": False, "configuration_file": None, + "rootfs-type": None, }, ] @@ -444,6 +450,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ) ], any_order=True, @@ -557,6 +564,7 @@ class TestBuildinstallPhase(PungiTestCase): "logs/x86_64/buildinstall-Server-logs", "lorax.conf", ), + rootfs_type=None, ), mock.call( "Test", @@ -585,6 +593,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=True, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -613,6 +622,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), ], ) @@ -730,6 +740,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -758,6 +769,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -786,6 +798,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), ], ) @@ -886,6 +899,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -914,6 +928,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -942,6 +957,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), ], ) @@ -1035,6 +1051,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -1063,6 +1080,7 @@ class TestBuildinstallPhase(PungiTestCase): skip_branding=False, squashfs_only=False, configuration_file=None, + rootfs_type=None, ), mock.call( "Test", @@ -1093,6 +1111,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", ], )