diff --git a/webtools/tinderbox2/src/lib/Summaries.pm b/webtools/tinderbox2/src/lib/Summaries.pm index 851aa94f0631..d54de707d2e3 100644 --- a/webtools/tinderbox2/src/lib/Summaries.pm +++ b/webtools/tinderbox2/src/lib/Summaries.pm @@ -8,8 +8,8 @@ # The only external interface to this library is summary_pages() and # create_global_index() these functions are only called by tinder.cgi. -# $Revision: 1.12 $ -# $Date: 2003/01/19 17:22:07 $ +# $Revision: 1.13 $ +# $Date: 2003/04/20 00:52:44 $ # $Author: kestes%walrus.com $ # $Source: /home/hwine/cvs_conversion/cvsroot/mozilla/webtools/tinderbox2/src/lib/Summaries.pm,v $ # $Name: $ @@ -78,6 +78,7 @@ sub summary_pages { # ugly and nearly all of these are used by every summary function. @LATEST_STATUS = TinderDB::Build::latest_status($tree); + @LATEST_ERRS = TinderDB::Build::latest_errors($tree); @BUILD_NAMES = TinderDB::Build::build_names($tree); @HTML_COLORS = BuildStatus::status2html_colors(@LATEST_STATUS); @@ -86,6 +87,9 @@ sub summary_pages { $TREE = $tree; $TREE_STATE = TinderHeader::gettree_header('TreeState', $tree); $HTML_TIME = HTMLPopUp::timeHTML($main::TIME); + $DISPLAY_BUILD_ERRORS = + ( defined($TinderConfig::DISPLAY_BUILD_ERRORS) && + ($TinderConfig::DISPLAY_BUILD_ERRORS) ); $REFRESH_TIME = $refresh_time; @@ -396,7 +400,13 @@ EOF for ($i=0; $i <= $#BUILD_NAMES; $i++) { my ($buildname) = $BUILD_NAMES[$i]; my ($color) = $HTML_COLORS[$i]; - $body .= "\t\t$buildname\n"; + $body .= "\t\t$buildname\n"; + if ($DISPLAY_BUILD_ERRORS) { + my ($errs) = $LATEST_ERRS[$i]; + $body .= " errs: $errs"; + } + $body .= "\n"; + } $body .= "\t\n"; @@ -438,7 +448,12 @@ sub panel { for ($i=0; $i <= $#BUILD_NAMES; $i++) { my ($buildname) = $BUILD_NAMES[$i]; my ($color) = $HTML_COLORS[$i]; - $body .= "\t\t$buildname\n"; + $body .= "\t\t$buildname"; + if ($DISPLAY_BUILD_ERRORS) { + my ($errs) = $LATEST_ERRS[$i]; + $body .= "errs: $errs"; + } + $body .= "\n"; } $body .= "\t\n"; @@ -470,7 +485,12 @@ sub jspanel { for ($i=0; $i <= $#BUILD_NAMES; $i++) { my ($buildname) = $BUILD_NAMES[$i]; my ($color) = $HTML_COLORS[$i]; - $body .= "\t\t$buildname\n"; + $body .= "\t\t$buildname"; + if ($DISPLAY_BUILD_ERRORS) { + my ($errs) = $LATEST_ERRS[$i]; + $body .= "errs: $errs"; + } + $body .= ""; } $body .= ""; @@ -490,13 +510,22 @@ sub quickparse { $header = "
\n";
 
-  $body .= "State|$TREE|$TREE|$TREE_STATE\n";
+  $body .= "State|$TREE|$TREE|$TREE_STATE";
+  if ($DISPLAY_BUILD_ERRORS) {
+    $body .= "|Errs";
+  }
+  $body .= "\n";
   
-    for ($i=0; $i <= $#BUILD_NAMES; $i++) {
-      my ($buildname) = $BUILD_NAMES[$i];
-      my ($status) = $LATEST_STATUS[$i];
-      $body .= "Build|$TREE|$buildname|$status\n";
+  for ($i=0; $i <= $#BUILD_NAMES; $i++) {
+    my ($buildname) = $BUILD_NAMES[$i];
+    my ($status) = $LATEST_STATUS[$i];
+    $body .= "Build|$TREE|$buildname|$status";
+    if ($DISPLAY_BUILD_ERRORS) {
+      my ($errs) = $LATEST_ERRS[$i];
+      $body .= "|" . $errs;
     }
+    $body .= "\n";
+  }
 
   $footer = "\n";
   $extension = 'html';
diff --git a/webtools/tinderbox2/src/lib/TinderDB/Build.pm b/webtools/tinderbox2/src/lib/TinderDB/Build.pm
index 2f189247f71f..fd0ea56825bc 100755
--- a/webtools/tinderbox2/src/lib/TinderDB/Build.pm
+++ b/webtools/tinderbox2/src/lib/TinderDB/Build.pm
@@ -7,8 +7,8 @@
 # the build was and display a link to the build log.
 
 
-# $Revision: 1.59 $ 
-# $Date: 2003/04/20 00:32:05 $ 
+# $Revision: 1.60 $ 
+# $Date: 2003/04/20 00:52:46 $ 
 # $Author: kestes%walrus.com $ 
 # $Source: /home/hwine/cvs_conversion/cvsroot/mozilla/webtools/tinderbox2/src/lib/TinderDB/Build.pm,v $ 
 # $Name:  $ 
@@ -267,6 +267,52 @@ sub latest_status {
   return @outrow;
 }
 
+# return find the most recent error count for each build of this tree
+
+sub latest_errors {
+  my ($tree) = (@_);
+  
+  if (!($DISPLAY_BUILD_ERRORS)) {
+      # We're not collecting error status, return indication of that
+      return ();
+  }
+
+  my (@outrow) = ();
+  my (@build_names) = build_names($tree);
+
+  foreach $buildname (@build_names) {
+
+      my ($last_err);
+      foreach $db_index (0 .. $#{ $DATABASE{$tree}{$buildname}{'recs'} }) {
+      
+        my ($rec) = $DATABASE{$tree}{$buildname}{'recs'}[$db_index];
+        my ($builderrs) = $rec->{'errors'};
+        my ($buildstatus) = $rec->{'status'};
+      
+        (BuildStatus::is_status_final($buildstatus))  ||
+          next;
+
+        $last_err = $builderrs;
+        last;
+      } # foreach $db_index
+
+      if ($last_err) {
+        push @outrow, $last_err;
+      } else {
+
+        # If we really have no data try and get 
+        # 'not running'/'in progress' information
+
+        my ($rec) = $DATABASE{$tree}{$buildname}{'recs'}[0];
+        push @outrow, $rec->{'errors'};
+      }
+
+  } # foreach $buildname
+
+  return @outrow;
+}
+
+
 
 # where can people attach notices to?
 # Really this is the names the columns produced by this DB