diff --git a/pungi/phases/pkgset/pkgsets.py b/pungi/phases/pkgset/pkgsets.py index 9fa0bcf5..7d39d8c3 100644 --- a/pungi/phases/pkgset/pkgsets.py +++ b/pungi/phases/pkgset/pkgsets.py @@ -731,17 +731,22 @@ class KojiPackageSet(PackageSetBase): % (old_koji_event, koji_event) ) changed = self.koji_proxy.queryHistory( - tables=["tag_listing"], tag=tag, afterEvent=old_koji_event + tables=["tag_listing", "tag_inheritance"], + tag=tag, + afterEvent=old_koji_event, ) if changed["tag_listing"]: self.log_debug("Builds under tag %s changed. Can't reuse." % tag) return False + if changed["tag_inheritance"]: + self.log_debug("Tag inheritance %s changed. Can't reuse." % tag) + return False if inherit: inherit_tags = self.koji_proxy.getFullInheritance(tag, koji_event) for t in inherit_tags: changed = self.koji_proxy.queryHistory( - tables=["tag_listing"], + tables=["tag_listing", "tag_inheritance"], tag=t["name"], afterEvent=old_koji_event, beforeEvent=koji_event + 1, @@ -752,6 +757,9 @@ class KojiPackageSet(PackageSetBase): % t["name"] ) return False + if changed["tag_inheritance"]: + self.log_debug("Tag inheritance %s changed. Can't reuse." % tag) + return False repo_dir = compose.paths.work.pkgset_repo(tag, create_dir=False) old_repo_dir = compose.paths.old_compose_path(repo_dir) diff --git a/tests/test_pkgset_pkgsets.py b/tests/test_pkgset_pkgsets.py index 94fae923..555a313b 100644 --- a/tests/test_pkgset_pkgsets.py +++ b/tests/test_pkgset_pkgsets.py @@ -632,7 +632,10 @@ class TestReuseKojiPkgset(helpers.PungiTestCase): def test_reuse_build_under_tag_changed(self, mock_old_topdir): mock_old_topdir.return_value = self.old_compose_dir self.pkgset._get_koji_event_from_file = mock.Mock(side_effect=[3, 1]) - self.koji_wrapper.koji_proxy.queryHistory.return_value = {"tag_listing": [{}]} + self.koji_wrapper.koji_proxy.queryHistory.return_value = { + "tag_listing": [{}], + "tag_inheritance": [], + } self.pkgset.try_to_reuse(self.compose, self.tag) @@ -652,8 +655,8 @@ class TestReuseKojiPkgset(helpers.PungiTestCase): mock_old_topdir.return_value = self.old_compose_dir self.pkgset._get_koji_event_from_file = mock.Mock(side_effect=[3, 1]) self.koji_wrapper.koji_proxy.queryHistory.side_effect = [ - {"tag_listing": []}, - {"tag_listing": [{}]}, + {"tag_listing": [], "tag_inheritance": []}, + {"tag_listing": [{}], "tag_inheritance": []}, ] self.koji_wrapper.koji_proxy.getFullInheritance.return_value = [ {"name": self.inherited_tag} @@ -680,7 +683,10 @@ class TestReuseKojiPkgset(helpers.PungiTestCase): def test_reuse_failed_load_reuse_file(self, mock_old_topdir, mock_exists): mock_old_topdir.return_value = self.old_compose_dir self.pkgset._get_koji_event_from_file = mock.Mock(side_effect=[3, 1]) - self.koji_wrapper.koji_proxy.queryHistory.return_value = {"tag_listing": []} + self.koji_wrapper.koji_proxy.queryHistory.return_value = { + "tag_listing": [], + "tag_inheritance": [], + } self.koji_wrapper.koji_proxy.getFullInheritance.return_value = [] self.pkgset.load_old_file_cache = mock.Mock( side_effect=Exception("unknown error") @@ -712,7 +718,10 @@ class TestReuseKojiPkgset(helpers.PungiTestCase): def test_reuse_criteria_not_match(self, mock_old_topdir, mock_exists): mock_old_topdir.return_value = self.old_compose_dir self.pkgset._get_koji_event_from_file = mock.Mock(side_effect=[3, 1]) - self.koji_wrapper.koji_proxy.queryHistory.return_value = {"tag_listing": []} + self.koji_wrapper.koji_proxy.queryHistory.return_value = { + "tag_listing": [], + "tag_inheritance": [], + } self.koji_wrapper.koji_proxy.getFullInheritance.return_value = [] self.pkgset.load_old_file_cache = mock.Mock( return_value={"allow_invalid_sigkeys": True} @@ -751,7 +760,10 @@ class TestReuseKojiPkgset(helpers.PungiTestCase): def test_reuse_pkgset(self, mock_old_topdir, mock_exists, mock_copy_all): mock_old_topdir.return_value = self.old_compose_dir self.pkgset._get_koji_event_from_file = mock.Mock(side_effect=[3, 1]) - self.koji_wrapper.koji_proxy.queryHistory.return_value = {"tag_listing": []} + self.koji_wrapper.koji_proxy.queryHistory.return_value = { + "tag_listing": [], + "tag_inheritance": [], + } self.koji_wrapper.koji_proxy.getFullInheritance.return_value = [] self.pkgset.load_old_file_cache = mock.Mock( return_value={