2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # T2 SDE: misc/archive/AuditBuild.sh
6 # Copyright (C) 2004 - 2005 The T2 SDE Project
8 # More information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
16 MATRIX
=http
://www.t2-project.org
/packages
27 usage: $0 [-v] [-cfg <config>] [--no-enabled-too] [-repository <repositories>]
31 while [ $# -gt 0 ]; do
33 -cfg) config
="$2"; shift ;;
35 -w) HTMLDIR
="$2"; shift ;;
36 --help) show_usage
; exit 1 ;;
37 -R) root
="$2"; shift ;;
41 shift; repositories
="$*"
43 *) show_usage
; exit 2 ;;
48 if [ ! -f config
/$config/packages
]; then
49 echo "ERROR: '$config' is not a valid config"
53 eval `grep 'SDECFG_ID=' config/$config/config 2> /dev/null`
55 LOGSDIR
=$root/var
/adm
/logs
57 LOGSDIR
=build
/$SDECFG_ID/var
/adm
/logs
59 if [ -z "$SDECFG_ID" -o ! -d $LOGSDIR ]; then
60 echo "ERROR: 'build/$SDECFG_ID/' is not a valid build root (sandbox)"
64 if [ "$HTMLDIR" ]; then
65 mkdir
-p $HTMLDIR/$config.$$
/{diff,log
}
69 local array
="$1" stage
=
70 while [ "$array" ]; do
73 if [ "$stage" != "-" ]; then
80 local pkg
="$1" repo
="$2" ver
="$3" enabled
="$4"
81 local stages
= svndiff
= oldver
= newver
= lchanges
= stage
=
82 local svnst
= lstatus
= lbuild
= file=
85 svnst
=`svn st package/$repo/$pkg`
87 svndiff
=`svn diff package/$repo/$pkg`
88 if [ "$svndiff" ]; then
90 oldver
=`echo "$svndiff" | grep '^-\[V\]' | cut -d' ' -f2`
91 newver
=`echo "$svndiff" | grep '^+\[V\]' | cut -d' ' -f2`
93 if [ "$oldver" ]; then
94 ver
="$oldver -> $newver"
96 elif [ "$newver" ]; then
100 if [ "$HTMLDIR" ]; then
105 } > $HTMLDIR/$config.$$
/diff
/$pkg.
diff.txt
106 lchanges
="<a href=\"diff/$pkg.diff.txt\">$lchanges</a>"
110 if [ "$enabled" == "O" ]; then
111 for stage
in $stages; do
112 lbuild
="$lbuild NO($stage)"
116 for stage
in $stages; do
117 file=`ls -1 $LOGSDIR/$stage-$pkg.{err,log,out} 2> /dev/null`
121 *.log
) [ "$lstatus" ] || lstatus
=1
122 lbuild
="$lbuild OK($stage)" ;;
123 *.out
) [ "$lstatus" != "2" ] || lstatus
=0
124 lbuild
="$lbuild NO($stage)" ;;
126 if [ "$HTMLDIR" ]; then
127 lbuild
="$lbuild <a href=\"log/$stage-$pkg.err.txt\">ERR($stage)</a>"
128 cp $file $HTMLDIR/$config.$$
/log
/$stage-$pkg.err.txt
130 lbuild
="$lbuild ERR($stage)"
134 lbuild
="$lbuild NO($stage)"
135 [ "$lstatus" ] || lstatus
=0
140 3) lstatus
=DISABLED
;;
142 1) lstatus
=SUCCESSFUL
;;
143 *) lstatus
=PENDING
;;
145 if [ "$HTMLDIR" ]; then
147 <tr><td>package/$repo/<a href="$MATRIX/$pkg.html" name="$pkg">$pkg</a></td><td>$lchanges</td><td>(${ver//>/>})</td><td>$lbuild</td><td>$lstatus</td></tr>
150 echo -e "package/$repo/$pkg\t$lchanges\t($ver)\t$lbuild\t$lstatus"
154 if [ "$HTMLDIR" ]; then
157 <head><title>Audit Build $config over revision $( svn info | grep Revision | cut -d' ' -f2 )</title>
159 $( [ "$repositories" ] && echo "<h3>$repositories</h3>" )
164 <th>Build Status</th>
170 if [ "$repositories" ]; then
171 for repo
in $repositories; do
172 repo
=${repo#package/}; repo
=${repo%/}
173 if [ -d package
/$repo/ ]; then
174 grep -e "^$enabled.* $repo " config
/$config/packages |
while \
175 read e stages x repo pkg ver x
; do
176 audit_package
$pkg $repo $ver $e `expand_stages $stages`
181 grep -e "^$enabled" config
/$config/packages |
while \
182 read e stages x repo pkg ver x
; do
183 audit_package
$pkg $repo $ver $e `expand_stages $stages`
187 if [ "$HTMLDIR" ]; then
190 if [ -d "$HTMLDIR/$config" ]; then
191 mv $HTMLDIR/$config $HTMLDIR/$config.$$
-old
193 mv $HTMLDIR/$config.$$
$HTMLDIR/$config/
194 rm -rf $HTMLDIR/$config.$$
-old