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

pym/portage.py

index 1691d96a5551f6072bdfa037aa8b8f1b5f92484f..fadc9cec5e0ba8621c697a0a9f08c77921aebb3f 100644 (file)
@@ -6498,6 +6498,8 @@ class binarytree(object):
                if (not os.path.isdir(self.pkgdir+"/All") and not getbinpkgs):
                        return 0
 
+               categories = set(self.settings.categories)
+
                if not getbinpkgsonly:
                        pkg_paths = {}
                        dirs = listdir(self.pkgdir, dirsonly=True, EmptyOnError=True)
@@ -6536,6 +6538,14 @@ class binarytree(object):
                                        if mycpv in pkg_paths:
                                                # All is first, so it's preferred.
                                                continue
+                                       if mycat not in categories:
+                                               writemsg(("!!! Binary package has an " + \
+                                                       "unrecognized category: '%s'\n") % full_path,
+                                                       noiselevel=-1)
+                                               writemsg(("!!! '%s' has a category that is not" + \
+                                                       " listed in /etc/portage/categories\n") % mycpv,
+                                                       noiselevel=-1)
+                                               continue
                                        pkg_paths[mycpv] = mypath
                                        self.dbapi.cpv_inject(mycpv)
                        self._pkg_paths = pkg_paths
@@ -6567,6 +6577,14 @@ class binarytree(object):
                                        continue
                                mycat=self.remotepkgs[mypkg]["CATEGORY"].strip()
                                fullpkg=mycat+"/"+mypkg[:-5]
+                               if mycat not in categories:
+                                       writemsg(("!!! Remote binary package has an " + \
+                                               "unrecognized category: '%s'\n") % fullpkg,
+                                               noiselevel=-1)
+                                       writemsg(("!!! '%s' has a category that is not" + \
+                                               " listed in /etc/portage/categories\n") % fullpkg,
+                                               noiselevel=-1)
+                                       continue
                                mykey=dep_getkey(fullpkg)
                                try:
                                        # invalid tbz2's can hurt things.