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.

241 lines
5.7 KiB

  1. #!/bin/bash
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: scripts/Create-ErrList
  6. # Copyright (C) 2006 - 2008 The OpenSDE Project
  7. # Copyright (C) 2004 - 2006 The T2 SDE Project
  8. # Copyright (C) 1998 - 2003 Clifford Wolf
  9. #
  10. # More information can be found in the files COPYING and README.
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; version 2 of the License. A copy of the
  15. # GNU General Public License can be found in the file COPYING.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. config=default
  18. repstat=0
  19. showerr=0
  20. showtree=0
  21. showdepc=0
  22. onlyupdated=0
  23. repository=
  24. stages="[0123456789]"
  25. copydir=
  26. movedir=
  27. logdir=
  28. while [ "$1" ] ; do
  29. case "$1" in
  30. -cfg)
  31. config=$2 ; shift ; shift ;;
  32. -repstat)
  33. repstat=1 ; shift ;;
  34. -showerr)
  35. showerr=1 ; shift ;;
  36. -showtree)
  37. showtree=1 ; shift ;;
  38. -showdepc)
  39. showdepc=1 ; shift ;;
  40. -repository)
  41. if [ $2 != '!' ] ; then
  42. repository=" $2 " ; shift ; shift
  43. while [ "$1" -a -d "package/$1" ] ; do
  44. repository="$repository $1 " ; shift
  45. done
  46. else
  47. shift ; shift ; repository=
  48. for x in $( ls package/ ) ; do
  49. [ -d "package/$x" ] &&
  50. repository="$repository $x"
  51. done
  52. repository="$repository "
  53. while [ "$1" -a -d "package/$1" ] ; do
  54. repository="${repository// $1 / }" ; shift
  55. done
  56. fi
  57. ;;
  58. -stage)
  59. stages="[$2]" ; shift ; shift ;;
  60. -logdir)
  61. logdir=$2 ; shift ; shift ;;
  62. -copydir)
  63. copydir=$2 ; shift ; shift ;;
  64. -movedir)
  65. movedir=$2 ; shift ; shift ;;
  66. -updated)
  67. onlyupdated=1 ; shift ;;
  68. -*)
  69. x="${0//?/ }" ; x="${x# }"
  70. echo "Usage: $0 [ -cfg config ] [ -repository repository ] \\"
  71. echo " $x [ -copydir copydir | -movedir movedir ] [ -repstat ] \\"
  72. echo " $x [ -stage stage ] [ -logdir logdir ] \\"
  73. echo " $x [ -updated ] [ -showerr ] [ -showtree ] [ -showdepc ] \\"
  74. echo " $x [ <package> ]"
  75. exit 1 ;;
  76. *)
  77. break ;;
  78. esac
  79. done
  80. . lib/functions.in
  81. . lib/parse-config
  82. logdir="${logdir:-build/$SDECFG_ID/var/adm/logs}"
  83. pkgdir="${logdir%/*}/packages"
  84. if [ "$repstat" = 1 ] ; then
  85. {
  86. echo
  87. echo -e "Repository\tPkg Total\tPkg OK\tPkg Error"
  88. echo
  89. total_pkgt=0 ; total_pkgo=0 ; total_pkge=0
  90. for x in $( cd package ; echo [a-z0-9]* ) ; do
  91. pkgt=0 ; pkgo=0 ; pkge=0
  92. for y in $( cd package/$x ; echo [a-z0-9]* ) ; do
  93. if [ "$( ls $logdir/$stages-$y.err 2> /dev/null )" ]
  94. then (( pkge++ )) ; (( total_pkge++ ))
  95. elif [ "$( ls $logdir/$stages-$y.log 2> /dev/null )" ]
  96. then (( pkgo++ )) ; (( total_pkgo++ ))
  97. fi
  98. done
  99. (( pkgt = pkgo + pkge )) ; (( total_pkgt += pkgt ))
  100. [ $pkgt != 0 ] && echo -e "$x\t$pkgt\t$pkgo\t$pkge"
  101. done
  102. echo
  103. echo -e "total\t$total_pkgt\t$total_pkgo\t$total_pkge"
  104. echo
  105. } | {
  106. expand -t20,35,50 | sed 's,^, ,'
  107. }
  108. exit 0
  109. fi
  110. if [ "$1" ] ; then
  111. for x ; do less "$logdir"/$stages-$x.err ; done
  112. exit 0
  113. fi
  114. echo
  115. echo "Error logs from $SDECFG_ID:"
  116. [ $showerr = 0 ] && echo
  117. count_pkg=0
  118. count_err=0
  119. count_log=0
  120. for stagelevel in $( echo "$stages" | tr -d '[]' | sed 's,.,& ,g' ) ; do
  121. while read x x x tree pkg x ; do
  122. [ "$repository" -a \
  123. "${repository/ $tree /}" = "$repository" ] && continue
  124. this_is_error=0
  125. if [ $onlyupdated != 0 ] ; then
  126. [ "$( bin/find package/*/$pkg -newer "$logdir/$stagelevel-$pkg.err" -o -newer "$logdir/$stagelevel-$pkg.log" )" ] && this_is_error=1
  127. elif [ -f "$logdir/$stagelevel-$pkg.err" ] ; then
  128. this_is_error=1
  129. fi
  130. if [ $this_is_error = 1 ] ; then
  131. if [ $showerr = 0 ] ; then
  132. if [ $showdepc != 0 ]; then
  133. d=$( ./scripts/Check-Deps-3 $stagelevel \
  134. $pkg config/$config/packages | \
  135. cut -f3 -d' ' | sort -u | wc -l )
  136. d="$( printf " %3d" $d )"
  137. else
  138. d=
  139. fi
  140. echo "[$stagelevel]$d ${tree:0:13}/${pkg:0:18}"
  141. else
  142. echo ; echo "== $stagelevel-$pkg.* =="
  143. tail -n 20 "$logdir/$stagelevel-$pkg".* | \
  144. tac | perl -e '
  145. my @lines;
  146. my $counter;
  147. while (<>) {
  148. chomp;
  149. $lines[$#lines+1] = $_;
  150. }
  151. for ($counter=0; $counter <= $#lines; $counter++) {
  152. $_=$lines[$counter];
  153. if ( /^checking for .*\.\.\. *Package / ||
  154. /configure: error:/ ) {
  155. for ($_=1; $_ <= $counter; $_++) {
  156. print "$lines[$_]\n";
  157. }
  158. exit 0;
  159. }
  160. }
  161. for ($counter=0; $counter <= $#lines; $counter++) {
  162. $_=$lines[$counter];
  163. if ( /^(make\S*): / ) {
  164. my $makeprefix=$1;
  165. my $output="$_\n";
  166. while ( defined
  167. ($_=$lines[$counter++]) ) {
  168. last unless /^(make\S*): /;
  169. $output="" if $1 ne $makeprefix;
  170. $makeprefix=$1;
  171. $output.="$_\n";
  172. }
  173. print $output; exit 0;
  174. }
  175. }
  176. foreach (@lines) {
  177. print "$_\n";
  178. }
  179. ' | tac | fold -s -w79
  180. depcheck() {
  181. echo "${1}\`---> $3"
  182. for x in `grep -lwi $3 $logdir/*.err | \
  183. sed 's,.*/.-,,; s,\.err,,' | sort -u`
  184. do
  185. [ "$x" = "$3" ] && continue
  186. [ "${2/ $x /}" != "$2" ] && continue
  187. depcheck "${1} " "$2 $3 " $x
  188. done
  189. }
  190. [ $showtree = 1 ] && depcheck "" "" $pkg
  191. fi
  192. if [ "$copydir" ] ; then
  193. mkdir -p "$copydir"
  194. cp "$logdir/$stagelevel-$pkg.err" "$copydir"
  195. fi
  196. if [ "$movedir" ] ; then
  197. mkdir -p "$movedir"
  198. mv "$logdir/$stagelevel-$pkg.err" "$movedir"
  199. fi
  200. count_err=$(( $count_err + 1 ))
  201. elif [ -f "$logdir/$stagelevel-$pkg.log" ] ; then
  202. count_log=$(( $count_log + 1 ))
  203. fi
  204. count_pkg=$(( $count_pkg + 1 ))
  205. done < <( grep "^X [0-9-]*$stagelevel" config/$config/packages )
  206. done > >(
  207. if [ $showerr = 0 ] ; then
  208. paste - - | expand -t40 | sed 's,^, ,'
  209. else cat ; fi
  210. )
  211. sleep 1
  212. echo
  213. echo "$count_pkg builds total, $count_log completed fine," \
  214. "$count_err with errors."
  215. echo