From fc2cc0073a599cfc479f40f66eed81fd7abfb4d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Tue, 8 Apr 2025 15:27:46 +0200 Subject: [PATCH] kiwibuild: Add support for use_buildroot_repo option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This option can be set for a particular image or globally for all kiwibuild images (with individual overload). Fixes: https://pagure.io/pungi/issue/1833 Signed-off-by: Lubomír Sedlář (cherry picked from commit d91adfd34d9bd97e2cc73a6023924f3f7b73cef4) --- doc/configuration.rst | 6 ++++++ pungi/checks.py | 2 ++ pungi/phases/kiwibuild.py | 4 ++++ tests/test_kiwibuildphase.py | 14 ++++++++++++++ 4 files changed, 26 insertions(+) diff --git a/doc/configuration.rst b/doc/configuration.rst index 880465a0..2b9d6ba0 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -1581,6 +1581,9 @@ KiwiBuild Settings * ``manifest_type`` -- the image type that is put into the manifest by pungi. If not supplied, an autodetected value will be provided. It may or may not make sense. + * ``use_buildroot_repo = False`` -- (*bool*) whether the task should + automatically enable buildroot repository corresponding to the used + target. The options can be set either for the specific image, or at the phase level (see below). Version also falls back to ``global_version``. @@ -1606,6 +1609,9 @@ KiwiBuild Settings **kiwibuild_repo_releasever** (*str*) -- override releasever for all kiwibuild tasks. +**kiwibuild_use_buildroot_repo** + (*bool*) -- set enablement of a buildroot repo for all kiwibuild tasks. + OSBuild Composer for building images ==================================== diff --git a/pungi/checks.py b/pungi/checks.py index 306aa491..75dacfd5 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -1249,6 +1249,7 @@ def make_schema(): "version": {"type": "string"}, "repo_releasever": {"type": "string"}, "manifest_type": {"type": "string"}, + "use_buildroot_repo": {"type": "boolean"}, }, "required": [ # description_scm and description_path @@ -1272,6 +1273,7 @@ def make_schema(): "kiwibuild_bundle_name_format": {"type": "string"}, "kiwibuild_version": {"type": "string"}, "kiwibuild_repo_releasever": {"type": "string"}, + "kiwibuild_use_buildroot_repo": {"type": "boolean", "default": False}, "osbuild_target": {"type": "string"}, "osbuild_release": {"$ref": "#/definitions/optional_string"}, "osbuild_version": {"type": "string"}, diff --git a/pungi/phases/kiwibuild.py b/pungi/phases/kiwibuild.py index dcf7bf62..515a9200 100644 --- a/pungi/phases/kiwibuild.py +++ b/pungi/phases/kiwibuild.py @@ -98,6 +98,9 @@ class KiwiBuildPhase( ), "version": self.get_version(image_conf), "repo_releasever": self.get_config(image_conf, "repo_releasever"), + "use_buildroot_repo": self.get_config( + image_conf, "use_buildroot_repo" + ), } repo = self._get_repo(image_conf, variant) @@ -160,6 +163,7 @@ class RunKiwiBuildThread(WorkerThread): optional_arches=self.failable_arches, version=generics["version"], repo_releasever=generics["repo_releasever"], + use_buildroot_repo=generics["use_buildroot_repo"], ) koji.save_task_id(task_id) diff --git a/tests/test_kiwibuildphase.py b/tests/test_kiwibuildphase.py index f43219d3..94b155fe 100644 --- a/tests/test_kiwibuildphase.py +++ b/tests/test_kiwibuildphase.py @@ -48,6 +48,7 @@ class TestKiwiBuildPhase(PungiTestCase): "bundle_name_format": None, "version": compose.image_version, "repo_releasever": None, + "use_buildroot_repo": False, }, [self.topdir + "/compose/Server/$arch/os"], [], # failable arches @@ -70,6 +71,7 @@ class TestKiwiBuildPhase(PungiTestCase): "version": "Rawhide", "repo_releasever": "41", "manifest_type": "live-kiwi", + "use_buildroot_repo": False, }, MINIMAL_CONF, ) @@ -98,6 +100,7 @@ class TestKiwiBuildPhase(PungiTestCase): "bundle_name_format": "fmt", "version": "Rawhide", "repo_releasever": "41", + "use_buildroot_repo": False, }, [ "https://example.com/repo/", @@ -136,6 +139,7 @@ class TestKiwiBuildPhase(PungiTestCase): "bundle_name_format": None, "version": compose.image_version, "repo_releasever": None, + "use_buildroot_repo": False, }, [self.topdir + "/compose/Server/$arch/os"], ["x86_64"], # failable arches @@ -158,6 +162,7 @@ class TestKiwiBuildPhase(PungiTestCase): "kiwibuild_bundle_name_format": "fmt", "kiwibuild_version": "Rawhide", "kiwibuild_repo_releasever": "41", + "kiwibuild_use_buildroot_repo": False, }, ) @@ -184,6 +189,7 @@ class TestKiwiBuildPhase(PungiTestCase): "bundle_name_format": "fmt", "version": "Rawhide", "repo_releasever": "41", + "use_buildroot_repo": False, }, [self.topdir + "/compose/Server/$arch/os"], [], # failable arches @@ -226,6 +232,7 @@ class TestKiwiBuildPhase(PungiTestCase): "bundle_name_format": None, "version": "41", "repo_releasever": None, + "use_buildroot_repo": False, }, [self.topdir + "/compose/Server/$arch/os"], [], # failable arches @@ -293,6 +300,7 @@ class TestKiwiBuildThread(PungiTestCase): "bundle_name_format": "fmt", "version": "v", "repo_releasever": "r", + "use_buildroot_repo": False, }, [self.repo], [], @@ -315,6 +323,7 @@ class TestKiwiBuildThread(PungiTestCase): optional_arches=[], version="v", repo_releasever="r", + use_buildroot_repo=False, ) ] @@ -402,6 +411,7 @@ class TestKiwiBuildThread(PungiTestCase): "bundle_name_format": "fmt", "version": "v", "repo_releasever": "r", + "use_buildroot_repo": False, }, [self.repo], [], @@ -424,6 +434,7 @@ class TestKiwiBuildThread(PungiTestCase): optional_arches=[], version="v", repo_releasever="r", + use_buildroot_repo=False, ) ] @@ -491,6 +502,7 @@ class TestKiwiBuildThread(PungiTestCase): "bundle_name_format": None, "version": None, "repo_releasever": None, + "use_buildroot_repo": False, }, [self.repo], [], @@ -544,6 +556,7 @@ class TestKiwiBuildThread(PungiTestCase): "bundle_name_format": None, "version": None, "repo_releasever": None, + "use_buildroot_repo": False, }, [self.repo], ["amd64"], @@ -566,6 +579,7 @@ class TestKiwiBuildThread(PungiTestCase): optional_arches=["amd64"], version=None, repo_releasever=None, + use_buildroot_repo=False, ) ] assert get_image_paths.mock_calls == [mock.call(1234)]