summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-07-05 08:52:46 +0000
committerZac Medico <zmedico@gentoo.org>2008-07-05 08:52:46 +0000
commit6cc47b222385dc6cfce066f9c94c4fd6ecbe1c65 (patch)
treeed2617b50233788f639d8f18883be659b936963d
parentaa013d9bd12e3602829309006b271c301982bbbb (diff)
downloadportage-6cc47b222385dc6cfce066f9c94c4fd6ecbe1c65.tar.gz
portage-6cc47b222385dc6cfce066f9c94c4fd6ecbe1c65.tar.bz2
portage-6cc47b222385dc6cfce066f9c94c4fd6ecbe1c65.zip
Add async support to EbuildBinpkg by making it inherit from EbuildPhase.
svn path=/main/trunk/; revision=10939
-rw-r--r--pym/_emerge/__init__.py47
1 files changed, 21 insertions, 26 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index b5169ceff..71df47dd5 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -1805,8 +1805,13 @@ class EbuildBuild(EbuildBuildDir):
if retval != os.EX_OK:
return retval
- build = EbuildBinpkg(pkg=pkg, settings=settings)
- retval = build.execute()
+ build = EbuildBinpkg(pkg=pkg,
+ scheduler=scheduler, settings=settings)
+
+ build.start()
+ scheduler.schedule(build.reg_id)
+ retval = build.wait()
+
if retval != os.EX_OK:
return retval
@@ -2082,19 +2087,15 @@ class EbuildPhase(SubProcess):
if returncode == os.EX_OK:
returncode = portage._post_src_install_checks(settings)
-class EbuildBinpkg(Task):
+class EbuildBinpkg(EbuildPhase):
"""
This assumes that src_install() has successfully completed.
"""
- __slots__ = ("pkg", "settings")
+ __slots__ = ("_binpkg_tmpfile",)
- def _get_hash_key(self):
- hash_key = getattr(self, "_hash_key", None)
- if hash_key is None:
- self._hash_key = ("EbuildBinpkg", self.pkg._get_hash_key())
- return self._hash_key
-
- def execute(self):
+ def start(self):
+ self.phase = "package"
+ self.tree = "porttree"
pkg = self.pkg
root_config = pkg.root_config
portdb = root_config.trees["porttree"].dbapi
@@ -2106,29 +2107,23 @@ class EbuildBinpkg(Task):
bintree.prevent_collision(pkg.cpv)
binpkg_tmpfile = os.path.join(bintree.pkgdir,
pkg.cpv + ".tbz2." + str(os.getpid()))
+ self._binpkg_tmpfile = binpkg_tmpfile
settings["PORTAGE_BINPKG_TMPFILE"] = binpkg_tmpfile
settings.backup_changes("PORTAGE_BINPKG_TMPFILE")
- # Earlier phases should already be done, so
- # use "noauto" to quietly skip them.
- settings.features.append("noauto")
-
try:
- retval = portage.doebuild(ebuild_path,
- "package", root_config.root,
- settings, debug, mydbapi=portdb,
- tree="porttree")
+ EbuildPhase.start(self)
finally:
settings.pop("PORTAGE_BINPKG_TMPFILE", None)
- try:
- settings.features.remove("noauto")
- except ValueError:
- pass
- if retval == os.EX_OK:
- bintree.inject(pkg.cpv, filename=binpkg_tmpfile)
+ def _set_returncode(self, wait_retval):
+ EbuildPhase._set_returncode(self, wait_retval)
- return retval
+ pkg = self.pkg
+ bintree = pkg.root_config.trees["bintree"]
+ binpkg_tmpfile = self._binpkg_tmpfile
+ if self.returncode == os.EX_OK:
+ bintree.inject(pkg.cpv, filename=binpkg_tmpfile)
class EbuildMerge(SlotObject):