From 4137092e7f58f8b4f523c3bcbae8f5afca1369ca Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 6 Jan 2025 22:21:41 +0200 Subject: [PATCH] Backport PR #1810 to use new container types (cherry picked from commit ddef475081f9efea390c60c2666d9e22536d70c1) --- 1810.patch | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ pungi.spec | 10 ++++-- 2 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 1810.patch diff --git a/1810.patch b/1810.patch new file mode 100644 index 00000000..5eba910a --- /dev/null +++ b/1810.patch @@ -0,0 +1,91 @@ +From 3cb8992d56f2cee8a7cb151253125e30931ccd6d Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Dec 12 2024 01:52:40 +0000 +Subject: Use new container and bootable-container productmd types + + +In https://github.com/release-engineering/productmd/pull/181 I +added new `bootable-container` and `container` types to +productmd. This makes pungi always use the bootable-container +type for ostree_container images (previously 'ociarchive'), and +default to using the container type for Kiwi-built oci.tar.xz +container images (previously 'docker'). + +This is a significant change for anything that relies on +productmd/fedfind conventions to 'identify' images, as these +images will now have a different identity. But I think it's a +valuable improvement in their identities. 'ociarchive' never made +any sense as an image 'type' - it's a format - and 'docker' +wasn't a very good type for images that are explicitly OCI +container images, not Docker-native ones. We also can now easily +distinguish between 'regular' container images and ones that are +intended to be bootable. + +Signed-off-by: Adam Williamson + +--- + +diff --git a/pungi/phases/kiwibuild.py b/pungi/phases/kiwibuild.py +index 400ea6a..9b75dd7 100644 +--- a/pungi/phases/kiwibuild.py ++++ b/pungi/phases/kiwibuild.py +@@ -25,6 +25,7 @@ KIWIEXTENSIONS = [ + ("fex", ["squashfs.xz"], "squashfs.xz"), + ("fex", ["squashfs.gz"], "squashfs.gz"), + ("fex", ["squashfs"], "squashfs"), ++ ("container", ["oci.tar.xz"], "tar.xz"), + ] + + +@@ -242,13 +243,15 @@ class RunKiwiBuildThread(WorkerThread): + + + def _find_type_and_format(path): +- for type_, suffixes in EXTENSIONS.items(): +- for suffix in suffixes: +- if path.endswith(suffix): +- return type_, suffix + # these are our kiwi-exclusive mappings for images whose extensions +- # aren't quite the same as imagefactory ++ # aren't quite the same as imagefactory. they come first as we ++ # want our oci.tar.xz mapping to win over the tar.xz one in ++ # EXTENSIONS + for type_, suffixes, format_ in KIWIEXTENSIONS: + if any(path.endswith(suffix) for suffix in suffixes): + return type_, format_ ++ for type_, suffixes in EXTENSIONS.items(): ++ for suffix in suffixes: ++ if path.endswith(suffix): ++ return type_, suffix + return None, None +diff --git a/pungi/phases/ostree_container.py b/pungi/phases/ostree_container.py +index c50633d..c017962 100644 +--- a/pungi/phases/ostree_container.py ++++ b/pungi/phases/ostree_container.py +@@ -164,9 +164,9 @@ class OSTreeContainerThread(WorkerThread): + # Update image manifest + img = Image(compose.im) + +- # Get the manifest type from the config if supplied, otherwise we +- # determine the manifest type based on the koji output +- img.type = "ociarchive" ++ # these are hardcoded as they should always be correct, we ++ # could potentially allow overriding them via config though ++ img.type = "bootable-container" + img.format = "ociarchive" + img.path = os.path.relpath(fullpath, compose.paths.compose.topdir()) + img.mtime = util.get_mtime(fullpath) +diff --git a/setup.py b/setup.py +index fd249c0..839400b 100755 +--- a/setup.py ++++ b/setup.py +@@ -56,7 +56,7 @@ setup( + "jsonschema", + "kobo", + "lxml", +- "productmd>=1.23", ++ "productmd>=1.43", + "dogpile.cache", + ], + extras_require={':python_version=="2.7"': ["enum34", "lockfile"]}, + diff --git a/pungi.spec b/pungi.spec index 6858ad9b..28750754 100644 --- a/pungi.spec +++ b/pungi.spec @@ -2,12 +2,15 @@ Name: pungi Version: 4.8.0 -Release: 1%{?dist}.alma.1 +Release: 2%{?dist}.alma.1 Summary: Distribution compose tool License: GPL-2.0-only URL: https://pagure.io/pungi Source0: %{name}-%{version}.tar.bz2 +# https://pagure.io/pungi/pull-request/1810 +# Use container and bootable-container productmd types +Patch: 1810.patch BuildRequires: make BuildRequires: python3-pytest @@ -69,7 +72,7 @@ Requires: python3-libmodulemd >= 2.8.0 Requires: python3-gobject Requires: python3-createrepo_c >= 0.20.1 Requires: python3-PyYAML -Requires: python3-productmd >= 1.38 +Requires: python3-productmd >= 1.43 Requires: python3-flufl-lock %if %{rhel} == 10 Requires: xorriso @@ -172,6 +175,9 @@ gzip _build/man/pungi.1 %{_bindir}/%{name}-cache-cleanup %changelog +* Mon Jan 06 2025 Adam Williamson - 4.8.0-2 +- Backport PR #1810 to use new container types + * Fri Nov 29 2024 Lubomír Sedlář - 4.8.0-1 - Drop spec file (lsedlar) - Remove python 2.7 from tox configuration (lsedlar)