Fix old broken binary package visibility filtering code inside
authorZac Medico <zmedico@gentoo.org>
Fri, 8 Feb 2008 11:15:30 +0000 (11:15 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 8 Feb 2008 11:15:30 +0000 (11:15 -0000)
depgraph.select_files() and xcreate().

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

bin/emerge

index 455079853ea700bf9a2918166c82f1da23457c05..2c538e9a7cdefc708fc1cf90d4ab16039095a6da 100755 (executable)
@@ -1791,12 +1791,9 @@ class depgraph:
                vardb = self.trees[myroot]["vartree"].dbapi
                portdb = self.trees[myroot]["porttree"].dbapi
                bindb = self.trees[myroot]["bintree"].dbapi
+               bindb_keys = list(bindb._aux_cache_keys)
                pkgsettings = self.pkgsettings[myroot]
                arg_atoms = []
-               def visible(mylist):
-                       matches = portdb.gvisible(portdb.visible(mylist))
-                       return [x for x in mylist \
-                               if x in matches or not portdb.cpv_exists(x)]
                for x in myfiles:
                        ext = os.path.splitext(x)[1]
                        if ext==".tbz2":
@@ -1911,10 +1908,13 @@ class depgraph:
                                if myslots:
                                        best_pkgs = []
                                        if "--usepkg" in self.myopts:
-                                               mymatches = bindb.match(myatom)
-                                               if "--usepkgonly" not in self.myopts:
-                                                       mymatches = visible(mymatches)
-                                               best_pkg = portage.best(mymatches)
+                                               best_pkg = None
+                                               for cpv in reversed(bindb.match(myatom)):
+                                                       metadata = dict(izip(bindb_keys,
+                                                               bindb.aux_get(cpv, bindb_keys)))
+                                                       if visible(pkgsettings, cpv, metadata, built=True):
+                                                               best_pkg = cpv
+                                                               break
                                                if best_pkg:
                                                        best_slot = bindb.aux_get(best_pkg, ["SLOT"])[0]
                                                        best_pkgs.append(("binary", best_pkg, best_slot))
@@ -1938,11 +1938,12 @@ class depgraph:
                                                        "porttree"].dbapi.match(myslot_atom):
                                                        available = True
                                                elif "--usepkg" in self.myopts:
-                                                       mymatches = bindb.match(myslot_atom)
-                                                       if "--usepkgonly" not in self.myopts:
-                                                               mymatches = visible(mymatches)
-                                                       if mymatches:
-                                                               available = True
+                                                       for cpv in bindb.match(myslot_atom):
+                                                               metadata = dict(izip(bindb_keys,
+                                                                       bindb.aux_get(cpv, bindb_keys)))
+                                                               if visible(pkgsettings, cpv, metadata, built=True):
+                                                                       available = True
+                                                                       break
                                                if available:
                                                        greedy_atoms.append((myarg, myslot_atom))
                        arg_atoms = greedy_atoms
@@ -2912,10 +2913,7 @@ class depgraph:
                vardb = self.trees[self.target_root]["vartree"].dbapi
                portdb = self.trees[self.target_root]["porttree"].dbapi
                bindb = self.trees[self.target_root]["bintree"].dbapi
-               def visible(mylist):
-                       matches = portdb.gvisible(portdb.visible(mylist))
-                       return [x for x in mylist \
-                               if x in matches or not portdb.cpv_exists(x)]
+               bindb_keys = list(bindb._aux_cache_keys)
                world_problems = False
 
                root_config = self.roots[self.target_root]
@@ -2936,11 +2934,12 @@ class depgraph:
                                                portdb.match(x):
                                                available = True
                                        elif "--usepkg" in self.myopts:
-                                               mymatches = bindb.match(x)
-                                               if "--usepkgonly" not in self.myopts:
-                                                       mymatches = visible(mymatches)
-                                               if mymatches:
-                                                       available = True
+                                               for cpv in bindb.match(x):
+                                                       metadata = dict(izip(bindb_keys,
+                                                               bindb.aux_get(cpv, bindb_keys)))
+                                                       if visible(pkgsettings, cpv, metadata, built=True):
+                                                               available = True
+                                                               break
                                        if not available:
                                                continue
                                mylist.append(x)