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.

133 lines
4.0 KiB

  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.
  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; 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'`
  19. if [ "$1" = "-cfg" ]; then
  20. config="$2"; shift 2
  21. fi
  22. eval `grep '^export SDECFG_ID=' config/$config/config`
  23. if [ -z "$SDECFG_ID" ]; then
  24. echo "Invalid config '$cfg'."
  25. exit 1
  26. fi
  27. mkdir -p $TARGET
  28. echo "[$( date +%T )] Auditing '$config' to '$TARGET/' ..."
  29. sh lib/misc/AuditBuild.sh -w $TARGET -cfg $config --no-enabled-too -repository package/* \
  30. | grep '\(CHANGED\|UPDATED\|ADDED\|FAILED\|PENDING\|DISABLED\)' > $TARGET/regressions.$config.$$
  31. echo "[$( date +%T )] Auditing completed."
  32. if [ ! -d $TARGET/$config ]; then
  33. echo "Something weird happened running AuditBuild.sh. $TARGET/$config was not created."
  34. exit 1
  35. fi
  36. echo "[$( date +%T )] Rendering report..."
  37. {
  38. cat <<EOT
  39. <html>
  40. <head><title>OpenSDE $revision - $( date )</title></head>
  41. <body>
  42. <table border="0">
  43. <tr><th colspan="2">$SDECFG_ID ($revision)</th></tr>
  44. <tr><td valign="top">
  45. <table border="1" cellspacing="0" width="100%">
  46. <tr><td>revision</td><td>:</td><td>$revision</td></tr>
  47. <tr><td>config</td><td>:</td><td>
  48. EOT
  49. mkdir -p $TARGET/$config/config
  50. for x in config/$config/*; do
  51. cp $x $TARGET/$config/${x##config/$config/}.txt
  52. echo -e "\t\t<a href=\"${x##config/$config/}.txt\">${x##config/$config/}</a><br />"
  53. done
  54. pkgenabled=$( grep '^X' config/$config/packages | wc -l )
  55. pkgdisabled=$( grep '^O' config/$config/packages | wc -l )
  56. pkgtotal=$( ls -1 package/*/*/*.desc | wc -l )
  57. cat <<EOT
  58. </td></tr>
  59. <tr><td>Enabled</td><td>:</td><td>$pkgenabled</td></tr>
  60. <tr><td>Disabled</td><td>:</td><td>$pkgdisabled</td></tr>
  61. <tr><td>Hidden</td><td>:</td><td>$( expr $pkgtotal - $pkgenabled - $pkgdisabled )</td></tr>
  62. <tr><td>Total</td><td>:</td><td>$pkgtotal</td></tr>
  63. </table>
  64. <br />
  65. EOT
  66. {
  67. pattern="^X "
  68. pkgtotal=0 pkgerr=0 pkgok=0
  69. for stagelevel in 0 1 2 3 4 5 6 7 8 9; do
  70. while read x x x repo pkg x; do
  71. (( pkgtotal++ ))
  72. if [ -f build/$SDECFG_ID/var/adm/logs/$stagelevel-$pkg.err ]; then
  73. (( pkgerr++ ))
  74. cat <<EOT
  75. <tr><td>$stagelevel</td><td><a href="log/$stagelevel-$pkg.err.txt">$repo/$pkg</a></td></tr>
  76. EOT
  77. elif [ -f build/$SDECFG_ID/var/adm/logs/$stagelevel-$pkg.log ]; then
  78. (( pkgok++ ))
  79. fi
  80. done < <( grep -e "$pattern$stagelevel.*" config/$config/packages )
  81. pattern="$pattern."
  82. done
  83. } > $TARGET/regressions.$config.$$-2
  84. cat <<EOT
  85. <table border="1" cellspacing="0" width="100%">
  86. <tr><td>Total</td><td>:</td><td align="right">$pkgtotal</td></tr>
  87. <tr><td>Built Fine</td><td>:</td><td align="right">$pkgok</td></tr>
  88. <tr><td>Broken Builds</td><td>:</td><td align="right">$pkgerr</td></tr>
  89. <tr><td>Pending Builds</td><td>:</td><td align="right">$( expr $pkgtotal - $pkgok - $pkgerr )</td></tr>
  90. </table>
  91. <br />
  92. <table border="1" cellspacing="0" width="100%">
  93. <tr><th colspan="2">Failed Builds</th></tr>
  94. $( cat $TARGET/regressions.$config.$$-2 )
  95. </table>
  96. </td><td>
  97. <table>
  98. <tr><th>Package</th><th>SVN Status</th><th>Version</th><th>Audit</th><th>Status</th></tr>
  99. EOT
  100. grep -v DISABLED $TARGET/regressions.$config.$$
  101. cat <<EOT
  102. </table><hr><table>
  103. <tr><th>Package</th><th>SVN Status</th><th>Version</th><th>Audit</th><th>Status</th></tr>
  104. EOT
  105. grep DISABLED $TARGET/regressions.$config.$$
  106. cat <<EOT
  107. </table></td></tr>
  108. </table></body>
  109. </html>
  110. EOT
  111. } > $TARGET/regressions.$config.html
  112. echo "[$( date +%T )] Rendering finished."
  113. rm -f $TARGET/regressions.$config.$$ $TARGET/regressions.$config.$$-2
  114. mv -f $TARGET/regressions.$config.html $TARGET/$config/index.html