diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-08-06 02:07:34 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-08-06 02:07:34 +0000 |
commit | 7c926214d164b5ac1f197ccf7b8dcd34f4787536 (patch) | |
tree | dce35235dd96c70ab6a9430f382f5df3901a0467 | |
parent | dd6d8035d2d3bfc659d9fa0982a0078d1f4a868c (diff) | |
download | portage-7c926214d164b5ac1f197ccf7b8dcd34f4787536.tar.gz portage-7c926214d164b5ac1f197ccf7b8dcd34f4787536.tar.bz2 portage-7c926214d164b5ac1f197ccf7b8dcd34f4787536.zip |
Fix breakage in elog function newline handling with causes blank/empty
lines to get lost.
svn path=/main/trunk/; revision=11335
-rwxr-xr-x | bin/isolated-functions.sh | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index abeb9d371..aa330c980 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -158,7 +158,7 @@ vecho() { # Internal logging function, don't use this in ebuilds elog_base() { - local line messagetype + local line lines=0 messagetype [ -z "${1}" -o -z "${T}" -o ! -d "${T}/logging" ] && return 1 case "${1}" in INFO|WARN|ERROR|LOG|QA) @@ -177,23 +177,36 @@ elog_base() { save_IFS IFS=$'\n' for line in $* ; do + (( lines++ )) echo -ne "${messagetype} ${line}\n\0" >> \ "${T}/logging/${EBUILD_PHASE:-other}" done restore_IFS + + # This is needed in case a blank line is being shown. + [ $lines -eq 0 ] && \ + echo -ne "${messagetype} $*\n\0" >> \ + "${T}/logging/${EBUILD_PHASE:-other}" + return 0 } eqawarn() { elog_base QA "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo + local line lines=0 save_IFS IFS=$'\n' - local line for line in $* ; do + (( lines++ )) vecho -e " ${WARN}*${NORMAL} ${line}" >&2 done restore_IFS + + # This is needed in case a blank line is being shown. + [ $lines -eq 0 ] && \ + vecho -e " ${WARN}*${NORMAL} $*" >&2 + LAST_E_CMD="eqawarn" return 0 } @@ -201,13 +214,20 @@ eqawarn() { elog() { elog_base LOG "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo + local line lines=0 save_IFS IFS=$'\n' local line for line in $* ; do + (( lines++ )) echo -e " ${GOOD}*${NORMAL} ${line}" done restore_IFS + + # This is needed in case a blank line is being shown. + [ $lines -eq 0 ] && \ + echo -e " ${GOOD}*${NORMAL} $*" + LAST_E_CMD="elog" return 0 } @@ -235,11 +255,17 @@ einfo() { [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo save_IFS IFS=$'\n' - local line + local line lines=0 for line in $* ; do + (( lines++ )) echo -e " ${GOOD}*${NORMAL} ${line}" done restore_IFS + + # This is needed in case a blank line is being shown. + [ $lines -eq 0 ] && \ + echo -e " ${GOOD}*${NORMAL} $*" + LAST_E_CMD="einfo" return 0 } @@ -257,11 +283,17 @@ ewarn() { [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo save_IFS IFS=$'\n' - local line + local line lines=0 for line in $* ; do + (( lines++ )) echo -e " ${WARN}*${NORMAL} ${RC_INDENTATION}${line}" >&2 done restore_IFS + + # This is needed in case a blank line is being shown. + [ $lines -eq 0 ] && \ + echo -e " ${WARN}*${NORMAL} ${RC_INDENTATION}$*" >&2 + LAST_E_CMD="ewarn" return 0 } @@ -271,11 +303,17 @@ eerror() { [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo save_IFS IFS=$'\n' - local line + local line lines=0 for line in $* ; do + (( lines++ )) echo -e " ${BAD}*${NORMAL} ${RC_INDENTATION}${line}" >&2 done restore_IFS + + # This is needed in case a blank line is being shown. + [ $lines -eq 0 ] && \ + echo -e " ${BAD}*${NORMAL} ${RC_INDENTATION}$*" >&2 + LAST_E_CMD="eerror" return 0 } |