Add support for an new "eblank" elog function that shows a blank line.
authorZac Medico <zmedico@gentoo.org>
Tue, 17 Jun 2008 03:31:43 +0000 (03:31 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 17 Jun 2008 03:31:43 +0000 (03:31 -0000)
Consecutive eblank calls are all collapsed into a single blank line.
Thanks to Joe Peterson <lavajoe@g.o> for this patch.

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

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

index 42f3d5ac7f16ee3f4082a5c0efc656983f110380..dd157129d0fdb54c2adff19076ec19180064fbe7 100755 (executable)
@@ -161,7 +161,7 @@ elog_base() {
        local messagetype
        [ -z "${1}" -o -z "${T}" -o ! -d "${T}/logging" ] && return 1
        case "${1}" in
-               INFO|WARN|ERROR|LOG|QA)
+               BLANK|INFO|WARN|ERROR|LOG|QA)
                        messagetype="${1}"
                        shift
                        ;;
@@ -174,15 +174,28 @@ elog_base() {
        return 0
 }
 
+eblank() {
+       [[ ${LAST_E_CMD} == "eblank" ]] && return 0
+       elog_base BLANK
+       [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
+       echo -e " ${NEUTRAL}*${NORMAL}"
+       LAST_E_CMD="eblank"
+       return 0
+}
+
 eqawarn() {
        elog_base QA "$*"
+       [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
        vecho -e " ${WARN}*${NORMAL} $*" >&2
+       LAST_E_CMD="eqawarn"
        return 0
 }
 
 elog() {
        elog_base LOG "$*"
+       [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
        echo -e " ${GOOD}*${NORMAL} $*"
+       LAST_E_CMD="elog"
        return 0
 }
 
@@ -281,6 +294,7 @@ eend() {
 
        _eend ${retval} eerror "$*"
 
+       LAST_E_CMD="eend"
        return ${retval}
 }
 
@@ -339,6 +353,7 @@ unset_colors() {
        COLS="25 80"
        ENDCOL=
 
+       NEUTRAL=
        GOOD=
        WARN=
        BAD=
@@ -361,6 +376,7 @@ set_colors() {
        if [ -n "${PORTAGE_COLORMAP}" ] ; then
                eval ${PORTAGE_COLORMAP}
        else
+               NEUTRAL=$'\e[37m'
                GOOD=$'\e[32;01m'
                WARN=$'\e[33;01m'
                BAD=$'\e[31;01m'
index 6b35f1791ac17ec3688674b38b89ea21155d1854..45d27aedef42f0aa966ea1a3046001a1d0fd76c2 100644 (file)
@@ -4452,7 +4452,7 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, m
 
        # Allow color.map to control colors associated with einfo, ewarn, etc...
        mycolors = []
-       for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET"):
+       for c in ("NEUTRAL", "GOOD", "WARN", "BAD", "HILITE", "BRACKET"):
                mycolors.append("%s=$'%s'" % (c, portage.output.codes[c]))
        mysettings["PORTAGE_COLORMAP"] = "\n".join(mycolors)
 
index a7a500cd4f120efcf208cc8a87a85c79819c83a9..3c65331066cbff958cabb188086e5a6a5da89e00 100644 (file)
@@ -138,6 +138,7 @@ codes["bg_darkyellow"] = codes["bg_brown"]
 
 # Colors from /etc/init.d/functions.sh
 codes["NORMAL"]     = esc_seq + "0m"
+codes["NEUTRAL"]    = codes["lightgray"]
 codes["GOOD"]       = codes["green"]
 codes["WARN"]       = codes["yellow"]
 codes["BAD"]        = codes["red"]