* updated ksystemlog (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / misc / archive / RegressionsReport.sh
blob26e1c5f18532388c89a4edd114d6a38680f97c7c
1 #!/bin/bash
2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 #
5 # T2 SDE: misc/archive/RegressionsReport.sh
6 # Copyright (C) 2004 - 2005 The T2 SDE Project
7 #
8 # More information can be found in the files COPYING and README.
9 #
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 ---
15 config=default
16 TARGET=regressions
17 revision=`svn info | sed -n 's,^Revision: \(.*\),\1,p'`
19 if [ "$1" == "-cfg" ]; then
20 config="$2"; shift 2
23 eval `grep '^export SDECFG_ID=' config/$config/config`
25 if [ -z "$SDECFG_ID" ]; then
26 echo "Invalid config '$cfg'."
27 exit 1
30 mkdir -p $TARGET
32 echo "[$( date +%T )] Auditing '$config' to '$TARGET/' ..."
33 sh misc/archive/AuditBuild.sh -w $TARGET -cfg $config --no-enabled-too -repository package/* \
34 | grep '\(CHANGED\|UPDATED\|ADDED\|FAILED\|PENDING\|DISABLED\)' > $TARGET/regressions.$config.$$
35 echo "[$( date +%T )] Auditing completed."
37 if [ ! -d $TARGET/$config ]; then
38 echo "Something weird happened running AuditBuild.sh. $TARGET/$config was not created."
39 exit 1
42 echo "[$( date +%T )] Rendering report..."
45 cat <<EOT
46 <html>
47 <head><title>T2 r$revision - $( date )</title></head>
48 <body>
49 <table border="0">
50 <tr><th colspan="2">$SDECFG_ID ($revision)</th></tr>
51 <tr><td valign="top">
52 <table border="1" cellspacing="0" width="100%">
53 <tr><td>revision</td><td>:</td><td>$revision</td></tr>
54 <tr><td>config</td><td>:</td><td>
55 EOT
57 mkdir -p $TARGET/$config/config
58 for x in config/$config/*; do
59 cp $x $TARGET/$config/${x##config/$config/}.txt
60 echo -e "\t\t<a href=\"${x##config/$config/}.txt\">${x##config/$config/}</a><br />"
61 done
63 pkgenabled=$( grep '^X' config/$config/packages | wc -l )
64 pkgdisabled=$( grep '^O' config/$config/packages | wc -l )
65 pkgtotal=$( ls -1 package/*/*/*.desc | wc -l )
66 cat <<EOT
67 </td></tr>
68 <tr><td>Enabled</td><td>:</td><td>$pkgenabled</td></tr>
69 <tr><td>Disabled</td><td>:</td><td>$pkgdisabled</td></tr>
70 <tr><td>Hidden</td><td>:</td><td>$( expr $pkgtotal - $pkgenabled - $pkgdisabled )</td></tr>
71 <tr><td>Total</td><td>:</td><td>$pkgtotal</td></tr>
72 </table>
73 <br />
74 EOT
77 pattern="^X "
78 pkgtotal=0 pkgerr=0 pkgok=0
79 for stagelevel in 0 1 2 3 4 5 6 7 8 9; do
80 while read x x x repo pkg x; do
81 (( pkgtotal++ ))
82 if [ -f build/$SDECFG_ID/var/adm/logs/$stagelevel-$pkg.err ]; then
83 (( pkgerr++ ))
84 cat <<EOT
85 <tr><td>$stagelevel</td><td><a href="log/$stagelevel-$pkg.err.txt">$repo/$pkg</a></td></tr>
86 EOT
87 elif [ -f build/$SDECFG_ID/var/adm/logs/$stagelevel-$pkg.log ]; then
88 (( pkgok++ ))
90 done < <( grep -e "$pattern$stagelevel.*" config/$config/packages )
91 pattern="$pattern."
92 done
93 } > $TARGET/regressions.$config.$$-2
95 cat <<EOT
96 <table border="1" cellspacing="0" width="100%">
97 <tr><td>Total</td><td>:</td><td align="right">$pkgtotal</td></tr>
98 <tr><td>Built Fine</td><td>:</td><td align="right">$pkgok</td></tr>
99 <tr><td>Broken Builds</td><td>:</td><td align="right">$pkgerr</td></tr>
100 <tr><td>Pending Builds</td><td>:</td><td align="right">$( expr $pkgtotal - $pkgok - $pkgerr )</td></tr>
101 </table>
102 <br />
103 <table border="1" cellspacing="0" width="100%">
104 <tr><th colspan="2">Failed Builds</th></tr>
105 $( cat $TARGET/regressions.$config.$$-2 )
106 </table>
107 </td><td>
108 <table>
109 <tr><th>Package</th><th>SVN Status</th><th>Version</th><th>Audit</th><th>Status</th></tr>
112 grep -v DISABLED $TARGET/regressions.$config.$$
114 cat <<EOT
115 </table><hr><table>
116 <tr><th>Package</th><th>SVN Status</th><th>Version</th><th>Audit</th><th>Status</th></tr>
119 grep DISABLED $TARGET/regressions.$config.$$
121 cat <<EOT
122 </table></td></tr>
123 </table></body>
124 </html>
126 } > $TARGET/regressions.$config.html
128 echo "[$( date +%T )] Rendering finished."
130 rm -f $TARGET/regressions.$config.$$ $TARGET/regressions.$config.$$-2
131 mv -f $TARGET/regressions.$config.html $TARGET/$config/regressions.html