public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] EbuildBuild: call _record_binpkg_info earlier (bug 578204)
@ 2016-03-26 23:40 Zac Medico
  2016-03-27  0:13 ` [gentoo-portage-dev] [PATCH v2] " Zac Medico
  2016-03-29 16:44 ` [gentoo-portage-dev] [PATCH v3] " Zac Medico
  0 siblings, 2 replies; 5+ messages in thread
From: Zac Medico @ 2016-03-26 23:40 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

Replace exit listener usage with a TaskSequence instance,
in order to guarantee that _record_binpkg_info executes
immediately after EbuildBinpkg. This approach is similar to
that used to fix bug 562264.

X-Gentoo-bug: 578204
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=578204
---
 pym/_emerge/EbuildBuild.py | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py
index 95c14e4..2941511 100644
--- a/pym/_emerge/EbuildBuild.py
+++ b/pym/_emerge/EbuildBuild.py
@@ -6,6 +6,7 @@ from __future__ import unicode_literals
 import io
 
 import _emerge.emergelog
+from _emerge.AsynchronousTask import AsynchronousTask
 from _emerge.EbuildExecuter import EbuildExecuter
 from _emerge.EbuildPhase import EbuildPhase
 from _emerge.EbuildBinpkg import EbuildBinpkg
@@ -320,13 +321,18 @@ class EbuildBuild(CompositeTask):
 						phase="rpm", scheduler=self.scheduler,
 						settings=self.settings))
 				else:
+					# Use task_seq to guarantee that _RecordBinpkgInfo
+					# is called immediately after EbuildBinpkg, in order
+					# to solve bug #578204.
+					task_seq = TaskSequence()
 					task = EbuildBinpkg(
 						background=self.background,
 						pkg=self.pkg, scheduler=self.scheduler,
 						settings=self.settings)
-					binpkg_tasks.add(task)
-					task.addExitListener(
-						self._record_binpkg_info)
+					task_seq.add(task)
+					task_seq.add(self._RecordBinpkgInfo(
+						ebuild_binpkg=task, ebuild_build=self))
+					binpkg_tasks.add(task_seq)
 
 		if binpkg_tasks:
 			self._start_task(binpkg_tasks, self._buildpkg_exit)
@@ -335,6 +341,14 @@ class EbuildBuild(CompositeTask):
 		self._final_exit(build)
 		self.wait()
 
+	class _RecordBinpkgInfo(AsynchronousTask):
+
+		__slots__ = ('ebuild_binpkg', 'ebuild_build',)
+
+		def _start(self):
+			self.ebuild_build._record_binpkg_info(self.ebuild_binpkg)
+			AsynchronousTask._start(self)
+
 	def _buildpkg_exit(self, packager):
 		"""
 		Released build dir lock when there is a failure or
-- 
2.7.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-portage-dev] [PATCH v2] EbuildBuild: call _record_binpkg_info earlier (bug 578204)
  2016-03-26 23:40 [gentoo-portage-dev] [PATCH] EbuildBuild: call _record_binpkg_info earlier (bug 578204) Zac Medico
@ 2016-03-27  0:13 ` Zac Medico
  2016-03-29 10:21   ` Alexander Berntsen
  2016-03-29 16:44 ` [gentoo-portage-dev] [PATCH v3] " Zac Medico
  1 sibling, 1 reply; 5+ messages in thread
From: Zac Medico @ 2016-03-27  0:13 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

Replace exit listener usage with a TaskSequence instance,
in order to guarantee that _record_binpkg_info executes
immediately after EbuildBinpkg. This approach is similar to
that used to fix bug 562264.

X-Gentoo-bug: 578204
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=578204
---
[PATCH v2] Eliminated nested TaskSequence instance.

 pym/_emerge/EbuildBuild.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py
index 95c14e4..ac786b0 100644
--- a/pym/_emerge/EbuildBuild.py
+++ b/pym/_emerge/EbuildBuild.py
@@ -6,6 +6,7 @@ from __future__ import unicode_literals
 import io
 
 import _emerge.emergelog
+from _emerge.AsynchronousTask import AsynchronousTask
 from _emerge.EbuildExecuter import EbuildExecuter
 from _emerge.EbuildPhase import EbuildPhase
 from _emerge.EbuildBinpkg import EbuildBinpkg
@@ -325,8 +326,12 @@ class EbuildBuild(CompositeTask):
 						pkg=self.pkg, scheduler=self.scheduler,
 						settings=self.settings)
 					binpkg_tasks.add(task)
-					task.addExitListener(
-						self._record_binpkg_info)
+					# Guarantee that _record_binpkg_info is called
+					# immediately after EbuildBinpkg. Note that
+					# task.addExitListener does not provide the
+					# necessary guarantee (see bug 578204).
+					binpkg_tasks.add(self._RecordBinpkgInfo(
+						ebuild_binpkg=task, ebuild_build=self))
 
 		if binpkg_tasks:
 			self._start_task(binpkg_tasks, self._buildpkg_exit)
@@ -335,6 +340,14 @@ class EbuildBuild(CompositeTask):
 		self._final_exit(build)
 		self.wait()
 
+	class _RecordBinpkgInfo(AsynchronousTask):
+
+		__slots__ = ('ebuild_binpkg', 'ebuild_build',)
+
+		def _start(self):
+			self.ebuild_build._record_binpkg_info(self.ebuild_binpkg)
+			AsynchronousTask._start(self)
+
 	def _buildpkg_exit(self, packager):
 		"""
 		Released build dir lock when there is a failure or
-- 
2.7.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [gentoo-portage-dev] [PATCH v2] EbuildBuild: call _record_binpkg_info earlier (bug 578204)
  2016-03-27  0:13 ` [gentoo-portage-dev] [PATCH v2] " Zac Medico
@ 2016-03-29 10:21   ` Alexander Berntsen
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Berntsen @ 2016-03-29 10:21 UTC (permalink / raw
  To: gentoo-portage-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 27/03/16 01:13, Zac Medico wrote:
> +	class _RecordBinpkgInfo(AsynchronousTask):
> +
> +		__slots__ = ('ebuild_binpkg', 'ebuild_build',)
> +
> +		def _start(self):
> +			self.ebuild_build._record_binpkg_info(self.ebuild_binpkg)
> +			AsynchronousTask._start(self)
> +
Maybe docstrings are warranted? Looks OK otherwise.

- -- 
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCgAGBQJW+lcbAAoJENQqWdRUGk8BBpIP/1DiTHK8ujnK01yOKvpp+VfU
d/WCNQ7KC/QfQvbZ/jvDybvJE+o5pEOP37+hNY61lGle2kiTrSv7JBtM7Az2VohG
agU/4HSFp3TnyyuaQqWrb45qWlCjkIyf8OJNr8wVzmLH6L2BXwhTIiPSt41ix+SL
2JNqtB82dh4Uq/6Bzc8C8GwPZm0XbqWc2rhS2K6JBWaJhOTDfW/HhldBHO1z6sMJ
H/XgvWAZAfjhsdYGQhrYKHo+kdi8V4Je+/GFPsd/v0nPvEP6ZmW3KtAdBCbJPnIQ
xOLgMp3pOWzNoP9ILn95XDydoSWNyPkUJ4VLxK+MTkwEoNJ4pJH7bz6XBWgtrzrF
cXxDCTYrl2qnQq4GpwqMlJwIloYxT2px9EYoYUQPk/b+iktIazWesOcJypiS8m/S
SUL6zLqjQ93+FqF4jfKni0z6j9x1WzsEFJVVetScrPUOmz4ZpUXY6w/kEjF6KrHs
7vU8ujev7nO1HZMKYGjG67l4l3oRUtwRK8dZNfnjBum0IaCZKpESCnO8d4IP7TUN
Kkm4//UCZZ5K75WvycHv5cz2eb7qToeN7hGu/P2Swm4La04mnyv+0MDrY3Cm9xol
M4eCBKvUiDO+xjKMoeM+sSd4eMSncPr4E3F87L6RFpgf6Z9J64OUGCaktCShvZFm
f03DozRC/JUG0WfxqRpo
=9je0
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-portage-dev] [PATCH v3] EbuildBuild: call _record_binpkg_info earlier (bug 578204)
  2016-03-26 23:40 [gentoo-portage-dev] [PATCH] EbuildBuild: call _record_binpkg_info earlier (bug 578204) Zac Medico
  2016-03-27  0:13 ` [gentoo-portage-dev] [PATCH v2] " Zac Medico
@ 2016-03-29 16:44 ` Zac Medico
  2016-03-30  6:35   ` Alexander Berntsen
  1 sibling, 1 reply; 5+ messages in thread
From: Zac Medico @ 2016-03-29 16:44 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

Schedule _record_binpkg_info as a member of a TaskSequence, in
order to guarantee that it executes immediately after
EbuildBinpkg (and before the tasks that follow). This approach
is similar to that used to fix bug 562264.

X-Gentoo-bug: 578204
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=578204
---
[PATCH v3] Added docstring to _RecordBinpkgInfo as suggested by Alexander Berntsen.

 pym/_emerge/EbuildBuild.py | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py
index 95c14e4..001f55f 100644
--- a/pym/_emerge/EbuildBuild.py
+++ b/pym/_emerge/EbuildBuild.py
@@ -6,6 +6,7 @@ from __future__ import unicode_literals
 import io
 
 import _emerge.emergelog
+from _emerge.AsynchronousTask import AsynchronousTask
 from _emerge.EbuildExecuter import EbuildExecuter
 from _emerge.EbuildPhase import EbuildPhase
 from _emerge.EbuildBinpkg import EbuildBinpkg
@@ -325,8 +326,12 @@ class EbuildBuild(CompositeTask):
 						pkg=self.pkg, scheduler=self.scheduler,
 						settings=self.settings)
 					binpkg_tasks.add(task)
-					task.addExitListener(
-						self._record_binpkg_info)
+					# Guarantee that _record_binpkg_info is called
+					# immediately after EbuildBinpkg. Note that
+					# task.addExitListener does not provide the
+					# necessary guarantee (see bug 578204).
+					binpkg_tasks.add(self._RecordBinpkgInfo(
+						ebuild_binpkg=task, ebuild_build=self))
 
 		if binpkg_tasks:
 			self._start_task(binpkg_tasks, self._buildpkg_exit)
@@ -335,6 +340,19 @@ class EbuildBuild(CompositeTask):
 		self._final_exit(build)
 		self.wait()
 
+	class _RecordBinpkgInfo(AsynchronousTask):
+		"""
+		This class wraps the EbuildBuild _record_binpkg_info method
+		with an AsynchronousTask interface, so that it can be
+		scheduled as a member of a TaskSequence.
+		"""
+
+		__slots__ = ('ebuild_binpkg', 'ebuild_build',)
+
+		def _start(self):
+			self.ebuild_build._record_binpkg_info(self.ebuild_binpkg)
+			AsynchronousTask._start(self)
+
 	def _buildpkg_exit(self, packager):
 		"""
 		Released build dir lock when there is a failure or
-- 
2.7.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [gentoo-portage-dev] [PATCH v3] EbuildBuild: call _record_binpkg_info earlier (bug 578204)
  2016-03-29 16:44 ` [gentoo-portage-dev] [PATCH v3] " Zac Medico
@ 2016-03-30  6:35   ` Alexander Berntsen
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Berntsen @ 2016-03-30  6:35 UTC (permalink / raw
  To: gentoo-portage-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Thanks. LGTM.

- -- 
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCgAGBQJW+3OvAAoJENQqWdRUGk8BM+wQAK1YIiKaS4itrZnJHAapQiCU
t/01WXKQtBH8OsvIJujivaxE3kC6/F3d+5WhlNZPaNN6QLUbf9vId4fl0+pi5aqq
GsVuKdSZynqXSCDkepvDeaYVjal2nrYYvaFXmKYIGMC4Z606f+iyceV8llOO+iaz
lllRpu50UoDnrpNHtA/AVM6jk2qdwPN1pAatZZUyaAcn6kMECf9Oo9BJyd0OrLnw
F/Wi6WKK6tZ12b4fpD+XsLZ7rgJZS1xdwCjqSYm3P0XBeqM4Ltz8xNjBJnzGxVb3
bX6iV/6MytrwIB7F5eTcr3fSLWhLgTdwr+AZtJhJfT//F3mn4dT1XkmTUV8ecc32
rBpq40R6sKUgvF0hfDCe50ejwdiWiJLm516VI27e94NDR+OetmdoOZU2ScbyoLwZ
AOt+uH23RFwZzj6VRZuK6OZC3kwcYLQvc61liHlou+RQ+AGra+EhPSBB7dsggUZG
O+iIAeriOGKRBDeUmBTbCaOuFebxv0HHjUBT3MvwTo4Dkwx8Z3cYhxjE+0Odgbs0
INLhA2p6O+TAwaYRIU0RZzDOA/znukmsnfn6INwNqIq0XRGNW+ocGf5kpjTm4J+M
k3C5jnBa9euO/JC5ZLjjtsfag/OW3FFIze8d/R7l+Ou7ScyQ4GRW9fGbj3RbauBJ
xuP6UbIUwOq3YbiZmQl/
=vm2N
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-03-30  6:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-26 23:40 [gentoo-portage-dev] [PATCH] EbuildBuild: call _record_binpkg_info earlier (bug 578204) Zac Medico
2016-03-27  0:13 ` [gentoo-portage-dev] [PATCH v2] " Zac Medico
2016-03-29 10:21   ` Alexander Berntsen
2016-03-29 16:44 ` [gentoo-portage-dev] [PATCH v3] " Zac Medico
2016-03-30  6:35   ` Alexander Berntsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox