|
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
|
|
#
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
# Please add additional copyright information _after_ the line containing
|
|
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
|
|
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
|
|
#
|
|
# ROCK Linux: rock-src/misc/output/terminal
|
|
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
|
|
#
|
|
# 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; either version 2 of the License, or
|
|
# (at your option) any later version. A copy of the GNU General Public
|
|
# License can be found at Documentation/COPYING.
|
|
#
|
|
# Many people helped and are helping developing ROCK Linux. Please
|
|
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
|
|
# file for details.
|
|
#
|
|
# --- ROCK-COPYRIGHT-NOTE-END ---
|
|
|
|
if [ "$ROCKCFG_OUTPUT_TERM_COLOR" = 1 ] ; then
|
|
term_color_normal=$'\e[0m'
|
|
term_color_error=$'\e[31;1m'
|
|
term_color_status=$'\e[32;1m'
|
|
term_color_header=$'\e[35;1m'
|
|
else
|
|
term_color_normal=
|
|
term_color_error=
|
|
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 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}== %D %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}== %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}== %D %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}== %D %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() {
|
|
echo "$*" | grep . | sed 's,^,'"${term_color_error}!>${term_color_normal} "',; s/^\(.\{70\}\).\{3,\}/\1 ../'
|
|
}
|
|
|