ostree_container: make filename configurable, include arch

The default base name is probably fine in most cases, but there
are some where we might want to tweak it. We already allow this
for other phases (e.g. the livemedia phase).

Also, we should include the arch in the image filename. Not doing
this doesn't blow up the compose as, while they have identical
filenames, the images for different arches are in different paths,
but it's confusing for people who actually download and use the
images.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
(cherry picked from commit aea8da5225aeb31b4c5dd413f0a31b6ab395a9ac)
This commit is contained in:
Adam Williamson 2024-10-09 16:16:46 -07:00 committed by Stepan Oksanichenko
parent a0a155ebcd
commit a24c6d52ce
3 changed files with 11 additions and 8 deletions

View File

@ -1887,9 +1887,14 @@ will thus create a new OCI archive image *from scratch*.
* ``runroot_packages`` -- (*list*) A list of additional package names to be * ``runroot_packages`` -- (*list*) A list of additional package names to be
installed in the runroot environment in Koji. installed in the runroot environment in Koji.
* ``subvariant`` -- (*str*) The subvariant value to be used in the metadata * ``subvariant`` -- (*str*) The subvariant value to be used in the metadata
for the image. Also used in the image's filename. Defaults to being the for the image. Also used in the image's filename, unless overridden by
same as the variant. If building more than one ostree container in a ``name``. Defaults to being the same as the variant. If building more
variant, each must have a unique subvariant. than one ostree container in a variant, each must have a unique
subvariant.
* ``name`` -- (*str*) The base for the image's filename. To produce the
complete filename, the image's architecture, the version string, and the
format suffix are appended to this. Defaults to the value of
``release_short`` and the subvariant, joined by a dash.
Example config Example config
-------------- --------------

View File

@ -1115,6 +1115,7 @@ def make_schema():
"$ref": "#/definitions/list_of_strings", "$ref": "#/definitions/list_of_strings",
}, },
"subvariant": {"type": "string"}, "subvariant": {"type": "string"},
"name": {"type": "string"},
}, },
"required": [ "required": [
"treefile", "treefile",

View File

@ -123,11 +123,8 @@ class OSTreeContainerThread(WorkerThread):
target_dir = compose.paths.compose.image_dir(variant) % {"arch": arch} target_dir = compose.paths.compose.image_dir(variant) % {"arch": arch}
util.makedirs(target_dir) util.makedirs(target_dir)
version = util.version_generator(compose, config.get("version")) version = util.version_generator(compose, config.get("version"))
archive_name = "%s-%s-%s" % ( anb = config.get("name", "%s-%s" % (compose.conf["release_short"], subvariant))
compose.conf["release_short"], archive_name = "%s-%s-%s" % (anb, arch, version)
subvariant,
version,
)
# Run the pungi-make-ostree command locally to create a script to # Run the pungi-make-ostree command locally to create a script to
# execute in runroot environment. # execute in runroot environment.