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

svn path=/main/branches/2.1.2/; revision=8991

pym/portage.py

index bfb330095463a18b8744d01dfa614c2957f04d7e..c9dfe0d77a95896d34d96a91a71c88480b3f4b70 100644 (file)
@@ -5791,6 +5791,7 @@ class portagetree:
 
 
 class dbapi:
+       _category_re = re.compile(r'^[+\w][-\.+\w]*$')
        def __init__(self):
                pass
 
@@ -6078,7 +6079,6 @@ class bindbapi(fakedbapi):
                return fakedbapi.cpv_all(self)
 
 class vardbapi(dbapi):
-       _category_re = re.compile(r'^[+\w][-\.+\w]*$')
        def __init__(self, root, categories=None, settings=None, vartree=None):
                self.root       = root[:]
                #cache for category directory mtimes
@@ -7192,7 +7192,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]