buildinstall: Allow overwriting version for lorax

Sometimes the release version can be more specific than what should be
exposed to users of the boot iso.

JIRA: COMPOSE-3295
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-03-22 12:47:16 +01:00
parent 75bb48a882
commit 358fdd50ce
4 changed files with 10 additions and 3 deletions

View File

@ -544,6 +544,8 @@ Options
* ``add_template_var`` -- *[str]* (default empty) * ``add_template_var`` -- *[str]* (default empty)
* ``add_arch_template_var`` -- *[str]* (default empty) * ``add_arch_template_var`` -- *[str]* (default empty)
* ``rootfs_size`` -- [*int*] (default empty) * ``rootfs_size`` -- [*int*] (default empty)
* ``version`` -- [*str*] (default from ``release_version``) -- used as
``--version`` and ``--release`` argument on the lorax command line
**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

@ -1178,6 +1178,7 @@ def make_schema():
'add_template_var': {"$ref": "#/definitions/list_of_strings"}, 'add_template_var': {"$ref": "#/definitions/list_of_strings"},
'add_arch_template_var': {"$ref": "#/definitions/list_of_strings"}, 'add_arch_template_var': {"$ref": "#/definitions/list_of_strings"},
"rootfs_size": {"type": "integer"}, "rootfs_size": {"type": "integer"},
"version": {"type": "string"},
}, },
"additionalProperties": False, "additionalProperties": False,
}), }),

View File

@ -70,6 +70,7 @@ class BuildinstallPhase(PhaseBase):
add_template_var = [] add_template_var = []
add_arch_template_var = [] add_arch_template_var = []
rootfs_size = None rootfs_size = None
version = self.compose.conf["release_version"]
for data in get_arch_variant_data(self.compose.conf, 'lorax_options', arch, variant): for data in get_arch_variant_data(self.compose.conf, 'lorax_options', arch, variant):
if not data.get('noupgrade', True): if not data.get('noupgrade', True):
noupgrade = False noupgrade = False
@ -83,6 +84,8 @@ class BuildinstallPhase(PhaseBase):
add_arch_template.extend(data.get('add_arch_template', [])) add_arch_template.extend(data.get('add_arch_template', []))
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', []))
if "version" in data:
version = data["version"]
output_dir = os.path.join(output_dir, variant.uid) output_dir = os.path.join(output_dir, variant.uid)
output_topdir = output_dir output_topdir = output_dir
@ -112,8 +115,8 @@ class BuildinstallPhase(PhaseBase):
lorax = LoraxWrapper() lorax = LoraxWrapper()
lorax_cmd = lorax.get_lorax_cmd(self.compose.conf["release_name"], lorax_cmd = lorax.get_lorax_cmd(self.compose.conf["release_name"],
self.compose.conf["release_version"], version,
self.compose.conf["release_version"], version,
repos, repos,
output_dir, output_dir,
variant=variant.uid, variant=variant.uid,

View File

@ -260,6 +260,7 @@ class TestBuildinstallPhase(PungiTestCase):
'add_template_var': ['baz=1'], 'add_template_var': ['baz=1'],
'add_arch_template_var': ['quux=2'], 'add_arch_template_var': ['quux=2'],
"rootfs_size": 3, "rootfs_size": 3,
"version": "1.2.3",
}, },
'amd64': {'noupgrade': False} 'amd64': {'noupgrade': False}
}), }),
@ -290,7 +291,7 @@ class TestBuildinstallPhase(PungiTestCase):
# Obtained correct lorax commands. # Obtained correct lorax commands.
self.assertItemsEqual( self.assertItemsEqual(
loraxCls.return_value.get_lorax_cmd.mock_calls, loraxCls.return_value.get_lorax_cmd.mock_calls,
[mock.call('Test', '1', '1', [mock.call('Test', '1.2.3', '1.2.3',
[self.topdir + '/work/x86_64/repo', [self.topdir + '/work/x86_64/repo',
self.topdir + '/work/x86_64/comps_repo_Server'], self.topdir + '/work/x86_64/comps_repo_Server'],
self.topdir + '/work/x86_64/buildinstall/Server', self.topdir + '/work/x86_64/buildinstall/Server',