зеркало из https://github.com/mozilla/pjs.git
allow users to pick the row structure, it can now be uniform times (every 5 minutes)
or it can be one row for each time we have data for.
This commit is contained in:
Родитель
feaaa56f88
Коммит
f2b92bc94f
|
@ -2,8 +2,8 @@
|
|||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
|
||||
# $Revision: 1.26 $
|
||||
# $Date: 2002-04-27 04:59:46 $
|
||||
# $Revision: 1.27 $
|
||||
# $Date: 2002-05-01 02:06:23 $
|
||||
# $Author: kestes%walrus.com $
|
||||
# $Source: /home/jrmuizel/cvs-mirror/mozilla/webtools/tinderbox2/src/bin/tinder.cgi,v $
|
||||
# $Name: $
|
||||
|
@ -164,39 +164,6 @@ EOF
|
|||
|
||||
|
||||
|
||||
# Create the list of times which determine the build table row spacing.
|
||||
# All times are stored in time() format.
|
||||
|
||||
sub construct_times_vec {
|
||||
my ($start_time, $end_time, $table_spacing, ) = @_;
|
||||
|
||||
my (@out) =();
|
||||
|
||||
my ($table_spacing_sec) = $table_spacing*$main::SECONDS_PER_MINUTE;
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
|
||||
localtime($start_time);
|
||||
|
||||
# the first entry is rounded down to nearest 5 minutes
|
||||
|
||||
my $remainder = $min % 5;
|
||||
my ($time) = $start_time - ($remainder*$main::SECONDS_PER_MINUTE) - $sec;
|
||||
|
||||
while ($time > $end_time) {
|
||||
push @out, $time;
|
||||
$time -= $table_spacing_sec;
|
||||
}
|
||||
|
||||
push @out, $time;
|
||||
|
||||
# make the last row twice as wide as the rest to encourage a small
|
||||
# amount of overlap between adjacent pages.
|
||||
|
||||
@out[$#out] -= $table_spacing_sec;
|
||||
|
||||
return [@out];
|
||||
} # construct_times_vec
|
||||
|
||||
|
||||
|
||||
# parse the command line arguments
|
||||
|
||||
|
@ -268,14 +235,7 @@ sub parse_args {
|
|||
( ($daemon_mode) || ($tree) ) ||
|
||||
die("If you are not running in daemon mode you must specify a tree\n");
|
||||
|
||||
# This prevents us from 'loosing' builds between the spaces of the
|
||||
# grid and would cause our rendering algorithm to get off by one
|
||||
# build creating problems in the whole grid display.
|
||||
|
||||
my ($times_vec) = construct_times_vec($start_time, $end_time,
|
||||
$TinderDB::TABLE_SPACING,);
|
||||
|
||||
return ($daemon_mode, $times_vec, $tree,);
|
||||
return ($daemon_mode, $start_time, $end_time, $tree,);
|
||||
} # parse_args
|
||||
|
||||
|
||||
|
@ -284,7 +244,7 @@ sub parse_args {
|
|||
|
||||
sub HTML_status_page {
|
||||
|
||||
my ($times_vec, $tree, ) = @_;
|
||||
my ($start_time, $end_time, $tree, ) = @_;
|
||||
|
||||
my ($status_page_url) = (FileStructure::get_filename($tree, 'tree_URL').
|
||||
"/status.html");
|
||||
|
@ -318,17 +278,15 @@ sub HTML_status_page {
|
|||
|
||||
my (@legend) = TinderDB::status_table_legend($tree);
|
||||
my (@header) = TinderDB::status_table_header($tree);
|
||||
my (@body) = TinderDB::status_table_body($times_vec, $tree);
|
||||
my (@body) = TinderDB::status_table_body($start_time, $end_time, $tree);
|
||||
|
||||
# create the footer links
|
||||
|
||||
my ($max_time_row) = $#{$times_vec};
|
||||
my ($display_time) = $times_vec->[0] - $times_vec->[$max_time_row] ;
|
||||
my ($display_time) = $start_time - $end_time;
|
||||
|
||||
# round the division to the nearest integer.
|
||||
|
||||
my ($display_hours) = sprintf '%d', ($display_time/$main::SECONDS_PER_HOUR);
|
||||
my ($next_date) = $times_vec->[0] - $display_time;
|
||||
|
||||
my ($display_2hours) = min($display_hours*2, $MAX_DISPLAY_HOURS);
|
||||
my ($display_4hours) = min($display_hours*4, $MAX_DISPLAY_HOURS);
|
||||
|
@ -339,7 +297,7 @@ sub HTML_status_page {
|
|||
"href"=>("$FileStructure::URLS{'tinderd'}".
|
||||
"\?".
|
||||
"tree=$tree\&".
|
||||
"start-time=$next_date\&".
|
||||
"start-time=$end_time\&".
|
||||
"display-hours=$display_hours"),
|
||||
).
|
||||
"<br>\n".
|
||||
|
@ -348,7 +306,7 @@ sub HTML_status_page {
|
|||
"href"=>("$FileStructure::URLS{'tinderd'}".
|
||||
"\?".
|
||||
"tree=$tree\&".
|
||||
"start-time=$next_date\&".
|
||||
"start-time=$end_time\&".
|
||||
"display-hours=$display_2hours"),
|
||||
).
|
||||
"<br>\n".
|
||||
|
@ -357,7 +315,7 @@ sub HTML_status_page {
|
|||
"href"=>("$FileStructure::URLS{'tinderd'}".
|
||||
"\?".
|
||||
"tree=$tree\&".
|
||||
"start-time=$next_date\&".
|
||||
"start-time=$end_time\&".
|
||||
"display-hours=$display_4hours"),
|
||||
).
|
||||
"<br>\n".
|
||||
|
@ -366,7 +324,7 @@ sub HTML_status_page {
|
|||
"href"=>("$FileStructure::URLS{'tinderd'}".
|
||||
"\?".
|
||||
"tree=$tree\&".
|
||||
"start-time=$next_date\&".
|
||||
"start-time=$end_time\&".
|
||||
"display-hours=$display_8hours"),
|
||||
).
|
||||
"<br>\n".
|
||||
|
@ -375,6 +333,11 @@ sub HTML_status_page {
|
|||
"href"=>$status_page_url,
|
||||
).
|
||||
"<br><p>\n\n".
|
||||
HTMLPopUp::Link(
|
||||
"linktxt"=>"Regnerate HTML Pages",
|
||||
"href"=>"$FileStructure::URLS{'regenerate'}",
|
||||
).
|
||||
"<br>\n".
|
||||
HTMLPopUp::Link(
|
||||
"linktxt"=>"Administrate this tree ($tree)",
|
||||
"href"=>("$FileStructure::URLS{'admintree'}".
|
||||
|
@ -389,7 +352,7 @@ sub HTML_status_page {
|
|||
"\?".
|
||||
"tree=$tree"),
|
||||
).
|
||||
"<br>\n";
|
||||
"<br>\n";
|
||||
|
||||
$out .= HTMLPopUp::page_header('title'=>"Tinderbox Status Page tree: $tree",
|
||||
'refresh'=>$REFRESH_TIME);
|
||||
|
@ -397,16 +360,19 @@ sub HTML_status_page {
|
|||
$out .= "<!-- /Build Page Headers -->\n\n\n";
|
||||
$out .= "$links\n";
|
||||
$out .= "<br>\n";
|
||||
$out .= HTMLPopUp::Link("name"=>"MOTD",)."\n";
|
||||
$out .= "<!-- Message of the Day -->\n";
|
||||
$out .= $motd;
|
||||
$out .= "<p>\n<!-- /Message of the Day -->\n";
|
||||
$out .= "\n\n";
|
||||
$out .= HTMLPopUp::Link("name"=>"TreeState",)."\n";
|
||||
$out .= "<!-- Tree State -->\n";
|
||||
$out .= "$html_tree_state";
|
||||
$out .= "$html_ignore_builds";
|
||||
$out .= "<!-- Break Times -->\n";
|
||||
$out .= "$break_times<br>\n";
|
||||
$out .= "\n\n";
|
||||
$out .= HTMLPopUp::Link("name"=>"Table",)."\n";
|
||||
$out .= "<!-- Table Header -->\n";
|
||||
$out .= "<table border=1 bgcolor='#FFFFFF' cellspacing=1 cellpadding=1>\n";
|
||||
$out .= "<tr>\n";
|
||||
|
@ -421,6 +387,7 @@ sub HTML_status_page {
|
|||
$out .= "<br>\n";
|
||||
$out .= $previous_links;
|
||||
$out .= "<br>\n";
|
||||
$out .= HTMLPopUp::Link("name"=>"Legend",)."\n";
|
||||
$out .= "<!-- Table Legend -->\n";
|
||||
$out .= "<FONT SIZE=\"+3\"><B><NOBR>Table Legend</NOBR></B></FONT>";
|
||||
$out .= "<table width=\"100%\" cellpadding=0 cellspacing=0>\n";
|
||||
|
@ -443,7 +410,7 @@ sub HTML_status_page {
|
|||
# status pages for all trees.
|
||||
|
||||
sub daemon_main {
|
||||
my ($times_vec, $tree, ) = @_;
|
||||
my ($start_time, $end_time, $tree, ) = @_;
|
||||
|
||||
# If the daemon is still running from last call do not bother
|
||||
# running now. This could cause conflicts on the database.
|
||||
|
@ -467,7 +434,7 @@ sub daemon_main {
|
|||
my ($outfile) = (FileStructure::get_filename($tree, 'tree_HTML').
|
||||
"/status.html");
|
||||
|
||||
my (@out) = HTML_status_page($times_vec, $tree, );
|
||||
my (@out) = HTML_status_page($start_time, $end_time, $tree, );
|
||||
|
||||
overwrite_file($outfile, @out);
|
||||
|
||||
|
@ -508,13 +475,13 @@ sub daemon_main {
|
|||
# saved to disk and we update none of the databases.
|
||||
|
||||
sub cgi_main {
|
||||
my ($times_vec, $tree, ) = @_;
|
||||
my ($start_time, $end_time, $tree, ) = @_;
|
||||
|
||||
TinderDB::loadtree_db($tree);
|
||||
|
||||
print "Content-type: text/html\n\n";
|
||||
|
||||
print HTML_status_page($times_vec, $tree, );
|
||||
print HTML_status_page($start_time, $end_time, $tree, );
|
||||
|
||||
return ;
|
||||
}
|
||||
|
@ -541,14 +508,14 @@ sub write_stats {
|
|||
set_static_vars();
|
||||
get_env();
|
||||
|
||||
my ($daemon_mode, $times_vec, $tree, ) =
|
||||
my ($daemon_mode, $start_time, $end_time, $tree, ) =
|
||||
parse_args();
|
||||
chk_security();
|
||||
|
||||
if ($daemon_mode) {
|
||||
daemon_main($times_vec, $tree, );
|
||||
daemon_main($start_time, $end_time, $tree, );
|
||||
} else {
|
||||
cgi_main($times_vec, $tree,);
|
||||
cgi_main($start_time, $end_time, $tree,);
|
||||
}
|
||||
|
||||
write_stats();
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
# notice board display, build display (colored squares)
|
||||
|
||||
|
||||
# $Revision: 1.7 $
|
||||
# $Date: 2002-04-26 22:05:00 $
|
||||
# $Revision: 1.8 $
|
||||
# $Date: 2002-05-01 02:06:24 $
|
||||
# $Author: kestes%walrus.com $
|
||||
# $Source: /home/jrmuizel/cvs-mirror/mozilla/webtools/tinderbox2/src/lib/TinderDB.pm,v $
|
||||
# $Name: $
|
||||
|
@ -152,6 +152,12 @@ $MAX_UPDATES_SINCE_TRIM = $TinderConfig::DB_MAX_UPDATES_SINCE_TRIM || (50);
|
|||
|
||||
$TRIM_SECONDS = $TinderConfig::DB_TRIM_SECONDS || (60 * 60 * 24 * 8);
|
||||
|
||||
if (defined($TinderConfig::UNIFORM_ROW_SPACING)) {
|
||||
$UNIFORM_ROW_SPACING = $TinderConfig::UNIFORM_ROW_SPACING;
|
||||
} else {
|
||||
$UNIFORM_ROW_SPACING = 1;
|
||||
}
|
||||
|
||||
# The DB implemenations are sourced in TinderConfig.pm just before
|
||||
# this wrapper class is sourced. It is expected that the
|
||||
# implementations will need adjustment and other fiddling so we moved
|
||||
|
@ -170,10 +176,15 @@ $DB = bless(\@TinderDB::HTML_COLUMNS);
|
|||
# the columns. Don't forget that the way to get the DB column names
|
||||
# is:
|
||||
|
||||
# foreach $obj (@{$TinderDB::DB}) {
|
||||
# print ref($obj)."\n";
|
||||
# }
|
||||
sub get_db_column_names {
|
||||
@out = ();
|
||||
|
||||
foreach $obj (@{$TinderDB::DB}) {
|
||||
push @out, ref($obj);
|
||||
}
|
||||
|
||||
return @out;
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------
|
||||
# You should not need to configure anything below this line
|
||||
|
@ -181,6 +192,71 @@ $DB = bless(\@TinderDB::HTML_COLUMNS);
|
|||
|
||||
|
||||
|
||||
# Create a list of uniformly separated times which determine the build
|
||||
# table row spacing. All times are stored in time() format.
|
||||
|
||||
sub construct_uniform_times_vec {
|
||||
my ($start_time, $end_time, $table_spacing, ) = @_;
|
||||
|
||||
my (@out) =();
|
||||
|
||||
my ($table_spacing_sec) = $table_spacing*$main::SECONDS_PER_MINUTE;
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
|
||||
localtime($start_time);
|
||||
|
||||
# the first entry is rounded down to nearest 5 minutes
|
||||
|
||||
my $remainder = $min % 5;
|
||||
my ($time) = $start_time - ($remainder*$main::SECONDS_PER_MINUTE) - $sec;
|
||||
|
||||
while ($time > $end_time) {
|
||||
push @out, $time;
|
||||
$time -= $table_spacing_sec;
|
||||
}
|
||||
|
||||
push @out, $time;
|
||||
|
||||
# make the last row twice as wide as the rest to encourage a small
|
||||
# amount of overlap between adjacent pages.
|
||||
|
||||
@out[$#out] -= $table_spacing_sec;
|
||||
|
||||
return [@out];
|
||||
} # construct_uniform_vec
|
||||
|
||||
|
||||
# Create a list of times, based on when events occurred, which
|
||||
# determine the build table row spacing. All times are stored in
|
||||
# time() format.
|
||||
|
||||
sub construct_event_times_vec {
|
||||
my ($start_time, $end_time, $tree) = @_;
|
||||
my (@out) =();
|
||||
|
||||
if ($DEBUG) {
|
||||
(TreeData::tree_exists($tree)) ||
|
||||
die("TinderDB::loadtree_db(): ".
|
||||
"Tree: $tree, not defined.");
|
||||
}
|
||||
|
||||
foreach $db (@{$DB}) {
|
||||
push @out, $db->event_times_vec(@_);
|
||||
}
|
||||
|
||||
# Round all times to nearest minute, so that we do not get two times
|
||||
# appearing in the time column which display as the same string.
|
||||
# We do however want times which are odd numbers of minutes.
|
||||
|
||||
@out = map { ( $_ - ($_%60) ) } @out;
|
||||
@out = main::uniq(@out);
|
||||
|
||||
# sort numerically descending
|
||||
@out = sort {$b <=> $a} @out ;
|
||||
|
||||
return [@out];
|
||||
} # construct_event_times_vec
|
||||
|
||||
|
||||
# Our functions for database methods just iterate over the available
|
||||
# implementations.
|
||||
|
||||
|
@ -349,24 +425,42 @@ sub status_table_row {
|
|||
|
||||
|
||||
sub status_table_body {
|
||||
my ($row_times, $tree, ) = @_;
|
||||
my ($start_time, $end_time, $tree, ) = @_;
|
||||
|
||||
if ($DEBUG) {
|
||||
( ($row_times) && (scalar(@{$row_times}) > 5 ) ) ||
|
||||
die("TinderDB::status_table_body(): ".
|
||||
"row_times, not defined.");
|
||||
|
||||
(TreeData::tree_exists($tree)) ||
|
||||
die("TinderDB::status_table_body(): ".
|
||||
"Tree: $tree, not defined.");
|
||||
(main::is_time_valid($start_time)) ||
|
||||
die("TinderDB::status_table_body(): ".
|
||||
"start_times, not defined. start_time: $start_time");
|
||||
|
||||
(main::is_time_valid($end_time)) ||
|
||||
die("TinderDB::status_table_body(): ".
|
||||
"end_times, not defined. end_time: $end_time");
|
||||
|
||||
(TreeData::tree_exists($tree)) ||
|
||||
die("TinderDB::status_table_body(): ".
|
||||
"Tree: $tree, not defined.");
|
||||
}
|
||||
|
||||
my @out;
|
||||
# Construct the vector of times which represent the rows. Either we
|
||||
# do this with uniform spacing or by putting one row for each time
|
||||
# we have data for.
|
||||
|
||||
my ($row_times);
|
||||
if ($UNIFORM_ROW_SPACING) {
|
||||
$row_times = construct_uniform_times_vec($start_time, $end_time,
|
||||
$TABLE_SPACING,);
|
||||
} else {
|
||||
$row_times = construct_event_times_vec($start_time, $end_time,
|
||||
$tree);
|
||||
}
|
||||
|
||||
# We must call html_start before we call html_row.
|
||||
|
||||
TinderDB::status_table_start($row_times, $tree);
|
||||
|
||||
|
||||
# build each row, in order
|
||||
|
||||
my @out;
|
||||
foreach $i (0 .. $#{$row_times}) {
|
||||
my (@row) = TinderDB::status_table_row($row_times, $i, $tree);
|
||||
push @out, (
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
# the build was and display a link to the build log.
|
||||
|
||||
|
||||
# $Revision: 1.36 $
|
||||
# $Date: 2002-04-27 04:55:33 $
|
||||
# $Revision: 1.37 $
|
||||
# $Date: 2002-05-01 02:06:26 $
|
||||
# $Author: kestes%walrus.com $
|
||||
# $Source: /home/jrmuizel/cvs-mirror/mozilla/webtools/tinderbox2/src/lib/TinderDB/Build.pm,v $
|
||||
# $Name: $
|
||||
|
@ -466,6 +466,40 @@ sub trim_db_history {
|
|||
|
||||
|
||||
|
||||
# return a list of all the times where an even occured.
|
||||
|
||||
sub event_times_vec {
|
||||
my ($self, $start_time, $end_time, $tree) = (@_);
|
||||
|
||||
my @times;
|
||||
|
||||
my @build_names = build_names($tree);
|
||||
foreach $buildname (@build_names) {
|
||||
my ($num_recs) = $#{ $DATABASE{$tree}{$buildname}{'recs'} };
|
||||
foreach $i (0 .. $num_recs) {
|
||||
|
||||
my $rec = $DATABASE{$tree}{$buildname}{'recs'}[$i];
|
||||
push @times, $rec->{'starttime'};
|
||||
push @times, $rec->{'endtime'};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
# sort numerically descending
|
||||
@times = sort {$b <=> $a} @times;
|
||||
|
||||
my @out;
|
||||
foreach $time (@times) {
|
||||
($time <= $start_time) || next;
|
||||
($time <= $end_time) && last;
|
||||
push @out, $time;
|
||||
}
|
||||
|
||||
return @out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub status_table_legend {
|
||||
my ($out)='';
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче