pkgset: Merge initial package set without checks
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>
This commit is contained in:
parent
b393a4246b
commit
c83316da31
@ -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):
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user