From b287376f8191f595670d0c786ad92c21c939398b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 22 Feb 2008 23:53:08 +0000 Subject: Revert portdbapi category auto-detection code since it's not really needed and can cause problems if we need to add new non-category directories in the future. We only really need the category auto-detection for bindbapi and vardbapi anyway. svn path=/main/trunk/; revision=9368 --- pym/portage/dbapi/porttree.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'pym') diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index e9fad0956..1937c4e11 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -27,9 +27,6 @@ from itertools import izip class portdbapi(dbapi): """this tree will scan a portage directory located at root (passed to init)""" portdbapi_instances = [] - _non_category_dirs = ["distfiles", "eclass", "licenses", - "local", "metadata", "packages", "profiles", "scripts"] - _non_category_dirs = re.compile(r'^(%s)$' % "|".join(_non_category_dirs)) def __init__(self, porttree_root, mysettings=None): portdbapi.portdbapi_instances.append(self) @@ -39,6 +36,7 @@ class portdbapi(dbapi): else: from portage import settings self.mysettings = config(clone=settings) + self._categories = set(self.mysettings.categories) # This is strictly for use in aux_get() doebuild calls when metadata # is generated by the depend phase. It's safest to use a clone for # this purpose because doebuild makes many changes to the config @@ -486,11 +484,8 @@ class portdbapi(dbapi): def cp_all(self): "returns a list of all keys in our tree" d = {} - for oroot in self.porttrees: - for x in listdir(oroot, EmptyOnError=1, ignorecvs=1, dirsonly=1): - if not self._category_re.match(x) or \ - self._non_category_dirs.match(x): - continue + for x in self.mysettings.categories: + for oroot in self.porttrees: for y in listdir(oroot+"/"+x, EmptyOnError=1, ignorecvs=1, dirsonly=1): if not self._pkg_dir_name_re.match(y) or \ y == "CVS": @@ -520,7 +515,7 @@ class portdbapi(dbapi): self.xcache["match-all"][mycp] = cachelist return cachelist[:] mysplit = mycp.split("/") - invalid_category = not self._category_re.match(mysplit[0]) + invalid_category = mysplit[0] not in self._categories d={} if mytree: mytrees = [mytree] -- cgit v1.2.3-1-g7c22