From 731b3a807b3f69b6b8783459f8fb00dd2a8a179b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 5 Dec 2009 22:00:19 +0000 Subject: [PATCH] =?utf8?q?Always=20append=20QA=20Notices=20resulting=20fro?= =?utf8?q?m=20the=20build=20log=20search=20to=20the=20end=20of=20the=20log?= =?utf8?q?.=20Thanks=20to=20Diego=20E.=20Petten=C3=B2=20for=20reporting.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit svn path=/main/trunk/; revision=14927 --- pym/_emerge/EbuildPhase.py | 15 +++++++++++---- pym/portage/__init__.py | 27 ++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py index fcf60d39c..01661b2cc 100644 --- a/pym/_emerge/EbuildPhase.py +++ b/pym/_emerge/EbuildPhase.py @@ -5,10 +5,11 @@ from _emerge.MiscFunctionsProcess import MiscFunctionsProcess from _emerge.EbuildProcess import EbuildProcess from _emerge.CompositeTask import CompositeTask -from portage.util import writemsg +from portage.util import writemsg, writemsg_stdout import portage from portage import os from portage import _encodings +from portage import _unicode_decode from portage import _unicode_encode import codecs @@ -30,16 +31,22 @@ class EbuildPhase(CompositeTask): def _ebuild_exit(self, ebuild_process): if self.phase == "install": - out = None + out = portage.StringIO() log_path = self.settings.get("PORTAGE_LOG_FILE") log_file = None - if self.background and log_path is not None: + if log_path is not None: log_file = codecs.open(_unicode_encode(log_path, encoding=_encodings['fs'], errors='strict'), mode='a', encoding=_encodings['content'], errors='replace') - out = log_file try: portage._check_build_log(self.settings, out=out) + msg = _unicode_decode(out.getvalue(), + encoding=_encodings['content'], errors='replace') + if msg: + if not self.background: + writemsg_stdout(msg, noiselevel=-1) + if log_file is not None: + log_file.write(msg) finally: if log_file is not None: log_file.close() diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 90be7ae45..dde0aeadb 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -33,6 +33,15 @@ try: from subprocess import getstatusoutput as subprocess_getstatusoutput except ImportError: from commands import getstatusoutput as subprocess_getstatusoutput + + try: + from io import StringIO + except ImportError: + # Needed for python-2.6 with USE=build since + # io imports threading which imports thread + # which is unavailable. + from StringIO import StringIO + from time import sleep from random import shuffle from itertools import chain @@ -5620,7 +5629,23 @@ def spawnebuild(mydo, actionmap, mysettings, debug, alwaysdep=0, _post_phase_userpriv_perms(mysettings) if mydo == "install": - _check_build_log(mysettings) + out = StringIO() + _check_build_log(mysettings, out=out) + msg = _unicode_decode(out.getvalue(), + encoding=_encodings['content'], errors='replace') + if msg: + writemsg_stdout(msg, noiselevel=-1) + if logfile is not None: + try: + f = codecs.open(_unicode_encode(logfile, + encoding=_encodings['fs'], errors='strict'), + mode='a', encoding=_encodings['content'], + errors='replace') + except EnvironmentError: + pass + else: + f.write(msg) + f.close() if phase_retval == os.EX_OK: _post_src_install_chost_fix(mysettings) phase_retval = _post_src_install_checks(mysettings) -- 2.26.2