1 |
Replace exit listener usage with a TaskSequence instance, |
2 |
in order to guarantee that _record_binpkg_info executes |
3 |
immediately after EbuildBinpkg. This approach is similar to |
4 |
that used to fix bug 562264. |
5 |
|
6 |
X-Gentoo-bug: 578204 |
7 |
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=578204 |
8 |
--- |
9 |
[PATCH v2] Eliminated nested TaskSequence instance. |
10 |
|
11 |
pym/_emerge/EbuildBuild.py | 17 +++++++++++++++-- |
12 |
1 file changed, 15 insertions(+), 2 deletions(-) |
13 |
|
14 |
diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py |
15 |
index 95c14e4..ac786b0 100644 |
16 |
--- a/pym/_emerge/EbuildBuild.py |
17 |
+++ b/pym/_emerge/EbuildBuild.py |
18 |
@@ -6,6 +6,7 @@ from __future__ import unicode_literals |
19 |
import io |
20 |
|
21 |
import _emerge.emergelog |
22 |
+from _emerge.AsynchronousTask import AsynchronousTask |
23 |
from _emerge.EbuildExecuter import EbuildExecuter |
24 |
from _emerge.EbuildPhase import EbuildPhase |
25 |
from _emerge.EbuildBinpkg import EbuildBinpkg |
26 |
@@ -325,8 +326,12 @@ class EbuildBuild(CompositeTask): |
27 |
pkg=self.pkg, scheduler=self.scheduler, |
28 |
settings=self.settings) |
29 |
binpkg_tasks.add(task) |
30 |
- task.addExitListener( |
31 |
- self._record_binpkg_info) |
32 |
+ # Guarantee that _record_binpkg_info is called |
33 |
+ # immediately after EbuildBinpkg. Note that |
34 |
+ # task.addExitListener does not provide the |
35 |
+ # necessary guarantee (see bug 578204). |
36 |
+ binpkg_tasks.add(self._RecordBinpkgInfo( |
37 |
+ ebuild_binpkg=task, ebuild_build=self)) |
38 |
|
39 |
if binpkg_tasks: |
40 |
self._start_task(binpkg_tasks, self._buildpkg_exit) |
41 |
@@ -335,6 +340,14 @@ class EbuildBuild(CompositeTask): |
42 |
self._final_exit(build) |
43 |
self.wait() |
44 |
|
45 |
+ class _RecordBinpkgInfo(AsynchronousTask): |
46 |
+ |
47 |
+ __slots__ = ('ebuild_binpkg', 'ebuild_build',) |
48 |
+ |
49 |
+ def _start(self): |
50 |
+ self.ebuild_build._record_binpkg_info(self.ebuild_binpkg) |
51 |
+ AsynchronousTask._start(self) |
52 |
+ |
53 |
def _buildpkg_exit(self, packager): |
54 |
""" |
55 |
Released build dir lock when there is a failure or |
56 |
-- |
57 |
2.7.2 |