Always append QA Notices resulting from the build log search to the end of
authorZac Medico <zmedico@gentoo.org>
Sat, 5 Dec 2009 22:00:19 +0000 (22:00 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 5 Dec 2009 22:00:19 +0000 (22:00 -0000)
the log. Thanks to Diego E. Pettenò for reporting.

svn path=/main/trunk/; revision=14927

pym/_emerge/EbuildPhase.py
pym/portage/__init__.py

index fcf60d39c8eb128390bc62be9559554e3979fba8..01661b2cc8da3d21e1d4a300390c5c55a9544ea9 100644 (file)
@@ -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()
index 90be7ae456c175014102c54a1e66d81eabb0d04a..dde0aeadb087f5e4afb2c0dbf40f92b4b20796f3 100644 (file)
@@ -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)