Fix portdbapi.cp_list() so that it can cope with a
authorZac Medico <zmedico@gentoo.org>
Thu, 20 Dec 2007 13:34:29 +0000 (13:34 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 20 Dec 2007 13:34:29 +0000 (13:34 -0000)
missing profile.

svn path=/main/trunk/; revision=8990

pym/portage/dbapi/__init__.py
pym/portage/dbapi/porttree.py
pym/portage/dbapi/vartree.py

index c6318bacb7f59c8b62794934983e88da2062e026..a1de0695fc0b2be4c4cc591b0af4de87c64333f3 100644 (file)
@@ -13,6 +13,7 @@ from portage.versions import catpkgsplit, catsplit, pkgcmp
 
 
 class dbapi(object):
+       _category_re = re.compile(r'^[+\w][-\.+\w]*$')
        def __init__(self):
                pass
 
index c8e8be56c0304a495004496c0545f3bf2059f815..70176c6f725514c1fabc41ffdefcc359fcc27023 100644 (file)
@@ -513,7 +513,10 @@ class portdbapi(dbapi):
                                        self.xcache["match-all"][mycp] = cachelist
                                return cachelist[:]
                mysplit = mycp.split("/")
-               invalid_category = mysplit[0] not in self._categories
+               if self.mysettings.profile_path:
+                       invalid_category = mysplit[0] not in self._categories
+               else:
+                       invalid_category = not self._category_re.match(mysplit[0])
                d={}
                if mytree:
                        mytrees = [mytree]
index 3ced505f72f97bc4106d96998d373ae367ce95bc..9c4d99277e2f2337e9614bf12a3386bb02bf5ff7 100644 (file)
@@ -165,7 +165,6 @@ class LibraryPackageMap(object):
                mapfile.close()
 
 class vardbapi(dbapi):
-       _category_re = re.compile(r'^[+\w][-\.+\w]*$')
        def __init__(self, root, categories=None, settings=None, vartree=None):
                self.root = root[:]