From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 826D8138010 for ; Sun, 7 Oct 2012 17:00:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CFE5EE0330; Sun, 7 Oct 2012 16:59:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 45CDCE03E0 for ; Sun, 7 Oct 2012 16:59:58 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7D19733D74E for ; Sun, 7 Oct 2012 16:59:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 253A8E5436 for ; Sun, 7 Oct 2012 16:59:56 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1349629181.61262d1c27e372abb3dc9ba914b1640d2ba65a7f.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/Scheduler.py pym/_emerge/actions.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 61262d1c27e372abb3dc9ba914b1640d2ba65a7f X-VCS-Branch: master Date: Sun, 7 Oct 2012 16:59:56 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 10848667-041c-44a4-a731-7a9be7a8a538 X-Archives-Hash: 11fcaf0d65004257c095a3d61cab76c7 commit: 61262d1c27e372abb3dc9ba914b1640d2ba65a7f Author: Zac Medico gentoo org> AuthorDate: Sun Oct 7 16:59:41 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Oct 7 16:59:41 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=61262d1c action_uninstall: use PollScheduler not Scheduler The PollScheduler class suffices here, if we just add a small amount of logic to calculate the _background attribute from the emerge opts. --- pym/_emerge/Scheduler.py | 6 +----- pym/_emerge/actions.py | 29 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index 1814344..c5779cb 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -135,8 +135,7 @@ class Scheduler(PollScheduler): portage.exception.PortageException.__init__(self, value) def __init__(self, settings, trees, mtimedb, myopts, - spinner, mergelist=None, favorites=None, graph_config=None, - uninstall_only=False): + spinner, mergelist=None, favorites=None, graph_config=None): PollScheduler.__init__(self, main=True) if mergelist is not None: @@ -152,7 +151,6 @@ class Scheduler(PollScheduler): self._spinner = spinner self._mtimedb = mtimedb self._favorites = favorites - self._uninstall_only = uninstall_only self._args_set = InternalPackageSet(favorites, allow_repo=True) self._build_opts = self._build_opts_class() @@ -327,8 +325,6 @@ class Scheduler(PollScheduler): ignore_built_slot_operator_deps = self.myopts.get( "--ignore-built-slot-operator-deps", "n") == "y" for root in self.trees: - if self._uninstall_only: - continue if graph_config is None: fake_vartree = FakeVartree(self.trees[root]["root_config"], pkg_cache=self._pkg_cache, dynamic_deps=dynamic_deps, diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index c384dd4..2707d22 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -61,6 +61,7 @@ from _emerge.emergelog import emergelog from _emerge.is_valid_package_atom import is_valid_package_atom from _emerge.MetadataRegen import MetadataRegen from _emerge.Package import Package +from _emerge.PollScheduler import PollScheduler from _emerge.ProgressHandler import ProgressHandler from _emerge.RootConfig import RootConfig from _emerge.Scheduler import Scheduler @@ -2680,20 +2681,19 @@ def action_uninstall(settings, trees, ldpath_mtimes, if action == 'deselect': return action_deselect(settings, trees, opts, valid_atoms) - # Create a Scheduler for calls to unmerge(), in order to cause - # redirection of ebuild phase output to logs as required for - # options such as --quiet. - sched = Scheduler(settings, trees, None, opts, - spinner, uninstall_only=True) - sched._background = sched._background_mode() - sched._status_display.quiet = True + # Use the same logic as the Scheduler class to trigger redirection + # of ebuild pkg_prerm/postrm phase output to logs as appropriate + # for options such as --jobs, --quiet and --quiet-build. + sched = PollScheduler(main=True) + max_jobs = opts.get("--jobs", 1) + sched._background = (max_jobs is True or max_jobs > 1 or + "--quiet" in opts or opts.get("--quiet-build") == "y") if sched._background: - sched.settings.unlock() - sched.settings["PORTAGE_BACKGROUND"] = "1" - sched.settings.backup_changes("PORTAGE_BACKGROUND") - sched.settings.lock() - sched.pkgsettings[eroot] = portage.config(clone=sched.settings) + settings.unlock() + settings["PORTAGE_BACKGROUND"] = "1" + settings.backup_changes("PORTAGE_BACKGROUND") + settings.lock() if action in ('clean', 'unmerge') or \ (action == 'prune' and "--nodeps" in opts): @@ -2701,10 +2701,11 @@ def action_uninstall(settings, trees, ldpath_mtimes, ordered = action == 'unmerge' rval = unmerge(trees[settings['EROOT']]['root_config'], opts, action, valid_atoms, ldpath_mtimes, ordered=ordered, - scheduler=sched._sched_iface) + scheduler=sched.sched_iface) else: rval = action_depclean(settings, trees, ldpath_mtimes, - opts, action, valid_atoms, spinner, scheduler=sched._sched_iface) + opts, action, valid_atoms, spinner, + scheduler=sched.sched_iface) return rval