public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Zac Medico <zmedico@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH v3] EbuildBuild: call _record_binpkg_info earlier (bug 578204)
Date: Tue, 29 Mar 2016 09:44:57 -0700	[thread overview]
Message-ID: <1459269897-13336-1-git-send-email-zmedico@gentoo.org> (raw)
In-Reply-To: <1459035602-5898-1-git-send-email-zmedico@gentoo.org>

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



  parent reply	other threads:[~2016-03-29 16:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Zac Medico [this message]
2016-03-30  6:35   ` [gentoo-portage-dev] [PATCH v3] " Alexander Berntsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459269897-13336-1-git-send-email-zmedico@gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox