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_arch_template_var`` -- *[str]* (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**
(*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.

View File

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

View File

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

View File

@ -260,6 +260,7 @@ class TestBuildinstallPhase(PungiTestCase):
'add_template_var': ['baz=1'],
'add_arch_template_var': ['quux=2'],
"rootfs_size": 3,
"version": "1.2.3",
},
'amd64': {'noupgrade': False}
}),
@ -290,7 +291,7 @@ class TestBuildinstallPhase(PungiTestCase):
# Obtained correct lorax commands.
self.assertItemsEqual(
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/comps_repo_Server'],
self.topdir + '/work/x86_64/buildinstall/Server',