Additional profiling in Gather.add_initial_packages().

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

View File

@ -337,15 +337,16 @@ class Gather(GatherBase):
exclude = set() exclude = set()
for pattern in excludes: for pattern in excludes:
# TODO: debug, source with Profiler("Gather.add_initial_packages():exclude"):
if pattern.endswith(".+"): # TODO: debug, source
pkgs = self.q_multilib_binary_packages.filter_autoglob(name=pattern[:-2]) if pattern.endswith(".+"):
else: pkgs = self.q_multilib_binary_packages.filter_autoglob(name=pattern[:-2])
pkgs = self.q_binary_packages.filter_autoglob(name=pattern) else:
pkgs = self.q_binary_packages.filter_autoglob(name=pattern)
exclude.update(pkgs) exclude.update(pkgs)
print "EXCLUDED: %s" % list(pkgs) print "EXCLUDED: %s" % list(pkgs)
self.dnf._sack.add_excludes(pkgs) self.dnf._sack.add_excludes(pkgs)
# HACK # HACK
self.q_binary_packages = self.q_binary_packages.filter(pkg=[i for i in self.q_binary_packages if i not in exclude]).apply() self.q_binary_packages = self.q_binary_packages.filter(pkg=[i for i in self.q_binary_packages if i not in exclude]).apply()
@ -356,33 +357,35 @@ class Gather(GatherBase):
self.init_query_cache() self.init_query_cache()
for pattern in includes: for pattern in includes:
if pattern == "system-release" and self.opts.greedy_method == "all": with Profiler("Gather.add_initial_packages():include"):
pkgs = self.q_binary_packages.filter(provides=hawkey.Reldep(self.dnf.sack, "system-release")).apply() if pattern == "system-release" and self.opts.greedy_method == "all":
else: pkgs = self.q_binary_packages.filter(provides=hawkey.Reldep(self.dnf.sack, "system-release")).apply()
if pattern.endswith(".+"):
pkgs = self.q_multilib_binary_packages.filter_autoglob(name=pattern[:-2]).apply()
else: else:
pkgs = self.q_binary_packages.filter_autoglob(name=pattern).apply() if pattern.endswith(".+"):
pkgs = self.q_multilib_binary_packages.filter_autoglob(name=pattern[:-2]).apply()
else:
pkgs = self.q_binary_packages.filter_autoglob(name=pattern).apply()
pkgs = self._get_best_package(pkgs) pkgs = self._get_best_package(pkgs)
if pkgs: if pkgs:
added.update(pkgs) added.update(pkgs)
else: else:
print "Doesn't match: %s" % pattern print "Doesn't match: %s" % pattern
for pkg in added: for pkg in added:
self._set_flag(pkg, "input") self._set_flag(pkg, "input")
if self.opts.greedy_method == "build": if self.opts.greedy_method == "build":
for pkg in added.copy(): for pkg in added.copy():
prov = hawkey.Reldep(self.dnf._sack, pkg.name) with Profiler("Gather.add_initial_packages():greedy-build"):
if pkg in self.q_native_binary_packages: prov = hawkey.Reldep(self.dnf._sack, pkg.name)
greedy_build_packages = self.q_native_binary_packages.filter(sourcerpm=pkg.sourcerpm, provides=prov) if pkg in self.q_native_binary_packages:
else: greedy_build_packages = self.q_native_binary_packages.filter(sourcerpm=pkg.sourcerpm, provides=prov)
greedy_build_packages = self.q_multilib_binary_packages.filter(sourcerpm=pkg.sourcerpm, provides=prov) else:
for i in greedy_build_packages: greedy_build_packages = self.q_multilib_binary_packages.filter(sourcerpm=pkg.sourcerpm, provides=prov)
self._set_flag(i, "input", "greedy:build") for i in greedy_build_packages:
added.add(i) self._set_flag(i, "input", "greedy:build")
added.add(i)
return added return added