summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-12-21 01:19:11 +0000
committerZac Medico <zmedico@gentoo.org>2007-12-21 01:19:11 +0000
commit48fd5974353350d8fdf9de2f2a1273f09ec48091 (patch)
treeba7bff26670dd3c49bd6bc2dd028ac801d09afc6
parent262cdc8dc009745b86e43702ec82ee84b8df5672 (diff)
downloadportage-48fd5974353350d8fdf9de2f2a1273f09ec48091.tar.gz
portage-48fd5974353350d8fdf9de2f2a1273f09ec48091.tar.bz2
portage-48fd5974353350d8fdf9de2f2a1273f09ec48091.zip
Use a regex to validate package directory names in portdbapi.cp_list()
and also simplify the catagory regex a bit. (trunk r9010) svn path=/main/branches/2.1.2/; revision=9011
-rw-r--r--pym/portage.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 7dd7d22ef..08accebd4 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -5791,7 +5791,8 @@ class portagetree:
class dbapi:
- _category_re = re.compile(r'^[+\w][-\.+\w]*$')
+ _category_re = re.compile(r'^\w[-.+\w]*$')
+ _pkg_dir_name_re = re.compile(r'^\w[-+\w]*$')
def __init__(self):
pass
@@ -7163,6 +7164,9 @@ class portdbapi(dbapi):
self._non_category_dirs.match(x):
continue
for y in listdir(oroot+"/"+x, EmptyOnError=1, ignorecvs=1, dirsonly=1):
+ if not self._pkg_dir_name_re.match(y) or \
+ y == "CVS":
+ continue
d[x+"/"+y] = None
l = d.keys()
l.sort()