From aea8da5225aeb31b4c5dd413f0a31b6ab395a9ac Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Wed, 9 Oct 2024 16:16:46 -0700 Subject: [PATCH] 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 --- doc/configuration.rst | 11 ++++++++--- pungi/checks.py | 1 + pungi/phases/ostree_container.py | 7 ++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/configuration.rst b/doc/configuration.rst index 90621bbc..14947feb 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -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 installed in the runroot environment in Koji. * ``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 - same as the variant. If building more than one ostree container in a - variant, each must have a unique subvariant. + for the image. Also used in the image's filename, unless overridden by + ``name``. Defaults to being the same as the variant. If building more + 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 -------------- diff --git a/pungi/checks.py b/pungi/checks.py index e23babcd..0cdb6196 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -1102,6 +1102,7 @@ def make_schema(): "$ref": "#/definitions/list_of_strings", }, "subvariant": {"type": "string"}, + "name": {"type": "string"}, }, "required": [ "treefile", diff --git a/pungi/phases/ostree_container.py b/pungi/phases/ostree_container.py index e1119985..c50633db 100644 --- a/pungi/phases/ostree_container.py +++ b/pungi/phases/ostree_container.py @@ -123,11 +123,8 @@ class OSTreeContainerThread(WorkerThread): target_dir = compose.paths.compose.image_dir(variant) % {"arch": arch} util.makedirs(target_dir) version = util.version_generator(compose, config.get("version")) - archive_name = "%s-%s-%s" % ( - compose.conf["release_short"], - subvariant, - version, - ) + anb = config.get("name", "%s-%s" % (compose.conf["release_short"], subvariant)) + archive_name = "%s-%s-%s" % (anb, arch, version) # Run the pungi-make-ostree command locally to create a script to # execute in runroot environment.