Fix handling globs in input packages

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-01-20 10:17:19 +01:00
parent a9415eb0e5
commit d4f8e32a80
2 changed files with 13 additions and 8 deletions

View File

@ -340,12 +340,21 @@ class Gather(GatherBase):
else:
pkgs = self.q_binary_packages.filter(name__glob=pattern).apply()
pkgs = self._get_best_package(pkgs)
if pkgs:
added.update(pkgs)
else:
if not pkgs:
self.logger.error("No package matches pattern %s" % pattern)
# The pattern could have been a glob. In that case we want to
# group the packages by name and get best match in those
# smaller groups.
packages_by_name = {}
for po in pkgs:
packages_by_name.setdefault(po.name, []).append(po)
for name, packages in packages_by_name.iteritems():
pkgs = self._get_best_package(packages)
if pkgs:
added.update(pkgs)
for pkg in added:
self._set_flag(pkg, PkgFlag.input)

View File

@ -1717,10 +1717,6 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase):
def test_multilib_exclude_pattern_does_not_match_noarch(self):
pass
@unittest.skip('Not implemented yet')
def test_input_by_wildcard(self):
pass
def test_firefox_selfhosting_with_krb5_lookaside(self):
super(DNFDepsolvingTestCase, self).test_firefox_selfhosting_with_krb5_lookaside()
self.assertFlags("dummy-krb5-1.10-5.x86_64", [PkgFlag.lookaside])