mirror of the now-defunct rocklinux.org
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.

111 lines
3.4 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/misc/output/terminal
  9. # ROCK Linux is Copyright (C) 1998 - 2005 Clifford Wolf
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 2 of the License, or
  14. # (at your option) any later version. A copy of the GNU General Public
  15. # License can be found at Documentation/COPYING.
  16. #
  17. # Many people helped and are helping developing ROCK Linux. Please
  18. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  19. # file for details.
  20. #
  21. # --- ROCK-COPYRIGHT-NOTE-END ---
  22. if [ "$ROCKCFG_OUTPUT_TERM_COLOR" = 1 ] ; then
  23. term_color_normal=$'\e[0m'
  24. term_color_error=$'\e[31;1m'
  25. term_color_status=$'\e[32;1m'
  26. term_color_header=$'\e[35;1m'
  27. else
  28. term_color_normal=
  29. term_color_error=
  30. term_color_status=
  31. term_color_header=
  32. fi
  33. # A free-form header at start of a section usually followed by calls to
  34. # echo_status_terminal().
  35. #
  36. # E.g. echo_header "Building cross binutils and cc for ${arch_target} ..."
  37. #
  38. echo_header_terminal() {
  39. echo ; echo "${term_color_header}$*${term_color_normal}"
  40. }
  41. # A free-form status message informaing the user of what is happening just
  42. # now.
  43. #
  44. # E.g. echo_status "writing build log to src.cross.$id/binutils.log."
  45. #
  46. echo_status_terminal() {
  47. echo "${term_color_status}->${term_color_normal} $*"
  48. }
  49. # A free-form error or warning message if something fails.
  50. #
  51. # E.g. echo_error "Detected a problem with the flist wrapper" \
  52. # "lib on your system."
  53. #
  54. echo_error_terminal() {
  55. echo "${term_color_error}!> $*${term_color_normal}"
  56. }
  57. # We deny to build a package for some reason.
  58. #
  59. # Usage: echo_pkg_deny <stagelevel> <package-name> <reason>
  60. #
  61. # E.g. echo_pkg_deny $stagelevel $pkg "already failed"
  62. #
  63. echo_pkg_deny_terminal() {
  64. date "+%n${term_color_error}== %D %T =[$1]=> Package $2 $3.${term_color_normal}"
  65. }
  66. # We start building a package.
  67. #
  68. # Usage: echo_pkg_start <stagelevel> <repository> <package-name> \
  69. # <ver> <extraver>
  70. #
  71. # E.g. echo_pkg_start $stagelevel $repository $pkg $ver $extraver
  72. #
  73. echo_pkg_start_terminal() {
  74. date "+%n${term_color_header}== %T =[$1]=> Building $2/$3 [$4 $5].${term_color_normal}"
  75. }
  76. # We finished building a package.
  77. #
  78. # Usage: echo_pkg_finish <stagelevel> <repository> <package-name>
  79. #
  80. # E.g. echo_pkg_finish $stagelevel $repository $pkg
  81. #
  82. echo_pkg_finish_terminal() {
  83. date "+${term_color_header}== %D %T =[$1]=> Finished building package $3.${term_color_normal}"
  84. }
  85. # We aborted building a package.
  86. #
  87. # Usage: echo_pkg_abort <stagelevel> <repository> <package-name>
  88. #
  89. # E.g. echo_pkg_abort $stagelevel $repository $pkg
  90. #
  91. echo_pkg_abort_terminal() {
  92. date "+${term_color_error}== %D %T =[$1]=> Aborted building package $3.${term_color_normal}"
  93. }
  94. # Whenever the tail of error logs are printed, this function is used for
  95. # that. The parameter may contain newlines.
  96. #
  97. # E.g. echo_errorquote "`tail $root/var/adm/logs/$stagelevel-$pkg.out`"
  98. #
  99. echo_errorquote_terminal() {
  100. echo "$*" | grep . | sed 's,^,'"${term_color_error}!>${term_color_normal} "',; s/^\(.\{70\}\).\{3,\}/\1 ../'
  101. }