Take the code which displays ebuild information before pkg_setup,
authorZac Medico <zmedico@gentoo.org>
Sun, 5 Sep 2010 07:28:49 +0000 (00:28 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 5 Sep 2010 07:28:49 +0000 (00:28 -0700)
and move it from ebuild.sh to EbuildPhase. This way we can easily
use python to extend it for bug #336019.

bin/ebuild.sh
pym/_emerge/EbuildPhase.py

index 6627c898d47e483421ff7e6eb8c004d32b8763b4..5808c8e8faf5d45dcc196ad3c24f83e79ccd89b7 100755 (executable)
@@ -2214,11 +2214,6 @@ ebuild_main() {
                export SANDBOX_ON="0"
                ;;
        help|pretend|setup|preinst)
-               if [[ $EBUILD_SH_ARGS = setup ]] ; then
-                       einfo "CPV:  $CATEGORY/$PF"
-                       einfo "REPO: $PORTAGE_REPO_NAME"
-                       einfo "USE:  $USE"
-               fi
                #pkg_setup needs to be out of the sandbox for tmp file creation;
                #for example, awking and piping a file in /tmp requires a temp file to be created
                #in /etc.  If pkg_setup is in the sandbox, both our lilo and apache ebuilds break.
index e85fe9c1396bf0ac8829ee2b632aa0f187b4e4f1..a5d617f652994d42b38b6bc90b17e3d3394af72d 100644 (file)
@@ -11,12 +11,14 @@ from _emerge.CompositeTask import CompositeTask
 from portage.util import writemsg
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
+       'portage.elog:messages@elog_messages',
        'portage.package.ebuild.doebuild:_check_build_log,' + \
                '_post_phase_cmds,_post_phase_userpriv_perms,' + \
                '_post_src_install_chost_fix,' + \
                '_post_src_install_uid_fix'
 )
 from portage import os
+from portage import StringIO
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
@@ -27,6 +29,18 @@ class EbuildPhase(CompositeTask):
 
        def _start(self):
 
+               if self.phase == 'setup':
+
+                       use = self.settings.get('PORTAGE_BUILT_USE')
+                       if use is None:
+                               use = self.settings['PORTAGE_USE']
+
+                       msg = []
+                       msg.append("CPV:  %s" % self.settings.mycpv)
+                       msg.append("REPO: %s" % self.settings['PORTAGE_REPO_NAME'])
+                       msg.append("USE:  %s" % use)
+                       self._elog('einfo', msg)
+
                if self.phase == 'prerm':
                        env_extractor = BinpkgEnvExtractor(background=self.background,
                                scheduler=self.scheduler, settings=self.settings)
@@ -200,3 +214,15 @@ class EbuildPhase(CompositeTask):
                self._final_exit(clean_phase)
                self.returncode = 1
                self.wait()
+
+       def _elog(self, elog_funcname, lines):
+               out = StringIO()
+               phase = self.phase
+               elog_func = getattr(elog_messages, elog_funcname)
+               for line in lines:
+                       elog_func(line, phase=phase, key=self.settings.mycpv, out=out)
+               msg = _unicode_decode(out.getvalue(),
+                       encoding=_encodings['content'], errors='replace')
+               if msg:
+                       self.scheduler.output(msg,
+                               log_path=self.settings.get("PORTAGE_LOG_FILE"))