From 48fd5974353350d8fdf9de2f2a1273f09ec48091 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 21 Dec 2007 01:19:11 +0000 Subject: 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 --- pym/portage.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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() -- cgit v1.2.3-1-g7c22