From 00da064f0810372a440095e1af07d805cb8db4e3 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 16 Jul 2008 00:44:58 +0000 Subject: [PATCH] Redirect dblink.unmerge() output to the log file when --jobs > 1. svn path=/main/trunk/; revision=11065 --- pym/_emerge/__init__.py | 13 ++++++++++++- pym/portage/dbapi/vartree.py | 12 ++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 8e5c64eca..9046dd265 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -8320,7 +8320,7 @@ class Scheduler(PollScheduler): _fetch_log = "/var/log/emerge-fetch.log" class _iface_class(SlotObject): - __slots__ = ("dblinkEbuildPhase", "fetch", + __slots__ = ("dblinkEbuildPhase", "dblinkDisplayUnmerge", "fetch", "register", "schedule", "unregister") class _fetch_iface_class(SlotObject): @@ -8385,6 +8385,7 @@ class Scheduler(PollScheduler): schedule=self._schedule_fetch) self._sched_iface = self._iface_class( dblinkEbuildPhase=self._dblink_ebuild_phase, + dblinkDisplayUnmerge=self._dblink_display_unmerge, fetch=fetch_iface, register=self._register, schedule=self._schedule_wait, unregister=self._unregister) @@ -8574,6 +8575,16 @@ class Scheduler(PollScheduler): finally: f.close() + def _dblink_display_unmerge(self, settings, msg, noiselevel=0): + log_path = settings.get("PORTAGE_LOG_FILE") + background = self._max_jobs > 1 + if log_path is None: + portage.writemsg_stdout(msg, noiselevel=noiselevel) + else: + if not background: + portage.writemsg_stdout(msg, noiselevel=noiselevel) + self._append_to_log_path(log_path, msg) + def _dblink_ebuild_phase(self, pkg_dblink, pkg_dbapi, ebuild_path, phase): """ diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index c189dce21..8eb640007 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1751,8 +1751,16 @@ class dblink(object): @rtype: None """ + if self._scheduler is None: + def showMessage(msg, noiselevel=0): + writemsg_stdout(msg, noiselevel=noiselevel) + else: + def showMessage(msg, noiselevel=0): + self._scheduler.dblinkDisplayUnmerge( + self.settings, msg, noiselevel=noiselevel) + if not pkgfiles: - writemsg_stdout("No package files given... Grabbing a set.\n") + showMessage("No package files given... Grabbing a set.\n") pkgfiles = self.getcontents() if others_in_slot is None: @@ -1816,7 +1824,7 @@ class dblink(object): bsd_chflags.chflags(parent_name, pflags) def show_unmerge(zing, desc, file_type, file_name): - writemsg_stdout("%s %s %s %s\n" % \ + showMessage("%s %s %s %s\n" % \ (zing, desc.ljust(8), file_type, file_name)) for objkey in mykeys: obj = normalize_path(objkey) -- 2.26.2