81 lines
3.9 KiB
Diff
81 lines
3.9 KiB
Diff
From 40c8f95b2bba62f454c7f996409e8bf1d775eee4 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
|
Date: Wed, 7 Mar 2018 13:59:12 +0100
|
|
Subject: [PATCH 08/12] pkgset: Merge initial package set without checks
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
For the first pass we don't need to filter out exclusive architectures,
|
|
and we don't need to exclude source packages without any binary
|
|
packages. We just want to merge the two package sets as fast as
|
|
possible.
|
|
|
|
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
|
|
---
|
|
pungi/phases/pkgset/pkgsets.py | 11 +++++++++++
|
|
pungi/phases/pkgset/sources/source_koji.py | 4 ++--
|
|
tests/test_pkgset_source_koji.py | 4 ++--
|
|
3 files changed, 15 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/pungi/phases/pkgset/pkgsets.py b/pungi/phases/pkgset/pkgsets.py
|
|
index 9038f1b1..d53c6af9 100644
|
|
--- a/pungi/phases/pkgset/pkgsets.py
|
|
+++ b/pungi/phases/pkgset/pkgsets.py
|
|
@@ -182,6 +182,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 94ee79df..2ce14be6 100644
|
|
--- a/pungi/phases/pkgset/sources/source_koji.py
|
|
+++ b/pungi/phases/pkgset/sources/source_koji.py
|
|
@@ -308,13 +308,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:
|
|
--
|
|
2.13.6
|
|
|