Fix MergeProcess elog handling.
authorZac Medico <zmedico@gentoo.org>
Fri, 12 Nov 2010 10:12:40 +0000 (02:12 -0800)
committerZac Medico <zmedico@gentoo.org>
Fri, 12 Nov 2010 10:12:40 +0000 (02:12 -0800)
pym/portage/dbapi/vartree.py

index 5e00f7fd749c13c1a38619a6d9c583c8d475c5e7..fe32626554ef586981f39dd320aca826199b399f 100644 (file)
@@ -2759,6 +2759,20 @@ class dblink(object):
                        self._scheduler.dblinkElog(self,
                                phase, _eerror, lines)
 
+       def _elog_subprocess(self, funcname, phase, lines):
+               """
+               Subprocesses call this in order to create elog messages in
+               $T, for collection by the main process.
+               """
+               cmd = "source %s/isolated-functions.sh ; " % \
+                       portage._shell_quote(self.settings["PORTAGE_BIN_PATH"])
+               for line in lines:
+                       cmd += "%s %s ; " % (funcname, portage._shell_quote(line))
+               env = self.settings.environ()
+               env['EBUILD_PHASE'] = phase
+               subprocess.call([portage.const.BASH_BINARY, "-c", cmd],
+                       env=env)
+
        def treewalk(self, srcroot, destroot, inforoot, myebuild, cleanup=0,
                mydbapi=None, prev_mtimes=None):
                """
@@ -3628,7 +3642,7 @@ class dblink(object):
                                                msg.append(_("This file will be renamed to a different name:"))
                                                msg.append("  '%s'" % backup_dest)
                                                msg.append("")
-                                               self._eerror("preinst", msg)
+                                               self._elog_subprocess("eerror", "preinst", msg)
                                                if movefile(mydest, backup_dest,
                                                        mysettings=self.settings,
                                                        encoding=_encodings['merge']) is None:
@@ -3706,7 +3720,7 @@ class dblink(object):
                                                msg.append(_("This file will be merged with a different name:"))
                                                msg.append("  '%s'" % newdest)
                                                msg.append("")
-                                               self._eerror("preinst", msg)
+                                               self._elog_subprocess("eerror", "preinst", msg)
                                                mydest = newdest
 
                                        elif stat.S_ISREG(mydmode) or (stat.S_ISLNK(mydmode) and os.path.exists(mydest) and stat.S_ISREG(os.stat(mydest)[stat.ST_MODE])):