Fix ebuild environment color.map support so that it works properly through exec calls...
authorZac Medico <zmedico@gentoo.org>
Fri, 12 Jan 2007 02:44:24 +0000 (02:44 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 12 Jan 2007 02:44:24 +0000 (02:44 -0000)
svn path=/main/trunk/; revision=5578

bin/isolated-functions.sh
pym/portage.py

index 5b2c82f7ce1f5efa092edabad268d587955e87ab..5aa838ba95f3338d9969b5386478c2417a8618c4 100644 (file)
@@ -209,16 +209,18 @@ set_colors() {
 
        ENDCOL=$'\e[A\e['${COLS}'C'    # Now, ${ENDCOL} will move us to the end of the
                                       # column;  irregardless of character width
-
-       [ -z "${GOOD}"    ] && GOOD=$'\e[32;01m'
-       [ -z "${WARN}"    ] && WARN=$'\e[33;01m'
-       [ -z "${BAD}"     ] && BAD=$'\e[31;01m'
-       [ -z "${HILITE}"  ] && HILITE=$'\e[36;01m'
-       [ -z "${BRACKET}" ] && BRACKET=$'\e[34;01m'
+       if [ -n "${PORTAGE_COLORMAP}" ] ; then
+               eval ${PORTAGE_COLORMAP}
+       else
+               GOOD=$'\e[32;01m'
+               WARN=$'\e[33;01m'
+               BAD=$'\e[31;01m'
+               HILITE=$'\e[36;01m'
+               BRACKET=$'\e[34;01m'
+       fi
        NORMAL=$'\e[0m'
 }
 
-export -n GOOD WARN BAD HILITE BRACKET
 RC_ENDCOL="yes"
 RC_INDENTATION=''
 RC_DEFAULT_INDENT=2
index 4bf3a9353e83a8bc805b8979c2db5866fff8a432..0952bd5f88cd273debec632a36d2f396a6e19563 100644 (file)
@@ -2976,8 +2976,10 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, m
                mysettings["KVERS"]=myso[1]
 
        # Allow color.map to control colors associated with einfo, ewarn, etc...
+       mycolors = []
        for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET"):
-               mysettings[c] = output.codes[c]
+               mycolors.append("%s=$'%s'" % (c, output.codes[c]))
+       mysettings["PORTAGE_COLORMAP"] = "\n".join(mycolors)
 
 def prepare_build_dirs(myroot, mysettings, cleanup):