summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-01-16 05:30:18 -0800
committerZac Medico <zmedico@gentoo.org>2011-01-16 12:36:37 -0800
commitfff289dfb3b36a9aee535c1ad5f8962ecac31524 (patch)
tree774cac49b94797430d15ff515e726ff3f858b019
parentCONTENTS: handle malformed sym entries (diff)
downloadportage-fff289dfb3b36a9aee535c1ad5f8962ecac31524.tar.gz
portage-fff289dfb3b36a9aee535c1ad5f8962ecac31524.tar.bz2
portage-fff289dfb3b36a9aee535c1ad5f8962ecac31524.zip
Use Atom for stricter portdb.cp_all() validation.
-rw-r--r--pym/portage/dbapi/__init__.py1
-rw-r--r--pym/portage/dbapi/porttree.py11
2 files changed, 7 insertions, 5 deletions
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index 53adfbe74..cddf04ab0 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 c72e17812..5014d2103 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.env.loaders:KeyValuePairFileLoader',
'portage.package.ebuild.doebuild:doebuild',
'portage.util:ensure_dirs,shlex_split,writemsg,writemsg_level',
@@ -768,10 +768,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