diff --git a/pungi/phases/pkgset/pkgsets.py b/pungi/phases/pkgset/pkgsets.py index 36b3fa7f..2fcde67f 100644 --- a/pungi/phases/pkgset/pkgsets.py +++ b/pungi/phases/pkgset/pkgsets.py @@ -195,6 +195,17 @@ class PackageSetBase(kobo.log.LoggingBase): self.log_debug("[DONE ] %s" % msg) + def fast_merge(self, other): + """ + Merge two package sets together without any filtering of packages. All + packages from `other` package set are taken. + """ + for arch in other.rpms_by_arch.keys(): + self.rpms_by_arch.setdefault(arch, []) + for i in other.rpms_by_arch.get(arch, []): + self.file_cache.file_cache[i.file_path] = i + self.rpms_by_arch[arch].append(i) + def save_file_list(self, file_path, remove_path_prefix=None): with open(file_path, "w") as f: for arch in sorted(self.rpms_by_arch): diff --git a/pungi/phases/pkgset/sources/source_koji.py b/pungi/phases/pkgset/sources/source_koji.py index ce1263b2..ffa75cf2 100644 --- a/pungi/phases/pkgset/sources/source_koji.py +++ b/pungi/phases/pkgset/sources/source_koji.py @@ -321,13 +321,13 @@ def populate_global_pkgset(compose, koji_wrapper, path_prefix, event_id): if len(variant_tags[variant]) == 1: variant.pkgset = pkgset else: - variant.pkgset.merge(pkgset, None, list(all_arches)) + variant.pkgset.fast_merge(pkgset) # Optimization for case where we have just single compose # tag - we do not have to merge in this case... if len(compose_tags) == 1: global_pkgset = pkgset else: - global_pkgset.merge(pkgset, None, list(all_arches)) + global_pkgset.fast_merge(pkgset) with open(global_pkgset_path, 'wb') as f: data = pickle.dumps(global_pkgset) f.write(data) diff --git a/tests/test_pkgset_source_koji.py b/tests/test_pkgset_source_koji.py index b1e1308d..53670843 100644 --- a/tests/test_pkgset_source_koji.py +++ b/tests/test_pkgset_source_koji.py @@ -170,8 +170,8 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase): logfile=self.topdir + '/logs/global/packages_from_f25-extra.global.log')]) pkgset.assert_has_calls([mock.call.save_file_list(self.topdir + '/work/global/package_list/global.conf', remove_path_prefix='/prefix')]) - # for each tag, call pkgset.merge once for each variant and once for global pkgset - self.assertEqual(pkgset.merge.call_count, 2 * (len(self.compose.all_variants.values()) + 1)) + # for each tag, call pkgset.fast_merge once for each variant and once for global pkgset + self.assertEqual(pkgset.fast_merge.call_count, 2 * (len(self.compose.all_variants.values()) + 1)) self.assertItemsEqual(pickle_dumps.call_args_list, [mock.call(orig_pkgset)]) with open(self.pkgset_path) as f: