commit:     7a6099f046a0c1f7d45751daf13c1e68253878aa
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 18 21:19:39 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb 19 19:18:24 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7a6099f0

emerge --search: use slash to auto-detect category (bug 647940)

Since search strings containing a slash do no work unless category
match mode is enabled, use slash to auto-detect category match mode,
so that users do not have to prefix the search string with the special
@ symbol.

Bug: https://bugs.gentoo.org/647940
Reviewed-by: Brian Dolbec <dolsen <AT> gentoo.org>
Reviewed-by: M. J. Everitt <m.j.everitt <AT> iee.org>

 pym/_emerge/search.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/search.py b/pym/_emerge/search.py
index 36897fb15..eb52b2ca3 100644
--- a/pym/_emerge/search.py
+++ b/pym/_emerge/search.py
@@ -256,6 +256,10 @@ class search(object):
                if self.searchkey.startswith('@'):
                        match_category = 1
                        self.searchkey = self.searchkey[1:]
+               # Auto-detect category match mode (@ symbol can be deprecated
+               # after this is available in a stable version of portage).
+               if '/' in self.searchkey:
+                       match_category = 1
                fuzzy = False
                if regexsearch:
                        self.searchre=re.compile(self.searchkey,re.I)

Reply via email to