Boost prepopulate by using query cache.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Daniel Mach 2016-04-06 06:22:55 -04:00 committed by Lubomír Sedlář
parent 321d471125
commit c02d801988

View File

@ -409,13 +409,16 @@ class Gather(GatherBase):
# multilib # multilib
self.q_multilib_binary_packages_cache = QueryCache(self.q_multilib_binary_packages, "name", "version", "release", arch__neq="noarch") self.q_multilib_binary_packages_cache = QueryCache(self.q_multilib_binary_packages, "name", "version", "release", arch__neq="noarch")
# prepopulate
self.prepopulate_cache = QueryCache(self.q_binary_packages, "name", "arch")
@Profiler("Gather.add_prepopulate_packages()") @Profiler("Gather.add_prepopulate_packages()")
def add_prepopulate_packages(self): def add_prepopulate_packages(self):
added = set() added = set()
for name_arch in self.opts.prepopulate: for name_arch in self.opts.prepopulate:
name, arch = name_arch.rsplit(".", 1) name, arch = name_arch.rsplit(".", 1)
pkgs = self.q_binary_packages.filter_autoglob(name=name, arch=arch) pkgs = self.prepopulate_cache.get(name, arch)
pkgs = self._get_best_package(pkgs) pkgs = self._get_best_package(pkgs)
if pkgs: if pkgs:
added.update(pkgs) added.update(pkgs)