From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Q3NZw-0003cO-Us for garchives@archives.gentoo.org; Sat, 26 Mar 2011 07:06:33 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E3AF31C009; Sat, 26 Mar 2011 07:06:24 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 8D5E01C009 for ; Sat, 26 Mar 2011 07:06:24 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D76381B410B for ; Sat, 26 Mar 2011 07:06:23 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 4623E8006A for ; Sat, 26 Mar 2011 07:06:23 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/AsynchronousTask.py pym/_emerge/Binpkg.py pym/_emerge/EbuildBuild.py pym/_emerge/MergeListItem.py pym/_emerge/PackageMerge.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: dc6a4c122e827baf28729caf2dbb32576072d88f Date: Sat, 26 Mar 2011 07:06:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: cb19329063940712c22e18639391448a commit: dc6a4c122e827baf28729caf2dbb32576072d88f Author: Zac Medico gentoo org> AuthorDate: Sat Mar 26 07:06:01 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Mar 26 07:06:01 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Ddc6a4c12 Reoranize PackageMerge/MergeListItem interaction. --- pym/_emerge/AsynchronousTask.py | 4 +++- pym/_emerge/Binpkg.py | 11 ++++------- pym/_emerge/EbuildBuild.py | 6 ++---- pym/_emerge/MergeListItem.py | 21 ++++++++------------- pym/_emerge/PackageMerge.py | 12 +++++------- 5 files changed, 22 insertions(+), 32 deletions(-) diff --git a/pym/_emerge/AsynchronousTask.py b/pym/_emerge/AsynchronousTa= sk.py index de00800..2b654ec 100644 --- a/pym/_emerge/AsynchronousTask.py +++ b/pym/_emerge/AsynchronousTask.py @@ -1,6 +1,7 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 +from portage import os from _emerge.SlotObject import SlotObject class AsynchronousTask(SlotObject): """ @@ -23,7 +24,8 @@ class AsynchronousTask(SlotObject): self._start() =20 def _start(self): - raise NotImplementedError(self) + self.returncode =3D os.EX_OK + self.wait() =20 def isAlive(self): return self.returncode is None diff --git a/pym/_emerge/Binpkg.py b/pym/_emerge/Binpkg.py index 62d44c4..bc6b85d 100644 --- a/pym/_emerge/Binpkg.py +++ b/pym/_emerge/Binpkg.py @@ -307,7 +307,7 @@ class Binpkg(CompositeTask): portage.elog.elog_process(self.pkg.cpv, self.settings) self._build_dir.unlock() =20 - def install(self, handler): + def create_install_task(self): =20 # This gives bashrc users an opportunity to do various things # such as remove binary packages after they're installed. @@ -322,16 +322,13 @@ class Binpkg(CompositeTask): settings=3Dsettings, tree=3Dself._tree, world_atom=3Dself.world_atom) task =3D merge.create_task() task.addExitListener(self._install_exit) - self._start_task(task, handler) + return task =20 def _install_exit(self, task): self.settings.pop("PORTAGE_BINPKG_FILE", None) self._unlock_builddir() - - if self._default_final_exit(task) !=3D os.EX_OK: - return - - if 'binpkg-logs' not in self.settings.features and \ + if task.returncode =3D=3D os.EX_OK and \ + 'binpkg-logs' not in self.settings.features and \ self.settings.get("PORTAGE_LOG_FILE"): try: os.unlink(self.settings["PORTAGE_LOG_FILE"]) diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py index c7a5f5c..1de8fbf 100644 --- a/pym/_emerge/EbuildBuild.py +++ b/pym/_emerge/EbuildBuild.py @@ -314,7 +314,7 @@ class EbuildBuild(CompositeTask): self._unlock_builddir() self.wait() =20 - def install(self, exit_handler): + def create_install_task(self): """ Install the package and then clean up and release locks. Only call this after the build has completed successfully @@ -345,9 +345,7 @@ class EbuildBuild(CompositeTask): =20 task =3D merge.create_task() task.addExitListener(self._install_exit) - self._start_task(task, exit_handler) + return task =20 def _install_exit(self, task): self._unlock_builddir() - self._default_final_exit(task) - diff --git a/pym/_emerge/MergeListItem.py b/pym/_emerge/MergeListItem.py index 5170de1..124db1a 100644 --- a/pym/_emerge/MergeListItem.py +++ b/pym/_emerge/MergeListItem.py @@ -4,6 +4,7 @@ from portage import os from portage.output import colorize =20 +from _emerge.AsynchronousTask import AsynchronousTask from _emerge.Binpkg import Binpkg from _emerge.CompositeTask import CompositeTask from _emerge.EbuildBuild import EbuildBuild @@ -111,15 +112,11 @@ class MergeListItem(CompositeTask): self._install_task.wait() return self.returncode =20 - def merge(self, exit_handler): + def create_install_task(self): =20 pkg =3D self.pkg build_opts =3D self.build_opts - find_blockers =3D self.find_blockers - logger =3D self.logger mtimedb =3D self.mtimedb - pkg_count =3D self.pkg_count - prefetcher =3D self.prefetcher scheduler =3D self.scheduler settings =3D self.settings world_atom =3D self.world_atom @@ -129,20 +126,18 @@ class MergeListItem(CompositeTask): if not (build_opts.buildpkgonly or \ build_opts.fetchonly or build_opts.pretend): =20 - uninstall =3D PackageUninstall(background=3Dself.background, + task =3D PackageUninstall(background=3Dself.background, ldpath_mtimes=3Dldpath_mtimes, opts=3Dself.emerge_opts, pkg=3Dpkg, scheduler=3Dscheduler, settings=3Dsettings, world_atom=3Dworld_atom) =20 - uninstall.start() - self.returncode =3D uninstall.wait() else: - self.returncode =3D os.EX_OK - exit_handler(self) + task =3D AsynchronousTask() + elif build_opts.fetchonly or \ build_opts.buildpkgonly: - exit_handler(self) + task =3D AsynchronousTask() else: - self._current_task =3D self._install_task - self._install_task.install(exit_handler) + task =3D self._install_task.create_install_task() =20 + return task diff --git a/pym/_emerge/PackageMerge.py b/pym/_emerge/PackageMerge.py index 832eac0..f8fa04a 100644 --- a/pym/_emerge/PackageMerge.py +++ b/pym/_emerge/PackageMerge.py @@ -1,13 +1,14 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 -from _emerge.AsynchronousTask import AsynchronousTask +from _emerge.CompositeTask import CompositeTask from portage.output import colorize -class PackageMerge(AsynchronousTask): +class PackageMerge(CompositeTask): __slots__ =3D ("merge",) =20 def _start(self): =20 + self.scheduler =3D self.merge.scheduler pkg =3D self.merge.pkg pkg_count =3D self.merge.pkg_count =20 @@ -35,8 +36,5 @@ class PackageMerge(AsynchronousTask): not self.merge.build_opts.buildpkgonly: self.merge.statusMessage(msg) =20 - self.merge.merge(self.exit_handler) - - def exit_handler(self, task): - self.returncode =3D task.returncode - self.wait() + task =3D self.merge.create_install_task() + self._start_task(task, self._default_final_exit)