Skip to content

Commit

Permalink
fix globbing installs again.
Browse files Browse the repository at this point in the history
e.g. 'dnf install python-zope-*'.

Also see RhBug:864710 where this was reported originally. This time add a proper UT.
  • Loading branch information
Ales Kozumplik committed Feb 25, 2013
1 parent 86b0ea0 commit f0b18e3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 6 additions & 3 deletions dnf/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _nevra_to_filters(self, query, nevra):
@staticmethod
def _nevra_to_selector(sltr, nevra):
if nevra.name is not None:
sltr.set(name=nevra.name)
sltr.set_autoglob(name=nevra.name)
if nevra.version is not None:
evr = nevra.version
if nevra.epoch > 0:
Expand Down Expand Up @@ -118,9 +118,12 @@ def get_best_query(self, sack, with_provides=True):

def get_best_selector(self, sack, form=None):
if form:
nevra = first(self.subj.nevra_possibilities_real(sack, form=form))
nevra = first(self.subj.nevra_possibilities_real(sack,
allow_globs=True,
form=form))
else:
nevra = first(self.subj.nevra_possibilities_real(sack))
nevra = first(self.subj.nevra_possibilities_real(sack,
allow_globs=True))
if nevra:
return self._nevra_to_selector(dnf.selector.Selector(sack), nevra)

Expand Down
9 changes: 9 additions & 0 deletions tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,12 @@ def test_install_by_provides(self):
trampoline = available_by_name(self.yumbase.sack, "trampoline")
new_set = self.installed + trampoline
self.assertResult(self.yumbase, new_set)

def test_install_glob(self):
self.yumbase.install("mrkite*")
new_set = self.installed + available_by_name(self.yumbase.sack, "mrkite*")
installed, removed = self.installed_removed(self.yumbase)
self.assertItemsEqual(map(str, installed),
['mrkite-2-0.x86_64',
'mrkite-k-h-1-1.x86_64',
'trampoline-2.1-1.noarch'])

0 comments on commit f0b18e3

Please sign in to comment.