For the --buildpkgonly digraph.hasallzeros() check, remove "nomerge" nodes
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 05:08:53 +0000 (05:08 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 05:08:53 +0000 (05:08 -0000)
from the graph. This makes it unnecessary to tweak the dependency priority
for onlydeps packages inside depgraph._add_pkg_dep(). (trunk r12610)

svn path=/main/branches/2.1.6/; revision=12888

pym/_emerge/__init__.py

index 4109322f94bb4ef5e064a8908f3d92af4eb894dd..0d94025bd07deb7b8533a147c6257dfb5793d6a2 100644 (file)
@@ -5088,10 +5088,6 @@ class depgraph(object):
                strict = mytype != "installed"
                try:
                        for dep_root, dep_string, dep_priority in deps:
-                               if pkg.onlydeps:
-                                       # Decrease priority so that --buildpkgonly
-                                       # hasallzeros() works correctly.
-                                       dep_priority = DepPriority()
                                if not dep_string:
                                        continue
                                if debug:
@@ -13891,9 +13887,12 @@ def action_build(settings, trees, mtimedb,
                                return retval
                        if "--buildpkgonly" in myopts:
                                graph_copy = mydepgraph.digraph.clone()
+                               removed_nodes = set()
                                for node in list(graph_copy.order):
-                                       if not isinstance(node, Package):
-                                               graph_copy.remove(node)
+                                       if not isinstance(node, Package) or \
+                                               node.operation == "nomerge":
+                                               removed_nodes.add(node)
+                               graph_copy.difference_update(removed_nodes)
                                if not graph_copy.hasallzeros(ignore_priority=DepPriority.MEDIUM):
                                        print "\n!!! --buildpkgonly requires all dependencies to be merged."
                                        print "!!! You have to merge the dependencies before you can build this package.\n"
@@ -13901,9 +13900,12 @@ def action_build(settings, trees, mtimedb,
        else:
                if "--buildpkgonly" in myopts:
                        graph_copy = mydepgraph.digraph.clone()
+                       removed_nodes = set()
                        for node in list(graph_copy.order):
-                               if not isinstance(node, Package):
-                                       graph_copy.remove(node)
+                               if not isinstance(node, Package) or \
+                                       node.operation == "nomerge":
+                                       removed_nodes.add(node)
+                       graph_copy.difference_update(removed_nodes)
                        if not graph_copy.hasallzeros(ignore_priority=DepPriority.MEDIUM):
                                print "\n!!! --buildpkgonly requires all dependencies to be merged."
                                print "!!! Cannot merge requested packages. Merge deps and try again.\n"