summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-28 09:25:09 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-28 09:25:09 +0000
commitc1581f13eb2bee8ae7d625a88990ca56f586108d (patch)
tree02da67679312f3bd57258bcb721827ca768821fe /pym
parent6562f79a3620553ed3310084ae9860bfc484ef98 (diff)
downloadportage-c1581f13eb2bee8ae7d625a88990ca56f586108d.tar.gz
portage-c1581f13eb2bee8ae7d625a88990ca56f586108d.tar.bz2
portage-c1581f13eb2bee8ae7d625a88990ca56f586108d.zip
Condense duplicate eerror log generation code into a single
_eerror() function. svn path=/main/branches/2.1.2/; revision=8728
Diffstat (limited to 'pym')
-rw-r--r--pym/portage.py35
1 files changed, 15 insertions, 20 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 9e14be1b6..5db9004b7 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -597,6 +597,18 @@ def elog_process(cpv, mysettings):
except OSError:
pass
+def _eerror(settings, lines):
+ if not lines:
+ return
+ cmd = "source '%s/isolated-functions.sh' ; " % PORTAGE_BIN_PATH
+ for line in lines:
+ for letter in "\\\"$`":
+ if letter in line:
+ line = line.replace(letter, "\\" + letter)
+ cmd += "eerror \"%s\" ; " % line
+ portage_exec.spawn(["bash", "-c", cmd],
+ env=settings.environ())
+
#parse /etc/env.d and generate /etc/profile.env
def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
@@ -3533,13 +3545,8 @@ def spawnebuild(mydo,actionmap,mysettings,debug,alwaysdep=0,logfile=None):
if msg:
phase_retval = 1
from textwrap import wrap
- cmd = "source '%s/isolated-functions.sh' ; " % \
- PORTAGE_BIN_PATH
- for l in wrap(msg, 72):
- cmd += "eerror \"%s\" ; " % l
mysettings["EBUILD_PHASE"] = mydo
- portage_exec.spawn(["bash", "-c", cmd],
- env=mysettings.environ())
+ _eerror(mysettings, wrap(msg, 72))
mysettings["EBUILD_PHASE"] = ""
if "userpriv" in mysettings.features and \
@@ -4114,13 +4121,8 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
if msg:
retval = 1
from textwrap import wrap
- cmd = "source '%s/isolated-functions.sh' ; " % \
- PORTAGE_BIN_PATH
- for l in wrap(msg, 72):
- cmd += "eerror \"%s\" ; " % l
mysettings["EBUILD_PHASE"] = mydo
- portage_exec.spawn(["bash", "-c", cmd],
- env=mysettings.environ())
+ _eerror(mysettings, wrap(msg, 72))
mysettings["EBUILD_PHASE"] = ""
return retval
@@ -8354,14 +8356,7 @@ class dblink:
slot = ""
def eerror(lines):
- cmd = "source '%s/isolated-functions.sh' ; " % PORTAGE_BIN_PATH
- for line in lines:
- for letter in "\\\"$`":
- if letter in line:
- line = line.replace(letter, "\\" + letter)
- cmd += "eerror \"%s\" ; " % line
- portage_exec.spawn(["bash", "-c", cmd],
- env=self.settings.environ())
+ _eerror(self.settings, lines)
if slot != self.settings["SLOT"]:
writemsg("!!! WARNING: Expected SLOT='%s', got '%s'\n" % \