From d4efe17328f32a09cf83ae7b573781f3862c2383 Mon Sep 17 00:00:00 2001 From: Haibo Lin Date: Thu, 14 May 2020 10:22:09 +0800 Subject: [PATCH] Support --skip-branding option in lorax JIRA: RHELCMP-572 Signed-off-by: Haibo Lin --- doc/configuration.rst | 1 + pungi/checks.py | 1 + pungi/phases/buildinstall.py | 4 ++++ pungi/wrappers/lorax.py | 4 ++++ tests/test_buildinstall.py | 19 +++++++++++++++++++ 5 files changed, 29 insertions(+) diff --git a/doc/configuration.rst b/doc/configuration.rst index f56ab4cc..8f512b9a 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -551,6 +551,7 @@ Options dracut. Please note that if this option is used, lorax will not use any other arguments, so you have to provide a full list and can not just add something. + * ``skip_branding`` -- *bool* (default ``False``) **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 3821ddbb..b7fd3c93 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -1099,6 +1099,7 @@ def make_schema(): "rootfs_size": {"type": "integer"}, "version": {"type": "string"}, "dracut_args": {"$ref": "#/definitions/list_of_strings"}, + "skip_branding": {"type": "boolean"}, }, "additionalProperties": False, } diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py index 748cdadb..9ac74193 100644 --- a/pungi/phases/buildinstall.py +++ b/pungi/phases/buildinstall.py @@ -86,6 +86,7 @@ class BuildinstallPhase(PhaseBase): add_arch_template_var = [] dracut_args = [] rootfs_size = None + skip_branding = False version = self.compose.conf.get( "treeinfo_version", self.compose.conf["release_version"] ) @@ -105,6 +106,7 @@ class BuildinstallPhase(PhaseBase): add_template_var.extend(data.get("add_template_var", [])) add_arch_template_var.extend(data.get("add_arch_template_var", [])) dracut_args.extend(data.get("dracut_args", [])) + skip_branding = data.get("skip_branding", False) if "version" in data: version = data["version"] output_dir = os.path.join(output_dir, variant.uid) @@ -146,6 +148,7 @@ class BuildinstallPhase(PhaseBase): "noupgrade": noupgrade, "rootfs-size": rootfs_size, "dracut-args": dracut_args, + "skip_branding": skip_branding, "outputdir": output_dir, } else: @@ -178,6 +181,7 @@ class BuildinstallPhase(PhaseBase): rootfs_size=rootfs_size, log_dir=log_dir, dracut_args=dracut_args, + skip_branding=skip_branding, ) return "rm -rf %s && %s" % ( shlex_quote(output_topdir), diff --git a/pungi/wrappers/lorax.py b/pungi/wrappers/lorax.py index fdee2bf0..c5e6badb 100644 --- a/pungi/wrappers/lorax.py +++ b/pungi/wrappers/lorax.py @@ -43,6 +43,7 @@ class LoraxWrapper(object): rootfs_size=None, log_dir=None, dracut_args=None, + skip_branding=False, ): cmd = ["lorax"] cmd.append("--product=%s" % product) @@ -90,6 +91,9 @@ class LoraxWrapper(object): for i in force_list(dracut_args or []): cmd.append("--dracut-arg=%s" % i) + if skip_branding: + cmd.append("--skip-branding") + output_dir = os.path.abspath(output_dir) cmd.append(output_dir) diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index 2ac404a2..2afaf502 100644 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -154,6 +154,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=self.topdir + "/logs/x86_64/buildinstall-Server-logs", dracut_args=[], + skip_branding=False, ), mock.call( "Test", @@ -180,6 +181,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=self.topdir + "/logs/amd64/buildinstall-Server-logs", dracut_args=[], + skip_branding=False, ), mock.call( "Test", @@ -206,6 +208,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs", dracut_args=[], + skip_branding=False, ), ], ) @@ -283,6 +286,7 @@ class TestBuildinstallPhase(PungiTestCase): "noupgrade": True, "rootfs-size": None, "dracut-args": [], + "skip_branding": False, "outputdir": self.topdir + "/work/amd64/buildinstall/Server", }, { @@ -308,6 +312,7 @@ class TestBuildinstallPhase(PungiTestCase): "noupgrade": True, "rootfs-size": None, "dracut-args": [], + "skip_branding": False, "outputdir": self.topdir + "/work/amd64/buildinstall/Client", }, { @@ -333,6 +338,7 @@ class TestBuildinstallPhase(PungiTestCase): "noupgrade": True, "rootfs-size": None, "dracut-args": [], + "skip_branding": False, "outputdir": self.topdir + "/work/x86_64/buildinstall/Server", }, ] @@ -430,6 +436,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs", dracut_args=[], + skip_branding=False, ) ], any_order=True, @@ -596,6 +603,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=3, log_dir=self.topdir + "/logs/x86_64/buildinstall-Server-logs", dracut_args=["--xz", "--install", "/.buildstamp"], + skip_branding=False, ), mock.call( "Test", @@ -621,6 +629,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=self.topdir + "/logs/amd64/buildinstall-Server-logs", dracut_args=[], + skip_branding=False, ), mock.call( "Test", @@ -646,6 +655,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs", dracut_args=[], + skip_branding=False, ), ], ) @@ -745,6 +755,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=self.topdir + "/logs/x86_64/buildinstall-Server-logs", dracut_args=[], + skip_branding=False, ), mock.call( "Test", @@ -770,6 +781,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=self.topdir + "/logs/amd64/buildinstall-Server-logs", dracut_args=[], + skip_branding=False, ), mock.call( "Test", @@ -795,6 +807,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs", dracut_args=[], + skip_branding=False, ), ], ) @@ -895,6 +908,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=buildinstall_topdir + "/x86_64/Server/logs", dracut_args=[], + skip_branding=False, ), mock.call( "Test", @@ -920,6 +934,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=buildinstall_topdir + "/amd64/Server/logs", dracut_args=[], + skip_branding=False, ), mock.call( "Test", @@ -945,6 +960,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=buildinstall_topdir + "/amd64/Client/logs", dracut_args=[], + skip_branding=False, ), ], ) @@ -1037,6 +1053,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=self.topdir + "/logs/x86_64/buildinstall-Server-logs", dracut_args=[], + skip_branding=False, ), mock.call( "Test", @@ -1062,6 +1079,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=self.topdir + "/logs/amd64/buildinstall-Server-logs", dracut_args=[], + skip_branding=False, ), mock.call( "Test", @@ -1089,6 +1107,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs", dracut_args=[], + skip_branding=False, ), ], )