Support --skip-branding option in lorax

JIRA: RHELCMP-572
Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
Haibo Lin 2020-05-14 10:22:09 +08:00
parent fe4b2dd302
commit d4efe17328
5 changed files with 29 additions and 0 deletions

View File

@ -551,6 +551,7 @@ Options
dracut. Please note that if this option is used, lorax will not use any 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 other arguments, so you have to provide a full list and can not just
add something. add something.
* ``skip_branding`` -- *bool* (default ``False``)
**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

@ -1099,6 +1099,7 @@ def make_schema():
"rootfs_size": {"type": "integer"}, "rootfs_size": {"type": "integer"},
"version": {"type": "string"}, "version": {"type": "string"},
"dracut_args": {"$ref": "#/definitions/list_of_strings"}, "dracut_args": {"$ref": "#/definitions/list_of_strings"},
"skip_branding": {"type": "boolean"},
}, },
"additionalProperties": False, "additionalProperties": False,
} }

View File

@ -86,6 +86,7 @@ class BuildinstallPhase(PhaseBase):
add_arch_template_var = [] add_arch_template_var = []
dracut_args = [] dracut_args = []
rootfs_size = None rootfs_size = None
skip_branding = False
version = self.compose.conf.get( version = self.compose.conf.get(
"treeinfo_version", self.compose.conf["release_version"] "treeinfo_version", self.compose.conf["release_version"]
) )
@ -105,6 +106,7 @@ class BuildinstallPhase(PhaseBase):
add_template_var.extend(data.get("add_template_var", [])) add_template_var.extend(data.get("add_template_var", []))
add_arch_template_var.extend(data.get("add_arch_template_var", [])) add_arch_template_var.extend(data.get("add_arch_template_var", []))
dracut_args.extend(data.get("dracut_args", [])) dracut_args.extend(data.get("dracut_args", []))
skip_branding = data.get("skip_branding", False)
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)
@ -146,6 +148,7 @@ class BuildinstallPhase(PhaseBase):
"noupgrade": noupgrade, "noupgrade": noupgrade,
"rootfs-size": rootfs_size, "rootfs-size": rootfs_size,
"dracut-args": dracut_args, "dracut-args": dracut_args,
"skip_branding": skip_branding,
"outputdir": output_dir, "outputdir": output_dir,
} }
else: else:
@ -178,6 +181,7 @@ class BuildinstallPhase(PhaseBase):
rootfs_size=rootfs_size, rootfs_size=rootfs_size,
log_dir=log_dir, log_dir=log_dir,
dracut_args=dracut_args, dracut_args=dracut_args,
skip_branding=skip_branding,
) )
return "rm -rf %s && %s" % ( return "rm -rf %s && %s" % (
shlex_quote(output_topdir), shlex_quote(output_topdir),

View File

@ -43,6 +43,7 @@ class LoraxWrapper(object):
rootfs_size=None, rootfs_size=None,
log_dir=None, log_dir=None,
dracut_args=None, dracut_args=None,
skip_branding=False,
): ):
cmd = ["lorax"] cmd = ["lorax"]
cmd.append("--product=%s" % product) cmd.append("--product=%s" % product)
@ -90,6 +91,9 @@ class LoraxWrapper(object):
for i in force_list(dracut_args or []): for i in force_list(dracut_args or []):
cmd.append("--dracut-arg=%s" % i) cmd.append("--dracut-arg=%s" % i)
if skip_branding:
cmd.append("--skip-branding")
output_dir = os.path.abspath(output_dir) output_dir = os.path.abspath(output_dir)
cmd.append(output_dir) cmd.append(output_dir)

View File

@ -154,6 +154,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=self.topdir + "/logs/x86_64/buildinstall-Server-logs", log_dir=self.topdir + "/logs/x86_64/buildinstall-Server-logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
mock.call( mock.call(
"Test", "Test",
@ -180,6 +181,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=self.topdir + "/logs/amd64/buildinstall-Server-logs", log_dir=self.topdir + "/logs/amd64/buildinstall-Server-logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
mock.call( mock.call(
"Test", "Test",
@ -206,6 +208,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs", log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
], ],
) )
@ -283,6 +286,7 @@ class TestBuildinstallPhase(PungiTestCase):
"noupgrade": True, "noupgrade": True,
"rootfs-size": None, "rootfs-size": None,
"dracut-args": [], "dracut-args": [],
"skip_branding": False,
"outputdir": self.topdir + "/work/amd64/buildinstall/Server", "outputdir": self.topdir + "/work/amd64/buildinstall/Server",
}, },
{ {
@ -308,6 +312,7 @@ class TestBuildinstallPhase(PungiTestCase):
"noupgrade": True, "noupgrade": True,
"rootfs-size": None, "rootfs-size": None,
"dracut-args": [], "dracut-args": [],
"skip_branding": False,
"outputdir": self.topdir + "/work/amd64/buildinstall/Client", "outputdir": self.topdir + "/work/amd64/buildinstall/Client",
}, },
{ {
@ -333,6 +338,7 @@ class TestBuildinstallPhase(PungiTestCase):
"noupgrade": True, "noupgrade": True,
"rootfs-size": None, "rootfs-size": None,
"dracut-args": [], "dracut-args": [],
"skip_branding": False,
"outputdir": self.topdir + "/work/x86_64/buildinstall/Server", "outputdir": self.topdir + "/work/x86_64/buildinstall/Server",
}, },
] ]
@ -430,6 +436,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs", log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
) )
], ],
any_order=True, any_order=True,
@ -596,6 +603,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=3, rootfs_size=3,
log_dir=self.topdir + "/logs/x86_64/buildinstall-Server-logs", log_dir=self.topdir + "/logs/x86_64/buildinstall-Server-logs",
dracut_args=["--xz", "--install", "/.buildstamp"], dracut_args=["--xz", "--install", "/.buildstamp"],
skip_branding=False,
), ),
mock.call( mock.call(
"Test", "Test",
@ -621,6 +629,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=self.topdir + "/logs/amd64/buildinstall-Server-logs", log_dir=self.topdir + "/logs/amd64/buildinstall-Server-logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
mock.call( mock.call(
"Test", "Test",
@ -646,6 +655,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs", log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
], ],
) )
@ -745,6 +755,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=self.topdir + "/logs/x86_64/buildinstall-Server-logs", log_dir=self.topdir + "/logs/x86_64/buildinstall-Server-logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
mock.call( mock.call(
"Test", "Test",
@ -770,6 +781,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=self.topdir + "/logs/amd64/buildinstall-Server-logs", log_dir=self.topdir + "/logs/amd64/buildinstall-Server-logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
mock.call( mock.call(
"Test", "Test",
@ -795,6 +807,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs", log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
], ],
) )
@ -895,6 +908,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=buildinstall_topdir + "/x86_64/Server/logs", log_dir=buildinstall_topdir + "/x86_64/Server/logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
mock.call( mock.call(
"Test", "Test",
@ -920,6 +934,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=buildinstall_topdir + "/amd64/Server/logs", log_dir=buildinstall_topdir + "/amd64/Server/logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
mock.call( mock.call(
"Test", "Test",
@ -945,6 +960,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=buildinstall_topdir + "/amd64/Client/logs", log_dir=buildinstall_topdir + "/amd64/Client/logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
], ],
) )
@ -1037,6 +1053,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=self.topdir + "/logs/x86_64/buildinstall-Server-logs", log_dir=self.topdir + "/logs/x86_64/buildinstall-Server-logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
mock.call( mock.call(
"Test", "Test",
@ -1062,6 +1079,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=self.topdir + "/logs/amd64/buildinstall-Server-logs", log_dir=self.topdir + "/logs/amd64/buildinstall-Server-logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
mock.call( mock.call(
"Test", "Test",
@ -1089,6 +1107,7 @@ class TestBuildinstallPhase(PungiTestCase):
rootfs_size=None, rootfs_size=None,
log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs", log_dir=self.topdir + "/logs/amd64/buildinstall-Client-logs",
dracut_args=[], dracut_args=[],
skip_branding=False,
), ),
], ],
) )