From fc86e03e4403f1eaa491fc743972f3c6e3b67438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Tue, 24 Oct 2023 10:16:06 +0200 Subject: [PATCH] pkgset: ignore events for modular content tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generally we want all packages to come from particular event. There are two exceptions: packages configured via `pkgset_koji_builds` are pulled in by exact NVR and skip event; and modules in `pkgset_koji_modules` are pulled in by NSVC and also ignore events. However, the modular content tag did honor event, and could lead to a crashed compose if the content tag did not exist at the configured event. This patch is a slightly too big hammer. It ignores events for all modules, not just ones configured by explicit NSVC. It's not a huge deal as the content tags are created before the corresponding module build is created, and once all rpm builds are tagged into the content tag, MBS will never change it again. JIRA: RHELCMP-12765 Signed-off-by: Lubomír Sedlář (cherry picked from commit b32c8f3e5e401bb28f3c9412962a4027f438cd4a) --- pungi/phases/pkgset/sources/source_koji.py | 8 +++++++- tests/test_pkgset_source_koji.py | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/pungi/phases/pkgset/sources/source_koji.py b/pungi/phases/pkgset/sources/source_koji.py index bd9cb5d5..18c6746d 100644 --- a/pungi/phases/pkgset/sources/source_koji.py +++ b/pungi/phases/pkgset/sources/source_koji.py @@ -901,7 +901,13 @@ def populate_global_pkgset(compose, koji_wrapper, event): if pkgset.reuse is None: pkgset.populate( compose_tag, - event, + # We care about packages as they existed on the specified + # event. However, modular content tags are not expected to + # change, so the event doesn't matter there. If an exact NSVC + # of a module is specified, the code above would happily find + # its content tag, but fail here if the content tag doesn't + # exist at the given event. + event=event if is_traditional else None, inherit=should_inherit, include_packages=modular_packages, ) diff --git a/tests/test_pkgset_source_koji.py b/tests/test_pkgset_source_koji.py index 3f90822b..b270bd52 100644 --- a/tests/test_pkgset_source_koji.py +++ b/tests/test_pkgset_source_koji.py @@ -116,7 +116,14 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase): self.assertEqual(len(pkgsets), 1) self.assertIs(pkgsets[0], orig_pkgset) pkgsets[0].assert_has_calls( - [mock.call.populate("f25", 123456, inherit=True, include_packages=set())], + [ + mock.call.populate( + "f25", + event=123456, + inherit=True, + include_packages=set(), + ), + ], ) def mock_materialize(self, compose, pkgset, prefix, mmd): @@ -157,12 +164,16 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase): ) pkgsets[0].assert_has_calls( - [mock.call.populate("f25", 123456, inherit=True, include_packages=set())] + [ + mock.call.populate( + "f25", event=123456, inherit=True, include_packages=set() + ), + ] ) pkgsets[1].assert_has_calls( [ mock.call.populate( - "f25-extra", 123456, inherit=True, include_packages=set() + "f25-extra", event=123456, inherit=True, include_packages=set() ), ] )