Fix isvalidatom to properly identify an invalid atom such as
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 05:17:26 +0000 (05:17 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 05:17:26 +0000 (05:17 -0000)
'dev-java/nanoxml*'. Thanks to Vlastimil Babka <caster@g.o> for reporting.
(trunk r12613:12617)

svn path=/main/branches/2.1.6/; revision=12892

pym/portage/dep.py
pym/portage/tests/dep/test_isvalidatom.py

index 9c9c1438090054e1983e63881ea3f56f73741f1a..831a8a324a267414f6e63982a0193c0af1bb2dcc 100644 (file)
@@ -782,6 +782,7 @@ def isvalidatom(atom, allow_blockers=False):
 
        cpv = dep_getcpv(atom)
        cpv_catsplit = catsplit(cpv)
+       without_slot = remove_slot(atom)
        mycpv_cps = None
        if cpv:
                if len(cpv_catsplit) == 2:
@@ -795,10 +796,12 @@ def isvalidatom(atom, allow_blockers=False):
                                        mycpv_cps[0] = "null"
                if not mycpv_cps:
                        mycpv_cps = catpkgsplit(cpv)
+               if mycpv_cps is None and cpv != without_slot:
+                       return 0
 
        operator = get_operator(atom)
        if operator:
-               if operator[0] in "<>" and remove_slot(atom).endswith("*"):
+               if operator[0] in "<>" and without_slot[-1:] == "*":
                        return 0
                if mycpv_cps:
                        if len(cpv_catsplit) == 2:
index cd501e90da717faa56596e1f016f108a1240d6df..1364a92a2d34fb537949f730f3ed16619eb18afa 100644 (file)
@@ -57,6 +57,7 @@ class IsValidAtom(TestCase):
                          ( "null/portage", True ),
                          ( "=null/portage", False ),
                          ( "=null/portage*", False ),
+                         ( "null/portage*:0", False ),
                          ( ">=null/portage-2.1", True ),
                          ( "~null/portage-2.1", True ),
                          ( "=null/portage-2.1*", True ),]