Add missing DepPriority instances to the graph so that the --buildpkgonly
authorZac Medico <zmedico@gentoo.org>
Fri, 4 Apr 2008 00:56:20 +0000 (00:56 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 4 Apr 2008 00:56:20 +0000 (00:56 -0000)
hasallzeros() calculation works correctly. (trunk r9695:9697)

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

bin/emerge

index e91882339b1bc91ac86464d7ec657a9e074994d8..6d698e744aa953dbe84266718c4635b65da65e1b 100755 (executable)
@@ -1788,7 +1788,7 @@ class depgraph:
                # parent/child relationship is always known in case
                # self._show_slot_collision_notice() needs to be called later.
                if pkg.onlydeps:
-                       self.digraph.add(pkg, myparent)
+                       self.digraph.add(pkg, myparent, priority=priority)
 
                merging = not (pkg.installed or pkg.onlydeps)
                myuse = pkg.metadata["USE"].split()
@@ -1841,32 +1841,23 @@ class depgraph:
                                # built packages do not have build time dependencies.
                                edepend["DEPEND"] = ""
 
-               """ We have retrieve the dependency information, now we need to recursively
-                   process them.  DEPEND gets processed for root = "/", {R,P}DEPEND in myroot. """
-               
-               mp = pkg
+               deps = (
+                       ("/", edepend["DEPEND"],
+                               DepPriority(buildtime=True, satisfied=bdeps_satisfied)),
+                       (myroot, edepend["RDEPEND"], DepPriority(runtime=True)),
+                       (myroot, edepend["PDEPEND"], DepPriority(runtime_post=True))
+               )
 
                try:
-                       if not self.select_dep("/", edepend["DEPEND"], myparent=mp,
-                               myuse=myuse, priority=DepPriority(buildtime=True,
-                               satisfied=bdeps_satisfied),
-                               parent_arg=arg):
-                               return 0
-                       """RDEPEND is soft by definition.  However, in order to ensure
-                       correct merge order, we make it a hard dependency.  Otherwise, a
-                       build time dependency might not be usable due to it's run time
-                       dependencies not being installed yet.
-                       """
-                       if not self.select_dep(myroot,edepend["RDEPEND"], myparent=mp,
-                               myuse=myuse, priority=DepPriority(runtime=True),
-                               parent_arg=arg):
-                               return 0
-                       if edepend.has_key("PDEPEND") and edepend["PDEPEND"]:
-                               # Post Depend -- Add to the list without a parent, as it depends
-                               # on a package being present AND must be built after that package.
-                               if not self.select_dep(myroot, edepend["PDEPEND"], myparent=mp,
-                                       myuse=myuse, priority=DepPriority(runtime_post=True),
-                                       parent_arg=arg):
+                       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 not self.select_dep(dep_root, dep_string, myparent=pkg,
+                                       myuse=myuse, priority=dep_priority, parent_arg=arg):
                                        return 0
                except ValueError, e:
                        pkgs = e.args[0]