buildinstall: Add support for rootfs-type lorax option

JIRA: ENGCMP-5117
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
(cherry picked from commit 3c6298ee28b32a41ee458975730f246fd9284f93)
This commit is contained in:
Lubomír Sedlář 2025-01-24 09:14:53 +01:00 committed by Stepan Oksanichenko
parent dd8d22f0e3
commit 6891038eb8
6 changed files with 34 additions and 0 deletions

View File

@ -629,6 +629,10 @@ Options
* ``squashfs_only`` -- *bool* (default ``False``) pass the --squashfs_only to Lorax. * ``squashfs_only`` -- *bool* (default ``False``) pass the --squashfs_only to Lorax.
* ``configuration_file`` -- (:ref:`scm_dict <scm_support>`) (default empty) pass the * ``configuration_file`` -- (:ref:`scm_dict <scm_support>`) (default empty) pass the
specified configuration file to Lorax using the -c option. 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** **lorax_extra_sources**
(*list*) -- a variant/arch mapping with urls for extra source repositories (*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. added to Lorax command line. Either one repo or a list can be specified.

View File

@ -1424,6 +1424,7 @@ def make_schema():
"skip_branding": {"type": "boolean"}, "skip_branding": {"type": "boolean"},
"squashfs_only": {"type": "boolean"}, "squashfs_only": {"type": "boolean"},
"configuration_file": {"$ref": "#/definitions/str_or_scm_dict"}, "configuration_file": {"$ref": "#/definitions/str_or_scm_dict"},
"rootfs_type": {"type": "string"},
}, },
"additionalProperties": False, "additionalProperties": False,
} }

View File

@ -94,6 +94,7 @@ class BuildinstallPhase(PhaseBase):
squashfs_only = False squashfs_only = False
configuration_file = None configuration_file = None
configuration_file_source = None configuration_file_source = None
rootfs_type = None
version = self.compose.conf.get( version = self.compose.conf.get(
"treeinfo_version", self.compose.conf["release_version"] "treeinfo_version", self.compose.conf["release_version"]
) )
@ -116,6 +117,7 @@ class BuildinstallPhase(PhaseBase):
skip_branding = data.get("skip_branding", False) skip_branding = data.get("skip_branding", False)
configuration_file_source = data.get("configuration_file") configuration_file_source = data.get("configuration_file")
squashfs_only = data.get("squashfs_only", False) squashfs_only = data.get("squashfs_only", False)
rootfs_type = data.get("rootfs_type", None)
if "version" in data: if "version" in data:
version = data["version"] version = data["version"]
output_dir = os.path.join(output_dir, variant.uid) output_dir = os.path.join(output_dir, variant.uid)
@ -171,6 +173,7 @@ class BuildinstallPhase(PhaseBase):
"skip_branding": skip_branding, "skip_branding": skip_branding,
"squashfs_only": squashfs_only, "squashfs_only": squashfs_only,
"configuration_file": configuration_file, "configuration_file": configuration_file,
"rootfs-type": rootfs_type,
} }
else: else:
# If the buildinstall_topdir is set, it means Koji is used for # If the buildinstall_topdir is set, it means Koji is used for
@ -205,6 +208,7 @@ class BuildinstallPhase(PhaseBase):
skip_branding=skip_branding, skip_branding=skip_branding,
squashfs_only=squashfs_only, squashfs_only=squashfs_only,
configuration_file=configuration_file, configuration_file=configuration_file,
rootfs_type=rootfs_type,
) )
return "rm -rf %s && %s" % ( return "rm -rf %s && %s" % (
shlex.quote(output_topdir), shlex.quote(output_topdir),

View File

@ -46,6 +46,7 @@ class LoraxWrapper(object):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
): ):
cmd = ["lorax"] cmd = ["lorax"]
cmd.append("--product=%s" % product) cmd.append("--product=%s" % product)
@ -106,6 +107,9 @@ class LoraxWrapper(object):
output_dir = os.path.abspath(output_dir) output_dir = os.path.abspath(output_dir)
cmd.append(output_dir) cmd.append(output_dir)
if rootfs_type:
cmd.append("--rootfs-type=%s" % rootfs_type)
# TODO: workdir # TODO: workdir
return cmd return cmd

View File

@ -155,6 +155,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
mock.call( mock.call(
"Test", "Test",
@ -184,6 +185,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
mock.call( mock.call(
"Test", "Test",
@ -213,6 +215,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
], ],
) )
@ -294,6 +297,7 @@ class TestBuildinstallPhase(PungiTestCase):
"skip_branding": False, "skip_branding": False,
"squashfs_only": False, "squashfs_only": False,
"configuration_file": None, "configuration_file": None,
"rootfs-type": None,
}, },
{ {
"product": "Test", "product": "Test",
@ -321,6 +325,7 @@ class TestBuildinstallPhase(PungiTestCase):
"skip_branding": False, "skip_branding": False,
"squashfs_only": False, "squashfs_only": False,
"configuration_file": None, "configuration_file": None,
"rootfs-type": None,
}, },
{ {
"product": "Test", "product": "Test",
@ -348,6 +353,7 @@ class TestBuildinstallPhase(PungiTestCase):
"skip_branding": False, "skip_branding": False,
"squashfs_only": False, "squashfs_only": False,
"configuration_file": None, "configuration_file": None,
"rootfs-type": None,
}, },
] ]
@ -445,6 +451,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
) )
], ],
any_order=True, any_order=True,
@ -558,6 +565,7 @@ class TestBuildinstallPhase(PungiTestCase):
"logs/x86_64/buildinstall-Server-logs", "logs/x86_64/buildinstall-Server-logs",
"lorax.conf", "lorax.conf",
), ),
rootfs_type=None,
), ),
mock.call( mock.call(
"Test", "Test",
@ -586,6 +594,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=True, squashfs_only=True,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
mock.call( mock.call(
"Test", "Test",
@ -614,6 +623,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
], ],
) )
@ -731,6 +741,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
mock.call( mock.call(
"Test", "Test",
@ -759,6 +770,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
mock.call( mock.call(
"Test", "Test",
@ -787,6 +799,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
], ],
) )
@ -887,6 +900,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
mock.call( mock.call(
"Test", "Test",
@ -915,6 +929,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
mock.call( mock.call(
"Test", "Test",
@ -943,6 +958,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
], ],
) )
@ -1036,6 +1052,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
mock.call( mock.call(
"Test", "Test",
@ -1064,6 +1081,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
mock.call( mock.call(
"Test", "Test",
@ -1094,6 +1112,7 @@ class TestBuildinstallPhase(PungiTestCase):
skip_branding=False, skip_branding=False,
squashfs_only=False, squashfs_only=False,
configuration_file=None, configuration_file=None,
rootfs_type=None,
), ),
], ],
) )

View File

@ -50,6 +50,7 @@ class LoraxWrapperTest(unittest.TestCase):
squashfs_only=True, squashfs_only=True,
configuration_file="/storage/RHEL-7.8-20200731.n.0/" configuration_file="/storage/RHEL-7.8-20200731.n.0/"
+ "logs/x86_64/buildinstall-Server-logs/lorax.conf", + "logs/x86_64/buildinstall-Server-logs/lorax.conf",
rootfs_type="erofs",
) )
self.assertEqual(cmd[0], "lorax") self.assertEqual(cmd[0], "lorax")
@ -84,6 +85,7 @@ class LoraxWrapperTest(unittest.TestCase):
"--config", "--config",
"/storage/RHEL-7.8-20200731.n.0/" "/storage/RHEL-7.8-20200731.n.0/"
+ "logs/x86_64/buildinstall-Server-logs/lorax.conf", + "logs/x86_64/buildinstall-Server-logs/lorax.conf",
"--rootfs-type=erofs",
"/mnt/output_dir", "/mnt/output_dir",
], ],
) )