summaryrefslogtreecommitdiffstats
path: root/pym/portage/dep.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-08 08:07:03 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-08 08:07:03 +0000
commit817594390e64888da26950477ca99bc334eeeed4 (patch)
treec80aa73a93341d341754b1c2f55d2ddf16b4077a /pym/portage/dep.py
parentb0526977815637c3f44bb1f11d6e700a6250588e (diff)
downloadportage-817594390e64888da26950477ca99bc334eeeed4.tar.gz
portage-817594390e64888da26950477ca99bc334eeeed4.tar.bz2
portage-817594390e64888da26950477ca99bc334eeeed4.zip
Fix isvalidatom() to check the 'must not end in' clause from PMS 2.1.2.
Thanks to Marat Radchenko <marat@slonopotamus.org> for this patch. svn path=/main/trunk/; revision=14216
Diffstat (limited to 'pym/portage/dep.py')
-rw-r--r--pym/portage/dep.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/pym/portage/dep.py b/pym/portage/dep.py
index 0bc9fe647..81364f344 100644
--- a/pym/portage/dep.py
+++ b/pym/portage/dep.py
@@ -840,8 +840,9 @@ _cat = r'[A-Za-z0-9+_][A-Za-z0-9+_.-]*'
# 2.1.2 A package name may contain any of the characters [A-Za-z0-9+_-].
# It must not begin with a hyphen,
# and must not end in a hyphen followed by one or more digits.
-# FIXME: this regex doesn't check 'must not end in' clause.
-_pkg = r'[A-Za-z0-9+_][A-Za-z0-9+_-]*'
+_pkg = r'([A-Za-z+_]+[A-Za-z0-9+_]+|([A-Za-z0-9+_](' + \
+ '[A-Za-z0-9+_-]?|' + \
+ '([A-Za-z0-9+_-]*(([A-Za-z0-9+_][A-Za-z+_-]+)|([A-Za-z+_][A-Za-z0-9+_]+))))))'
# 2.1.3 A slot name may contain any of the characters [A-Za-z0-9+_.-].
# It must not begin with a hyphen or a dot.
@@ -852,7 +853,7 @@ _op = r'([=><~]|([><]=))'
_cp = _cat + '/' + _pkg
_cpv = _cp + '-' + _version
-_atom = re.compile(r'^(' +
+_atom_re = re.compile(r'^(' +
'(' + _op + _cpv + _slot + _use + ')|' +
'(=' + _cpv + r'\*' + _slot + _use + ')|' +
'(' + _cp + _slot + _use + ')' +
@@ -887,7 +888,7 @@ def isvalidatom(atom, allow_blockers=False):
atom = atom[2:]
else:
atom = atom[1:]
- if _atom.match(atom) is None:
+ if _atom_re.match(atom) is None:
return False
try:
use = dep_getusedeps(atom)