Make isvalidatom() (and thus repoman) reject atoms containing |() characters. Thanks...
authorZac Medico <zmedico@gentoo.org>
Sat, 9 Dec 2006 20:13:04 +0000 (20:13 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 9 Dec 2006 20:13:04 +0000 (20:13 -0000)
svn path=/main/trunk/; revision=5241

pym/portage_dep.py

index 413e87cbbd64e1e2f734747a586ba2b023b46dcf..f0f2727879cad9a50d07950b323903ca6ea7931b 100644 (file)
@@ -18,7 +18,7 @@
 # "a? ( b? ( z ) ) -- Valid
 #
 
-import os,string,types,sys,copy
+import re, string, sys, types
 import portage_exception
 from portage_versions import catpkgsplit, catsplit, pkgcmp, pkgsplit, ververify
 
@@ -303,6 +303,8 @@ def dep_getslot(mydep):
                return mydep[colon+1:]
        return None
 
+_invalid_atom_chars_regexp = re.compile("[()|]")
+
 def isvalidatom(atom):
        """
        Check to see if a depend atom is valid
@@ -320,6 +322,9 @@ def isvalidatom(atom):
                1) 0 if the atom is invalid
                2) 1 if the atom is valid
        """
+       global _invalid_atom_chars_regexp
+       if _invalid_atom_chars_regexp.search(atom):
+               return 0
        mycpv_cps = catpkgsplit(dep_getcpv(atom))
        operator = get_operator(atom)
        if operator: