diff --git a/pungi/phases/gather/__init__.py b/pungi/phases/gather/__init__.py index 436d582f..8667b678 100644 --- a/pungi/phases/gather/__init__.py +++ b/pungi/phases/gather/__init__.py @@ -238,7 +238,7 @@ def reuse_old_gather_packages(compose, arch, variant, package_sets): # The gather_lookaside_repos config allows setting multiple repourls # using list, but `_update_config` always uses strings. Therefore we # only try to filter out string_types. - if isinstance(repourl, six.string_types): + if not isinstance(repourl, six.string_types): continue if not repourl.startswith(compose.topdir): per_arch_repos_to_compare[arch] = repourl diff --git a/tests/test_gather_phase.py b/tests/test_gather_phase.py index c9b2086d..bf831c19 100644 --- a/tests/test_gather_phase.py +++ b/tests/test_gather_phase.py @@ -1236,6 +1236,26 @@ class TestReuseOldGatherPackages(helpers.PungiTestCase): ) self.assertEqual(result, None) + @mock.patch("pungi.phases.gather.load_old_gather_result") + @mock.patch("pungi.phases.gather.load_old_compose_config") + def test_reuse_update_gather_lookaside_repos_different_initial_repos_list( + self, load_old_compose_config, load_old_gather_result + ): + package_sets = self._prepare_package_sets( + load_old_gather_result, requires=[], provides=[] + ) + compose = helpers.DummyCompose(self.topdir, {"gather_allow_reuse": True}) + lookasides = compose.conf["gather_lookaside_repos"] + repos = ["http://localhost/real1.repo", "http://localhost/real2.repo"] + lookasides.append(("^Server$", {"x86_64": repos})) + load_old_compose_config.return_value = copy.deepcopy(compose.conf) + + gather._update_config(compose, "Server", "x86_64", compose.topdir) + result = gather.reuse_old_gather_packages( + compose, "x86_64", compose.variants["Server"], package_sets + ) + self.assertEqual(result, None) + @mock.patch("pungi.phases.gather.load_old_gather_result") @mock.patch("pungi.phases.gather.load_old_compose_config") def test_reuse_no_old_file_cache(