For bug #163990, warn about ebuilds with invalid categories and do not allow them...
authorZac Medico <zmedico@gentoo.org>
Sun, 18 Feb 2007 08:23:18 +0000 (08:23 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 18 Feb 2007 08:23:18 +0000 (08:23 -0000)
svn path=/main/branches/2.1.2/; revision=5989

pym/portage.py

index fe023f3781b4fcc8e80b2f53bcacfbfa61500cd5..1691d96a5551f6072bdfa037aa8b8f1b5f92484f 100644 (file)
@@ -5610,7 +5610,7 @@ class portdbapi(dbapi):
                else:
                        global 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
@@ -6026,6 +6026,7 @@ class portdbapi(dbapi):
 
        def cp_list(self, mycp, use_cache=1, mytree=None):
                mysplit=mycp.split("/")
+               invalid_category = mysplit[0] not in self._categories
                d={}
                if mytree:
                        mytrees = [mytree]
@@ -6041,6 +6042,10 @@ class portdbapi(dbapi):
                                                        os.path.join(oroot, mycp, x), noiselevel=-1)
                                                continue
                                        d[mysplit[0]+"/"+pf] = None
+               if invalid_category and d:
+                       writemsg(("\n!!! '%s' has a category that is not listed in " + \
+                               "/etc/portage/categories\n") % mycp, noiselevel=-1)
+                       return []
                return d.keys()
 
        def freeze(self):