Fixed references to misc/archive/ in lib/misc
[opensde-nopast.git] / lib / misc / RegressionsReport.sh
blobce5f102bcc9eea6ec18443a24ab9de7f6eedfada
1 #!/bin/bash
2 # --- SDE-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 #
5 # Filename: lib/misc/RegressionsReport.sh
6 # Copyright (C) 2006 - 2008 The OpenSDE Project
7 # Copyright (C) 2004 - 2006 The T2 SDE Project
8 #
9 # More information can be found in the files COPYING and README.
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; version 2 of the License. A copy of the
14 # GNU General Public License can be found in the file COPYING.
15 # --- SDE-COPYRIGHT-NOTE-END ---
16 config=default
17 TARGET=regressions
18 revision=`svn info | sed -n 's,^Revision: \(.*\),\1,p'`
20 if [ "$1" == "-cfg" ]; then
21 config="$2"; shift 2
24 eval `grep '^export SDECFG_ID=' config/$config/config`
26 if [ -z "$SDECFG_ID" ]; then
27 echo "Invalid config '$cfg'."
28 exit 1
31 mkdir -p $TARGET
33 echo "[$( date +%T )] Auditing '$config' to '$TARGET/' ..."
34 sh lib/misc/AuditBuild.sh -w $TARGET -cfg $config --no-enabled-too -repository package/* \
35 | grep '\(CHANGED\|UPDATED\|ADDED\|FAILED\|PENDING\|DISABLED\)' > $TARGET/regressions.$config.$$
36 echo "[$( date +%T )] Auditing completed."
38 if [ ! -d $TARGET/$config ]; then
39 echo "Something weird happened running AuditBuild.sh. $TARGET/$config was not created."
40 exit 1
43 echo "[$( date +%T )] Rendering report..."
46 cat <<EOT
47 <html>
48 <head><title>OpenSDE $revision - $( date )</title></head>
49 <body>
50 <table border="0">
51 <tr><th colspan="2">$SDECFG_ID ($revision)</th></tr>
52 <tr><td valign="top">
53 <table border="1" cellspacing="0" width="100%">
54 <tr><td>revision</td><td>:</td><td>$revision</td></tr>
55 <tr><td>config</td><td>:</td><td>
56 EOT
58 mkdir -p $TARGET/$config/config
59 for x in config/$config/*; do
60 cp $x $TARGET/$config/${x##config/$config/}.txt
61 echo -e "\t\t<a href=\"${x##config/$config/}.txt\">${x##config/$config/}</a><br />"
62 done
64 pkgenabled=$( grep '^X' config/$config/packages | wc -l )
65 pkgdisabled=$( grep '^O' config/$config/packages | wc -l )
66 pkgtotal=$( ls -1 package/*/*/*.desc | wc -l )
67 cat <<EOT
68 </td></tr>
69 <tr><td>Enabled</td><td>:</td><td>$pkgenabled</td></tr>
70 <tr><td>Disabled</td><td>:</td><td>$pkgdisabled</td></tr>
71 <tr><td>Hidden</td><td>:</td><td>$( expr $pkgtotal - $pkgenabled - $pkgdisabled )</td></tr>
72 <tr><td>Total</td><td>:</td><td>$pkgtotal</td></tr>
73 </table>
74 <br />
75 EOT
78 pattern="^X "
79 pkgtotal=0 pkgerr=0 pkgok=0
80 for stagelevel in 0 1 2 3 4 5 6 7 8 9; do
81 while read x x x repo pkg x; do
82 (( pkgtotal++ ))
83 if [ -f build/$SDECFG_ID/var/adm/logs/$stagelevel-$pkg.err ]; then
84 (( pkgerr++ ))
85 cat <<EOT
86 <tr><td>$stagelevel</td><td><a href="log/$stagelevel-$pkg.err.txt">$repo/$pkg</a></td></tr>
87 EOT
88 elif [ -f build/$SDECFG_ID/var/adm/logs/$stagelevel-$pkg.log ]; then
89 (( pkgok++ ))
91 done < <( grep -e "$pattern$stagelevel.*" config/$config/packages )
92 pattern="$pattern."
93 done
94 } > $TARGET/regressions.$config.$$-2
96 cat <<EOT
97 <table border="1" cellspacing="0" width="100%">
98 <tr><td>Total</td><td>:</td><td align="right">$pkgtotal</td></tr>
99 <tr><td>Built Fine</td><td>:</td><td align="right">$pkgok</td></tr>
100 <tr><td>Broken Builds</td><td>:</td><td align="right">$pkgerr</td></tr>
101 <tr><td>Pending Builds</td><td>:</td><td align="right">$( expr $pkgtotal - $pkgok - $pkgerr )</td></tr>
102 </table>
103 <br />
104 <table border="1" cellspacing="0" width="100%">
105 <tr><th colspan="2">Failed Builds</th></tr>
106 $( cat $TARGET/regressions.$config.$$-2 )
107 </table>
108 </td><td>
109 <table>
110 <tr><th>Package</th><th>SVN Status</th><th>Version</th><th>Audit</th><th>Status</th></tr>
113 grep -v DISABLED $TARGET/regressions.$config.$$
115 cat <<EOT
116 </table><hr><table>
117 <tr><th>Package</th><th>SVN Status</th><th>Version</th><th>Audit</th><th>Status</th></tr>
120 grep DISABLED $TARGET/regressions.$config.$$
122 cat <<EOT
123 </table></td></tr>
124 </table></body>
125 </html>
127 } > $TARGET/regressions.$config.html
129 echo "[$( date +%T )] Rendering finished."
131 rm -f $TARGET/regressions.$config.$$ $TARGET/regressions.$config.$$-2
132 mv -f $TARGET/regressions.$config.html $TARGET/$config/index.html