Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH v3] EbuildBuild: call _record_binpkg_info earlier (bug 578204)
Date: Tue, 29 Mar 2016 16:45:17
Message-Id: 1459269897-13336-1-git-send-email-zmedico@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] EbuildBuild: call _record_binpkg_info earlier (bug 578204) by Zac Medico
1 Schedule _record_binpkg_info as a member of a TaskSequence, in
2 order to guarantee that it executes immediately after
3 EbuildBinpkg (and before the tasks that follow). This approach
4 is similar to 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 v3] Added docstring to _RecordBinpkgInfo as suggested by Alexander Berntsen.
10
11 pym/_emerge/EbuildBuild.py | 22 ++++++++++++++++++++--
12 1 file changed, 20 insertions(+), 2 deletions(-)
13
14 diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py
15 index 95c14e4..001f55f 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,19 @@ class EbuildBuild(CompositeTask):
42 self._final_exit(build)
43 self.wait()
44
45 + class _RecordBinpkgInfo(AsynchronousTask):
46 + """
47 + This class wraps the EbuildBuild _record_binpkg_info method
48 + with an AsynchronousTask interface, so that it can be
49 + scheduled as a member of a TaskSequence.
50 + """
51 +
52 + __slots__ = ('ebuild_binpkg', 'ebuild_build',)
53 +
54 + def _start(self):
55 + self.ebuild_build._record_binpkg_info(self.ebuild_binpkg)
56 + AsynchronousTask._start(self)
57 +
58 def _buildpkg_exit(self, packager):
59 """
60 Released build dir lock when there is a failure or
61 --
62 2.7.2

Replies