# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: misc/output/terminal # Copyright (C) 2004 - 2023 The T2 SDE Project # Copyright (C) 1998 - 2003 ROCK Linux Project # # This Copyright note is generated by scripts/Create-CopyPatch, # 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 version 2. # --- T2-COPYRIGHT-NOTE-END --- . scripts/core-functions.in 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= 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 # # E.g. echo_pkg_deny $stagelevel $pkg "already failed" # echo_pkg_deny_terminal() { local buildend="`date '+%s'`" date --date=@$((buildend - buildstart)) --utc "+${term_color_error}+%H:%M:%S Package $1-$2 $3${term_color_normal}" } # We start building a package. # # Usage: echo_pkg_start # # E.g. echo_pkg_start $stagelevel $repository $pkg $ver $extraver $esttime # echo_pkg_start_terminal() { buildstart="`date '+%s'`" date "+%n${term_color_header}%T Building $1-$2/$3 ($4)$(fmt_time $6)${term_color_normal}" } # We finished building a package. # # Usage: echo_pkg_finish # # E.g. echo_pkg_finish $stagelevel $repository $pkg # echo_pkg_finish_terminal() { local buildend="`date '+%s'`" date --date=@$((buildend - buildstart)) --utc "+ ${term_color_header}+%H:%M:%S Finished building $2/$3${term_color_normal}" } # We aborted building a package. # # Usage: echo_pkg_abort # # E.g. echo_pkg_abort $stagelevel $repository $pkg # echo_pkg_abort_terminal() { local buildend="`date '+%s'`" date --date=@$((buildend - buildstart)) --utc "+ ${term_color_error}+%H:%M:%S Aborted building $2/$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 -vx -- -- | grep . | sed -e 's/^\(.\{'$(( columns - 6 ))'\}\).\{3,\}/\1 ../' \ -e 's,^,'"${term_color_error}!${term_color_normal} "',' }