OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

116 lines
3.3 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: lib/output/terminal
# Copyright (C) 2006 - 2012 The OpenSDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
if [ "$SDECFG_OUTPUT_TERM_COLOR" = 1 ] ; then
term_color_normal=$'\e[0m'
term_color_error=$'\e[31;1m'
term_color_warning=$'\e[33;1m'
term_color_status=$'\e[32;1m'
term_color_header=$'\e[35;1m'
else
term_color_normal=
term_color_error=
term_color_warning=
term_color_status=
term_color_header=
fi
# A free-form header at start of a section usually followed by calls to
# echo_status_terminal().
#
# E.g. echo_header "Building cross binutils and cc for ${arch_target} ..."
#
echo_header_terminal() {
echo ; echo "${term_color_header}$*${term_color_normal}"
}
# A free-form status message informaing the user of what is happening just
# now.
#
# E.g. echo_status "writing build log to src.cross.$id/binutils.log."
#
echo_status_terminal() {
echo "${term_color_status}->${term_color_normal} $*"
}
# A free-form warning message
#
# E.g. echo_warn "Something went wrong, but we corrected it"
echo_warning_terminal() {
echo "${term_color_warning}*>${term_color_normal} $*"
}
# A free-form error or warning message if something fails.
#
# E.g. echo_error "Detected a problem with the flist wrapper" \
# "lib on your system."
#
echo_error_terminal() {
echo "${term_color_error}!> $*${term_color_normal}"
}
# We deny to build a package for some reason.
#
# Usage: echo_pkg_deny <stagelevel> <package-name> <reason>
#
# E.g. echo_pkg_deny $stagelevel $pkg "already failed"
#
echo_pkg_deny_terminal() {
date "+%n${term_color_error}== %F %T =[$1]=> Package $2 $3.${term_color_normal}"
}
# We start building a package.
#
# Usage: echo_pkg_start <stagelevel> <repository> <package-name> \
# <ver> <extraver>
#
# E.g. echo_pkg_start $stagelevel $repository $pkg $ver $extraver
#
echo_pkg_start_terminal() {
date "+%n${term_color_header}== %F %T =[$1]=> Building $2/$3 [$4 $5].${term_color_normal}"
}
# We finished building a package.
#
# Usage: echo_pkg_finish <stagelevel> <repository> <package-name>
#
# E.g. echo_pkg_finish $stagelevel $repository $pkg
#
echo_pkg_finish_terminal() {
date "+${term_color_header}== %F %T =[$1]=> Finished building package $3.${term_color_normal}"
}
# We aborted building a package.
#
# Usage: echo_pkg_abort <stagelevel> <repository> <package-name>
#
# E.g. echo_pkg_abort $stagelevel $repository $pkg
#
echo_pkg_abort_terminal() {
date "+${term_color_error}== %F %T =[$1]=> Aborted building package $3.${term_color_normal}"
}
# Whenever the tail of error logs are printed, this function is used for
# that. The parameter may contain newlines.
#
# E.g. echo_errorquote "`tail $root/var/adm/logs/$stagelevel-$pkg.out`"
#
echo_errorquote_terminal() {
local cols=$( expr ${columns:-80} - 6 )
echo "$@" | grep -vx -- -- | grep . |
sed -e "s/^\(.\{$cols\}\).\{3,\}/\1 ../" \
-e "s,^,${term_color_error}!>${term_color_normal} ,"
}