Added params needed for Atomic compose to LoraxWrapper
Add add_template, add_template_var, add_arch_template, and add_arch_template_var to the call for lorax.get_lorax_cmd for the Atomic ISO composes. Remove duplicate if statement for add_template_var in lorax wrapper
This commit is contained in:
parent
1089847cd7
commit
919a4fc619
@ -87,6 +87,12 @@ class BuildinstallPhase(PhaseBase):
|
|||||||
noupgrade = not self.compose.conf.get("buildinstall_upgrade_image", False)
|
noupgrade = not self.compose.conf.get("buildinstall_upgrade_image", False)
|
||||||
buildinstall_method = self.compose.conf["buildinstall_method"]
|
buildinstall_method = self.compose.conf["buildinstall_method"]
|
||||||
|
|
||||||
|
# These were added for the Atomic ISO Lorax compose
|
||||||
|
add_template = self.compose.conf.get("add_template", None)
|
||||||
|
add_template_var = self.compose.conf.get("add_template_var", None)
|
||||||
|
add_arch_template = self.compose.conf.get("add_arch_template", None)
|
||||||
|
add_arch_template_var = self.compose.conf.get("add_arch_template_var", None)
|
||||||
|
|
||||||
for arch in self.compose.get_arches():
|
for arch in self.compose.get_arches():
|
||||||
repo_baseurl = self.compose.paths.work.arch_repo(arch)
|
repo_baseurl = self.compose.paths.work.arch_repo(arch)
|
||||||
output_dir = self.compose.paths.work.buildinstall_dir(arch)
|
output_dir = self.compose.paths.work.buildinstall_dir(arch)
|
||||||
@ -94,7 +100,7 @@ class BuildinstallPhase(PhaseBase):
|
|||||||
buildarch = get_valid_arches(arch)[0]
|
buildarch = get_valid_arches(arch)[0]
|
||||||
|
|
||||||
if buildinstall_method == "lorax":
|
if buildinstall_method == "lorax":
|
||||||
cmd = lorax.get_lorax_cmd(product, version, release, repo_baseurl, output_dir, is_final=self.compose.supported, buildarch=buildarch, volid=volid, nomacboot=True, noupgrade=noupgrade)
|
cmd = lorax.get_lorax_cmd(product, version, release, repo_baseurl, output_dir, is_final=self.compose.supported, buildarch=buildarch, volid=volid, nomacboot=True, noupgrade=noupgrade, add_template=add_template, add_template_var=add_template_var, add_arch_template=add_arch_template, add_template_var=add_template_var)
|
||||||
elif buildinstall_method == "buildinstall":
|
elif buildinstall_method == "buildinstall":
|
||||||
cmd = lorax.get_buildinstall_cmd(product, version, release, repo_baseurl, output_dir, is_final=self.compose.supported, buildarch=buildarch, volid=volid)
|
cmd = lorax.get_buildinstall_cmd(product, version, release, repo_baseurl, output_dir, is_final=self.compose.supported, buildarch=buildarch, volid=volid)
|
||||||
else:
|
else:
|
||||||
|
@ -21,7 +21,40 @@ from kobo.shortcuts import force_list
|
|||||||
|
|
||||||
|
|
||||||
class LoraxWrapper(object):
|
class LoraxWrapper(object):
|
||||||
def get_lorax_cmd(self, product, version, release, repo_baseurl, output_dir, variant=None, bugurl=None, nomacboot=False, noupgrade=False, is_final=False, buildarch=None, volid=None):
|
def _handle_optional_arg_type(self, f_arg, c_arg):
|
||||||
|
"""
|
||||||
|
_handle_optional_arg_type
|
||||||
|
private function to handle arguments to LoraxWrapper get_*_cmd
|
||||||
|
functions that can optionally be different types (such as string
|
||||||
|
or list). This effectively allows to repeat args to the commands
|
||||||
|
wrapped by LoraxWrapper.
|
||||||
|
|
||||||
|
@param uknown type : f_arg
|
||||||
|
- Function argument that is passed to the get_*_cmd function.
|
||||||
|
|
||||||
|
@param string: c_arg
|
||||||
|
- Command line argument to append to cmd
|
||||||
|
|
||||||
|
@return list
|
||||||
|
- returns a list of strings to join with the cmd list in the get_*_cmd
|
||||||
|
functions
|
||||||
|
"""
|
||||||
|
|
||||||
|
cmd_args = []
|
||||||
|
|
||||||
|
if type(f_arg) is list:
|
||||||
|
for item in f_arg:
|
||||||
|
cmd_args.append("%s=%s" % (c_arg, item))
|
||||||
|
if type(f_arg) is str:
|
||||||
|
cmd_args.append("%s=%s" % (c_arg, item))
|
||||||
|
else:
|
||||||
|
raise Exception(
|
||||||
|
f_arg,
|
||||||
|
"Incorrect type passed to LoraxWrapper for " % c_arg
|
||||||
|
)
|
||||||
|
return cmd_args
|
||||||
|
|
||||||
|
def get_lorax_cmd(self, product, version, release, repo_baseurl, output_dir, variant=None, bugurl=None, nomacboot=False, noupgrade=False, is_final=False, buildarch=None, volid=None, add_template=None, add_template_var=None, add_arch_template=None, add_arch_template_var=None):
|
||||||
cmd = ["lorax"]
|
cmd = ["lorax"]
|
||||||
cmd.append("--product=%s" % product)
|
cmd.append("--product=%s" % product)
|
||||||
cmd.append("--version=%s" % version)
|
cmd.append("--version=%s" % version)
|
||||||
@ -53,6 +86,32 @@ class LoraxWrapper(object):
|
|||||||
if volid:
|
if volid:
|
||||||
cmd.append("--volid=%s" % volid)
|
cmd.append("--volid=%s" % volid)
|
||||||
|
|
||||||
|
if add_template:
|
||||||
|
cmd.extend(
|
||||||
|
self._handle_optional_arg_type(add_template, "--add-template")
|
||||||
|
)
|
||||||
|
|
||||||
|
if add_template_var:
|
||||||
|
cmd.extend(
|
||||||
|
self._handle_optional_arg_type(
|
||||||
|
add_template_var, "--add-template-var"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if add_arch_template:
|
||||||
|
cmd.extend(
|
||||||
|
self._handle_optional_arg_type(
|
||||||
|
add_arch_template, "--add-arch-template"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if add_arch_template_var:
|
||||||
|
cmd.extend(
|
||||||
|
self._handle_optional_arg_type(
|
||||||
|
add_arch_template_var, "--add-arch-template-var"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
output_dir = os.path.abspath(output_dir)
|
output_dir = os.path.abspath(output_dir)
|
||||||
cmd.append(output_dir)
|
cmd.append(output_dir)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user