When dep_expand throws a ValueError due to an ambiguous atom, try to expand the atom...
authorZac Medico <zmedico@gentoo.org>
Tue, 17 Jul 2007 05:00:31 +0000 (05:00 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 17 Jul 2007 05:00:31 +0000 (05:00 -0000)
svn path=/main/branches/2.1.2/; revision=7293

bin/emerge

index 5e9f1a801dfed49d845d5f9af70fbccb7d019955..29753fc3647c2d9295ae249558490cbc3fd90cd9 100755 (executable)
@@ -1496,6 +1496,7 @@ class depgraph:
                "given a list of .tbz2s, .ebuilds and deps, create the appropriate depgraph and return a favorite list"
                myfavorites=[]
                myroot = self.target_root
+               vardb = self.trees[myroot]["vartree"].dbapi
                portdb = self.trees[myroot]["porttree"].dbapi
                bindb = self.trees[myroot]["bintree"].dbapi
                pkgsettings = self.pkgsettings[myroot]
@@ -1575,13 +1576,19 @@ class depgraph:
                                        if "--usepkg" in self.myopts:
                                                mykey = portage.dep_expand(x, mydb=bindb,
                                                        settings=pkgsettings)
-                                       if (mykey and not mykey.startswith("null/")) or \
-                                               "--usepkgonly" in self.myopts:
+                                       if "--usepkgonly" in self.myopts or \
+                                               (mykey and not portage.dep_getkey(mykey).startswith("null/")):
                                                arg_atoms.append((x, mykey))
                                                continue
 
-                                       mykey = portage.dep_expand(x,
-                                               mydb=portdb, settings=pkgsettings)
+                                       try:
+                                               mykey = portage.dep_expand(x,
+                                                       mydb=portdb, settings=pkgsettings)
+                                       except ValueError:
+                                               mykey = portage.dep_expand(x,
+                                                       mydb=vardb, settings=pkgsettings)
+                                               if portage.dep_getkey(mykey).startswith("null/"):
+                                                       raise
                                        arg_atoms.append((x, mykey))
                                except ValueError, errpkgs:
                                        print "\n\n!!! The short ebuild name \"" + x + "\" is ambiguous.  Please specify"