summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-11 05:17:26 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-11 05:17:26 +0000
commit917ad1ebbcc9f327a519a774c87be1ca6e41b8ea (patch)
treec25e9dc554a3ee735e33b5d35829c51e2572e2c8
parenta39b66a3616a7831d9093d46c0d9e5d65fbc1c4f (diff)
downloadportage-917ad1ebbcc9f327a519a774c87be1ca6e41b8ea.tar.gz
portage-917ad1ebbcc9f327a519a774c87be1ca6e41b8ea.tar.bz2
portage-917ad1ebbcc9f327a519a774c87be1ca6e41b8ea.zip
Fix isvalidatom to properly identify an invalid atom such as
'dev-java/nanoxml*'. Thanks to Vlastimil Babka <caster@g.o> for reporting. (trunk r12613:12617) svn path=/main/branches/2.1.6/; revision=12892
-rw-r--r--pym/portage/dep.py5
-rw-r--r--pym/portage/tests/dep/test_isvalidatom.py1
2 files changed, 5 insertions, 1 deletions
diff --git a/pym/portage/dep.py b/pym/portage/dep.py
index 9c9c14380..831a8a324 100644
--- a/pym/portage/dep.py
+++ b/pym/portage/dep.py
@@ -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:
diff --git a/pym/portage/tests/dep/test_isvalidatom.py b/pym/portage/tests/dep/test_isvalidatom.py
index cd501e90d..1364a92a2 100644
--- a/pym/portage/tests/dep/test_isvalidatom.py
+++ b/pym/portage/tests/dep/test_isvalidatom.py
@@ -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 ),]