From 8412890640c4beab707e604aab6f24c3ecd2b1f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Thu, 15 Feb 2024 18:58:07 +0100 Subject: [PATCH] ostree/container: Set version in treefile 'automatic-version-prefix' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the non container path, we're setting the version for the build using the `--add-metadata-string=version=XYZ` argument passed to `rpm-ostree compose tree ...`. The `rpm-ostree compose image` path does not expose this option yet so modify the treefile directly as we are already doing it to set the repos used for the compose. See: https://github.com/coreos/rpm-ostree/issues/4829 See: https://pagure.io/workstation-ostree-config/pull-request/472 Merges: https://pagure.io/pungi/pull-request/1726 Signed-off-by: Timothée Ravier --- pungi/ostree/container.py | 2 +- pungi/phases/ostree_container.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pungi/ostree/container.py b/pungi/ostree/container.py index ea7a482b..7a552655 100644 --- a/pungi/ostree/container.py +++ b/pungi/ostree/container.py @@ -74,7 +74,7 @@ class Container(OSTree): repos = [] keep_original_sources = True - update_dict = {} + update_dict = {"automatic-version-prefix": self.args.version} self.treefile = tweak_treeconf( self.treefile, diff --git a/pungi/phases/ostree_container.py b/pungi/phases/ostree_container.py index 18add3dc..ce2001d2 100644 --- a/pungi/phases/ostree_container.py +++ b/pungi/phases/ostree_container.py @@ -121,10 +121,11 @@ 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"], variant.uid, - util.version_generator(compose, config.get("version")), + version, ) # Run the pungi-make-ostree command locally to create a script to @@ -137,6 +138,7 @@ class OSTreeContainerThread(WorkerThread): "--path=%s" % target_dir, "--treefile=%s" % os.path.join(config_repo, config["treefile"]), "--extra-config=%s" % extra_config_file, + "--version=%s" % version, ] _, runroot_script = shortcuts.run(cmd, universal_newlines=True)