Allow repository specs for atoms with wildcards
authorSebastian Luther <SebastianLuther@gmx.de>
Tue, 12 Oct 2010 14:34:37 +0000 (16:34 +0200)
committerZac Medico <zmedico@gentoo.org>
Wed, 13 Oct 2010 15:38:48 +0000 (08:38 -0700)
pym/portage/dep/__init__.py
pym/portage/tests/dep/testAtom.py

index 268ebb6433c9a2702e6155dcb541ccd498dfecc5..b829e80451af7605e69995455d9aa2b7030d3470 100644 (file)
@@ -1010,7 +1010,7 @@ class Atom(_atom_base):
                                if cpv.find("**") != -1:
                                        raise InvalidAtom(self)
                                slot = gdict['slot']
-                               repo = None
+                               repo = gdict['repo']
                                use_str = None
                                extended_syntax = True
                        else:
@@ -1529,7 +1529,7 @@ _atom_re = re.compile('^(?P<without_use>(?:' +
 _extended_cat = r'[\w+*][\w+.*-]*'
 _extended_pkg = r'[\w+*][\w+*-]*?'
 
-_atom_wildcard_re = re.compile('(?P<simple>(' + _extended_cat + ')/(' + _extended_pkg + '))(:(?P<slot>' + _slot + '))?$')
+_atom_wildcard_re = re.compile('(?P<simple>(' + _extended_cat + ')/(' + _extended_pkg + '))(:(?P<slot>' + _slot + '))?(' + _repo_separator + '(?P<repo>' + _repo_name + '))?$')
 
 _valid_use_re = re.compile(r'^[A-Za-z0-9][A-Za-z0-9+_@-]*$')
 
index a1dea8c1f192be0c2b34269e3376fd9d6e965ac1..092cacf84c08b8b34bbf8a1113e1a23985456cb7 100644 (file)
@@ -47,6 +47,15 @@ class TestAtom(TestCase):
                                ('=*',  'sys-apps/portage', '2.1-r1', '0', '[doc]', 'repo_name'), False, True ),
                        ( "sys-apps/portage:0::repo_name[doc]",
                                (None,  'sys-apps/portage', None, '0', '[doc]', 'repo_name'), False, True ),
+
+                       ( "*/*::repo_name",
+                               (None,  '*/*', None, None, None, 'repo_name'), True, True ),
+                       ( "sys-apps/*::repo_name",
+                               (None,  'sys-apps/*', None, None, None, 'repo_name'), True, True ),
+                       ( "*/portage::repo_name",
+                               (None,  '*/portage', None, None, None, 'repo_name'), True, True ),
+                       ( "s*s-*/portage:1::repo_name",
+                               (None,  's*s-*/portage', None, '1', None, 'repo_name'), True, True ),
                )
                
                tests_xfail = (
@@ -103,6 +112,7 @@ class TestAtom(TestCase):
                        ( "=sys-apps/portage-2.1-r1:0::repo_name[doc,a=,!b=,c?,!d?,-e]", False, False ),
                        ( "=sys-apps/portage-2.1-r1*:0::repo_name[doc]", False, False ),
                        ( "sys-apps/portage:0::repo_name[doc]", False, False ),
+                       ( "*/*::repo_name", True, False ),
                )
 
                for atom, parts, allow_wildcard, allow_repo in tests: