gather: Set lookaside flag focorrectly

For sources and debuginfo package the flag should be set based on the
repo we pull that particular RPM from, not for the corresponding binary
package.

There could be a case where they come from different repos, so this
would cause problems.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-01-25 14:13:05 +01:00
parent e8fa2a13b1
commit 0074fe3f2c
1 changed files with 2 additions and 7 deletions

View File

@ -204,9 +204,6 @@ class Gather(GatherBase):
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)
def _has_flag(self, pkg, flag):
return flag in self.result_package_flags.get(pkg, set())
def _get_best_package(self, package_list, pkg=None, req=None): def _get_best_package(self, package_list, pkg=None, req=None):
if not package_list: if not package_list:
return [] return []
@ -573,8 +570,7 @@ class Gather(GatherBase):
if not source_pkg: if not source_pkg:
continue continue
lookaside = self._has_flag(pkg, PkgFlag.lookaside) if source_pkg.repoid in self.opts.lookaside_repos:
if lookaside:
self._set_flag(source_pkg, PkgFlag.lookaside) self._set_flag(source_pkg, PkgFlag.lookaside)
if source_pkg not in self.result_source_packages: if source_pkg not in self.result_source_packages:
added.add(source_pkg) added.add(source_pkg)
@ -607,7 +603,6 @@ class Gather(GatherBase):
continue continue
debug_pkgs = [] debug_pkgs = []
lookaside = self._has_flag(pkg, PkgFlag.lookaside)
for i in candidates: for i in candidates:
if pkg.arch == 'noarch' and i.arch != 'noarch': if pkg.arch == 'noarch' and i.arch != 'noarch':
# If the package is noarch, we will only pull debuginfo if # If the package is noarch, we will only pull debuginfo if
@ -615,7 +610,7 @@ class Gather(GatherBase):
# means we don't for example pull debuginfo just because of # means we don't for example pull debuginfo just because of
# -doc subpackage. # -doc subpackage.
continue continue
if lookaside: if i.repoid in self.opts.lookaside_repos:
self._set_flag(i, PkgFlag.lookaside) self._set_flag(i, PkgFlag.lookaside)
if i not in self.result_debug_packages: if i not in self.result_debug_packages:
added.add(i) added.add(i)