* Fix --keep-going breakage that occured when Scheduler._choose_pkg() was
authorZac Medico <zmedico@gentoo.org>
Tue, 15 Jul 2008 08:28:16 +0000 (08:28 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 15 Jul 2008 08:28:16 +0000 (08:28 -0000)
  introduced.

* Handle multiple failed builds when buildinding in parallel.

* Fix Scheduler._do_merge_exit() to remove the correct package since it's
  not always at position 0 when using --jobs.

in parallel, so

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

pym/_emerge/__init__.py

index 45c958aedb89782938f3a3335157734f385e5d2d..7fd2c27640b5012f2f118278ad98f51d062a4a0f 100644 (file)
@@ -8792,6 +8792,7 @@ class Scheduler(PollScheduler):
 
                keep_going = "--keep-going" in self.myopts
                mtimedb = self._mtimedb
+               failed_pkgs = self._failed_pkgs
 
                while True:
                        rval = self._merge()
@@ -8805,19 +8806,15 @@ class Scheduler(PollScheduler):
                        mergelist = self._mtimedb["resume"].get("mergelist")
                        if not mergelist:
                                break
-                       if mergelist[0][-1] != "merge":
-                               break
 
-                       # Skip the first one because it failed to build or install.
-                       pkg_key = tuple(mergelist[0])
-                       del mergelist[0]
-                       failed_pkg = None
-                       for task in self._mergelist:
-                               if task == pkg_key:
-                                       failed_pkg = task
-                                       break
-                       if failed_pkg is None:
+                       if not failed_pkgs:
                                break
+
+                       for failed_pkg, returncode in failed_pkgs:
+                               mergelist.remove(list(failed_pkg))
+
+                       del failed_pkgs[:]
+
                        if not mergelist:
                                break
 
@@ -8887,7 +8884,7 @@ class Scheduler(PollScheduler):
                # --resume still works after being interrupted
                # by reboot, sigkill or similar.
                mtimedb = self._mtimedb
-               del mtimedb["resume"]["mergelist"][0]
+               mtimedb["resume"]["mergelist"].remove(list(pkg))
                if not mtimedb["resume"]["mergelist"]:
                        del mtimedb["resume"]
                mtimedb.commit()
@@ -8924,8 +8921,6 @@ class Scheduler(PollScheduler):
                        if failed_pkgs:
                                pkg, rval = failed_pkgs[-1]
 
-                       del failed_pkgs[:]
-
                return rval
 
        def _main_loop_cleanup(self):
@@ -11351,9 +11346,8 @@ def resume_depgraph(settings, trees, mtimedb, myopts, myparams, spinner,
                        # will be infinite. Therefore, if that case ever
                        # occurs for some reason, raise the exception to
                        # break out of the loop.
-                       if not pruned_mergelist or \
-                               len(pruned_mergelist) == len(mergelist):
-                               raise
+                       if len(pruned_mergelist) == len(mergelist):
+                               raise AssertionError("tight loop")
                        mergelist[:] = pruned_mergelist
                        dropped_tasks.update(unsatisfied_parents)
                        del e, graph, traversed_nodes, \