For the --buildpkgonly digraph.hasallzeros() check, remove "nomerge" nodes
authorZac Medico <zmedico@gentoo.org>
Sat, 14 Feb 2009 19:52:59 +0000 (19:52 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 14 Feb 2009 19:52:59 +0000 (19:52 -0000)
from the graph. This makes it unnecessary to tweak the dependency priority
for onlydeps packages inside depgraph._add_pkg_dep().

svn path=/main/trunk/; revision=12610

pym/_emerge/__init__.py

index c02d99e6c8bec49aac5f73b34ee3b2c85ba23f22..0ad8c1b02b57c25e317cd6e0b1b66aeb455b7882 100644 (file)
@@ -5104,10 +5104,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:
@@ -14245,9 +14241,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"
@@ -14255,9 +14254,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"