Improve depsolving speed by pre-computing provides query.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Daniel Mach 2015-09-18 10:08:59 -04:00 committed by Lubomír Sedlář
parent 026e49e259
commit 61e76d5824

View File

@ -209,11 +209,6 @@ class Gather(GatherBase):
self.result_source_packages = set() self.result_source_packages = set()
self.result_package_flags = {} self.result_package_flags = {}
self.provides_cache = {}
for i in self.q_binary_packages:
for prov in i.provides:
self.provides_cache.setdefault(str(prov), set()).add(i)
def _set_flag(self, pkg, *flags): def _set_flag(self, pkg, *flags):
self.result_package_flags.setdefault(pkg, set()).update(flags) self.result_package_flags.setdefault(pkg, set()).update(flags)
@ -302,6 +297,7 @@ class Gather(GatherBase):
assert pkg is not None assert pkg is not None
result = set() result = set()
q = self.q_binary_packages.filter(provides=pkg.requires).apply()
for req in pkg.requires: for req in pkg.requires:
deps = self.finished_get_package_deps_reqs.setdefault(str(req), set()) deps = self.finished_get_package_deps_reqs.setdefault(str(req), set())
if deps: if deps:
@ -309,8 +305,8 @@ class Gather(GatherBase):
continue continue
# TODO: need query also debuginfo # TODO: need query also debuginfo
deps = q.filter(provides=req)
deps = self.q_binary_packages.filter(provides=req).apply() if deps:
deps = self._get_best_package(deps, req=req) deps = self._get_best_package(deps, req=req)
self.finished_get_package_deps_reqs[str(req)].update(deps) self.finished_get_package_deps_reqs[str(req)].update(deps)
result.update(deps) result.update(deps)
@ -629,6 +625,11 @@ class Gather(GatherBase):
except KeyError: except KeyError:
patterns = [i["install"] for i in langpack_patterns if i["name"] == pkg.name] patterns = [i["install"] for i in langpack_patterns if i["name"] == pkg.name]
patterns = [i.replace("%s", "*") for i in patterns] patterns = [i.replace("%s", "*") for i in patterns]
if not patterns:
self.finished_add_langpack_packages[pkg] = []
continue
langpack_pkgs = self.q_binary_packages.filter(name__glob=patterns).apply() langpack_pkgs = self.q_binary_packages.filter(name__glob=patterns).apply()
langpack_pkgs = langpack_pkgs.filter(name__glob__not=["*-devel", "*-static"]) langpack_pkgs = langpack_pkgs.filter(name__glob__not=["*-devel", "*-static"])
langpack_pkgs = langpack_pkgs.filter(name__neq=exceptions) langpack_pkgs = langpack_pkgs.filter(name__neq=exceptions)