From bd4193fc05af01c2f7546ab7cc99e404582a6d60 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 16 Jan 2011 05:30:18 -0800 Subject: Use Atom for stricter portdb.cp_all() validation. --- pym/portage/dbapi/__init__.py | 1 - pym/portage/dbapi/porttree.py | 11 +++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py index 0708d6840..be18b3245 100644 --- a/pym/portage/dbapi/__init__.py +++ b/pym/portage/dbapi/__init__.py @@ -20,7 +20,6 @@ from portage.localization import _ class dbapi(object): _category_re = re.compile(r'^\w[-.+\w]*$') - _pkg_dir_name_re = re.compile(r'^\w[-+\w]*$') _categories = None _use_mutable = False _known_keys = frozenset(x for x in auxdbkeys diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 2f6b9dd16..ed4db33f2 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -10,7 +10,7 @@ portage.proxy.lazyimport.lazyimport(globals(), 'portage.checksum', 'portage.data:portage_gid,secpass', 'portage.dbapi.dep_expand:dep_expand', - 'portage.dep:dep_getkey,match_from_list,use_reduce', + 'portage.dep:Atom,dep_getkey,match_from_list,use_reduce', 'portage.package.ebuild.doebuild:doebuild', 'portage.util:ensure_dirs,shlex_split,writemsg,writemsg_level', 'portage.util.listdir:listdir', @@ -684,10 +684,13 @@ class portdbapi(dbapi): for x in categories: for oroot in trees: for y in listdir(oroot+"/"+x, EmptyOnError=1, ignorecvs=1, dirsonly=1): - if not self._pkg_dir_name_re.match(y) or \ - y == "CVS": + try: + atom = Atom("%s/%s" % (x, y)) + except InvalidAtom: + continue + if atom != atom.cp: continue - d[x+"/"+y] = None + d[atom.cp] = None l = list(d) l.sort() return l -- cgit v1.2.3-1-g7c22