Add a new option for customizing version in .treeinfo

There was an attempt to achieve this by customizing --version and
--release arguments for Lorax, but Pungi does not take the [general] and
[release] sections from its .treeinfo. Instead it was always using
release version.

The value from this new option will be put into .treeinfo and used for
--version and --release arguments in Lorax (unless explicitly defined in
lorax_options to another value).

JIRA: COMPOSE-4029
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2020-01-06 15:22:47 +01:00
parent 2c2462970d
commit aa6a213c8d
4 changed files with 13 additions and 4 deletions

View File

@ -69,6 +69,10 @@ Options
**release_internal** = False **release_internal** = False
(*bool*) -- whether the compose is meant for public consumption (*bool*) -- whether the compose is meant for public consumption
**treeinfo_version**
(*str*) Version to display in ``.treeinfo`` files. If not configured, the
value from ``release_version`` will be used.
Example Example
------- -------
@ -536,8 +540,9 @@ 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`` -- [*str*] (default from ``treeinfo_version`` or
``--version`` and ``--release`` argument on the lorax command line ``release_version``) -- used as ``--version`` and ``--release``
argument on the lorax command line
* ``dracut_args`` -- [*[str]*] (default empty) override arguments for * ``dracut_args`` -- [*[str]*] (default empty) override arguments for
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

View File

@ -569,6 +569,8 @@ def make_schema():
"release_internal": {"type": "boolean", "default": False}, "release_internal": {"type": "boolean", "default": False},
"release_discinfo_description": {"type": "string"}, "release_discinfo_description": {"type": "string"},
"treeinfo_version": {"type": "string"},
"compose_type": { "compose_type": {
"type": "string", "type": "string",
"enum": COMPOSE_TYPES, "enum": COMPOSE_TYPES,

View File

@ -224,7 +224,7 @@ def write_tree_info(compose, arch, variant, timestamp=None, bi=None):
else: else:
# release # release
ti.release.name = compose.conf["release_name"] ti.release.name = compose.conf["release_name"]
ti.release.version = compose.conf["release_version"] ti.release.version = compose.conf.get("treeinfo_version", compose.conf["release_version"])
ti.release.short = compose.conf["release_short"] ti.release.short = compose.conf["release_short"]
ti.release.is_layered = True if compose.conf.get("base_product_name", "") else False ti.release.is_layered = True if compose.conf.get("base_product_name", "") else False
ti.release.type = compose.conf["release_type"].lower() ti.release.type = compose.conf["release_type"].lower()

View File

@ -72,7 +72,9 @@ class BuildinstallPhase(PhaseBase):
add_arch_template_var = [] add_arch_template_var = []
dracut_args = [] dracut_args = []
rootfs_size = None rootfs_size = None
version = self.compose.conf["release_version"] version = self.compose.conf.get(
"treeinfo_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