From: Zac Medico Date: Fri, 21 Dec 2007 01:16:27 +0000 (-0000) Subject: Use a regex to validate package directory names in portdbapi.cp_list() X-Git-Tag: v2.2_pre1~136 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=eedeb52d39a70a253b33f7ce8e78bb05ff7f29bd;p=portage.git Use a regex to validate package directory names in portdbapi.cp_list() and also simplify the catagory regex a bit. svn path=/main/trunk/; revision=9010 --- diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py index a1de0695f..0e473ddd1 100644 --- a/pym/portage/dbapi/__init__.py +++ b/pym/portage/dbapi/__init__.py @@ -13,7 +13,8 @@ from portage.versions import catpkgsplit, catsplit, pkgcmp class dbapi(object): - _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 diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 7df97959d..7ce65b998 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -493,6 +493,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()