diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-12-05 22:00:19 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-12-05 22:00:19 +0000 |
commit | 731b3a807b3f69b6b8783459f8fb00dd2a8a179b (patch) | |
tree | abd1ca114cf22ebcc3e0add248d44aba9d1de432 | |
parent | 8f43f06b8bcaf4c85d186186a665a490c07f8f12 (diff) | |
download | portage-731b3a807b3f69b6b8783459f8fb00dd2a8a179b.tar.gz portage-731b3a807b3f69b6b8783459f8fb00dd2a8a179b.tar.bz2 portage-731b3a807b3f69b6b8783459f8fb00dd2a8a179b.zip |
Always append QA Notices resulting from the build log search to the end of
the log. Thanks to Diego E. Pettenò for reporting.
svn path=/main/trunk/; revision=14927
-rw-r--r-- | pym/_emerge/EbuildPhase.py | 15 | ||||
-rw-r--r-- | 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) |