1998-06-16 21:43:24 +00:00
|
|
|
#!/usr/bonsaitools/bin/perl --
|
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
|
|
|
#
|
|
|
|
# The contents of this file are subject to the Netscape Public License
|
|
|
|
# Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
# compliance with the License. You may obtain a copy of the License at
|
|
|
|
# http://www.mozilla.org/NPL/
|
|
|
|
#
|
|
|
|
# Software distributed under the License is distributed on an "AS IS"
|
|
|
|
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing rights and limitations
|
|
|
|
# under the License.
|
|
|
|
#
|
|
|
|
# The Original Code is the Tinderbox build tool.
|
|
|
|
#
|
|
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
|
|
|
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
|
|
|
# Netscape Communications Corporation. All Rights Reserved.
|
|
|
|
|
|
|
|
use lib "../bonsai";
|
1998-08-25 21:22:32 +00:00
|
|
|
use Fcntl;
|
1998-06-16 21:43:24 +00:00
|
|
|
|
1999-07-23 19:36:38 +00:00
|
|
|
require "tbglobals.pl";
|
1998-06-16 21:43:24 +00:00
|
|
|
require 'lloydcgi.pl';
|
|
|
|
|
1999-07-06 22:35:00 +00:00
|
|
|
if (defined($args = $form{log})) {
|
|
|
|
|
|
|
|
($tree, $logfile) = split /\//, $args;
|
|
|
|
|
|
|
|
my $br = find_build_record($tree, $logfile);
|
|
|
|
$errorparser = $br->{errorparser};
|
|
|
|
$buildname = $br->{buildname};
|
|
|
|
$buildtime = $br->{buildtime};
|
|
|
|
} else {
|
|
|
|
$tree = $form{'tree'};
|
|
|
|
$logfile = $form{'logfile'};
|
|
|
|
$errorparser = $form{'errorparser'};
|
|
|
|
$buildname = $form{'buildname'};
|
|
|
|
$buildtime = $form{'buildtime'};
|
|
|
|
}
|
|
|
|
|
1998-06-16 21:43:24 +00:00
|
|
|
$enc_buildname = &url_encode($buildname);
|
1999-07-06 22:35:00 +00:00
|
|
|
|
1998-06-16 21:43:24 +00:00
|
|
|
$note = $form{'note'};
|
1999-07-06 22:35:00 +00:00
|
|
|
$who = $form{'who'};
|
|
|
|
|
1998-06-16 21:43:24 +00:00
|
|
|
$now = time;
|
|
|
|
$now_str = &print_time($now);
|
|
|
|
|
|
|
|
$|=1;
|
|
|
|
|
1998-08-25 21:22:32 +00:00
|
|
|
if( -r "$tree/ignorebuilds.pl" ){
|
|
|
|
require "$tree/ignorebuilds.pl";
|
|
|
|
}
|
|
|
|
|
1999-04-22 21:02:48 +00:00
|
|
|
print "Content-Type:text/html\n";
|
|
|
|
if ($ENV{"REQUEST_METHOD"} eq 'POST' && defined($form{'note'})) {
|
|
|
|
# Expire the cookie 5 months from now
|
|
|
|
print "Set-Cookie: email=$form{who}; expires="
|
|
|
|
. toGMTString(time + 86400 * 152) . "; path=/\n";
|
|
|
|
}
|
|
|
|
print "\n<HTML>\n";
|
1998-06-16 21:43:24 +00:00
|
|
|
|
|
|
|
if( $url = $form{"note"} ){
|
|
|
|
|
1998-08-25 21:22:32 +00:00
|
|
|
$note =~ s/\&/&/gi;
|
|
|
|
$note =~ s/\</</gi;
|
|
|
|
$note =~ s/\>/>/gi;
|
1998-06-16 21:43:24 +00:00
|
|
|
$enc_note = url_encode( $note );
|
1999-06-04 22:56:36 +00:00
|
|
|
|
1998-06-16 21:43:24 +00:00
|
|
|
open( NOTES,">>$tree/notes.txt");
|
1998-08-25 21:22:32 +00:00
|
|
|
flock(NOTES, LOCK_EX);
|
|
|
|
print NOTES "$buildtime|$buildname|$who|$now|$enc_note\n";
|
|
|
|
|
|
|
|
&LoadBuildTable;
|
|
|
|
|
|
|
|
foreach $element (keys %form) {
|
|
|
|
|
|
|
|
if(exists ${$build_name_index}{$element}) {
|
|
|
|
print NOTES "${$build_name_index}{$element}|$element|$who|$now|$enc_note\n";
|
|
|
|
} #EndIf
|
|
|
|
} #Endforeach
|
1998-06-16 21:43:24 +00:00
|
|
|
close(NOTES);
|
1998-08-25 21:22:32 +00:00
|
|
|
|
1998-06-16 21:43:24 +00:00
|
|
|
print "<H1>The following comment has been added to the log</h1>\n";
|
|
|
|
|
|
|
|
#print "$buildname \n $buildtime \n $errorparser \n $logfile \n $tree \n $enc_buildname \n";
|
|
|
|
print "<pre>\n[<b>$who - $now_str</b>]\n$note\n</pre>";
|
|
|
|
|
|
|
|
print"
|
|
|
|
<p><a href=\"showlog.cgi?tree=$tree\&buildname=$enc_buildname\&buildtime=$buildtime\&logfile=$logfile\&errorparser=$errorparser\">
|
|
|
|
Go back to the Error Log</a>
|
|
|
|
<a href=\"showbuilds.cgi?tree=$tree\">
|
1998-08-25 21:22:32 +00:00
|
|
|
<br>Go back to the build Page</a>";
|
|
|
|
|
1999-06-04 22:56:36 +00:00
|
|
|
# Build tinderbox static pages
|
|
|
|
$ENV{QUERY_STRING}="tree=$tree&static=1";
|
|
|
|
$ENV{REQUEST_METHOD}="GET";
|
|
|
|
system './showbuilds.cgi >/dev/null';
|
|
|
|
|
1998-08-25 21:22:32 +00:00
|
|
|
} else {
|
|
|
|
|
1999-07-06 22:35:00 +00:00
|
|
|
&GetBuildNameIndex;
|
1998-08-25 21:22:32 +00:00
|
|
|
|
1999-07-06 22:35:00 +00:00
|
|
|
@names = sort (keys %$build_name_index);
|
1998-08-25 21:22:32 +00:00
|
|
|
|
1999-07-06 22:35:00 +00:00
|
|
|
if ($buildname eq '' || $buildtime == 0) {
|
|
|
|
print "<h1>Invalid parameters</h1>\n";
|
|
|
|
die "\n";
|
|
|
|
}
|
1998-06-16 21:43:24 +00:00
|
|
|
|
|
|
|
#print "$buildname \n $buildtime \n $errorparser \n $logfile \n $tree \n $enc_buildname \n";
|
|
|
|
|
1999-04-22 21:02:48 +00:00
|
|
|
$emailvalue = '';
|
|
|
|
$emailvalue = " value='$cookie_jar{email}'" if defined($cookie_jar{email});
|
|
|
|
|
|
|
|
print qq(
|
1999-02-12 21:29:53 +00:00
|
|
|
<head><title>Add a Comment to $buildname log</title></head>
|
|
|
|
<body BGCOLOR="#FFFFFF" TEXT="#000000"LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
|
1998-06-16 21:43:24 +00:00
|
|
|
|
1999-02-12 21:29:53 +00:00
|
|
|
<table><tr><td>
|
|
|
|
<b><font size="+2">Add a Log Comment</font></b>
|
|
|
|
</td></tr><tr><td>
|
|
|
|
<b><code>$buildname</code></b>
|
|
|
|
</td></tr></table>
|
1998-06-16 21:43:24 +00:00
|
|
|
|
1999-02-17 21:56:14 +00:00
|
|
|
<form action='addnote.cgi' METHOD='post'>
|
|
|
|
|
1998-06-16 21:43:24 +00:00
|
|
|
<INPUT Type='hidden' name='buildname' value='${buildname}'>
|
|
|
|
<INPUT Type='hidden' name='buildtime' value='${buildtime}'>
|
|
|
|
<INPUT Type='hidden' name='errorparser' value='$errorparser'>
|
|
|
|
<INPUT Type='hidden' name='logfile' value='$logfile'>
|
1999-02-12 21:29:53 +00:00
|
|
|
<INPUT Type='hidden' name='tree' value='$tree'>
|
1998-08-25 21:22:32 +00:00
|
|
|
|
1999-02-12 21:29:53 +00:00
|
|
|
<table border=0 cellpadding=4 cellspacing=1>
|
|
|
|
<tr valign=top>
|
|
|
|
<td align=right>
|
|
|
|
<NOWRAP>Email address:</NOWRAP>
|
|
|
|
</td><td>
|
1999-04-22 21:02:48 +00:00
|
|
|
<INPUT Type='input' name='who' size=32$emailvalue><BR>
|
1999-02-12 21:29:53 +00:00
|
|
|
</td>
|
|
|
|
</tr><tr valign=top>
|
|
|
|
<td align=right>
|
|
|
|
Comment:
|
|
|
|
</td><td>
|
1999-04-22 19:52:23 +00:00
|
|
|
<TEXTAREA NAME=note ROWS=10 COLS=30 WRAP=HARD></textarea>
|
1999-02-12 21:29:53 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
1999-02-18 20:13:30 +00:00
|
|
|
<br><b><font size="+2">Addition Builds</font></b><br>
|
|
|
|
(Comment will be added to the most recent cycle.)<br>
|
1999-02-12 21:29:53 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
for $other_build (@names){
|
|
|
|
if( $other_build ne "" ){
|
|
|
|
|
|
|
|
if (not exists ${$ignore_builds}{$other_build}) {
|
1999-02-18 20:13:30 +00:00
|
|
|
if( $other_build ne $buildname ){
|
1999-02-12 21:31:03 +00:00
|
|
|
print "<INPUT TYPE=checkbox NAME=\"$other_build\">";
|
1999-02-18 20:13:30 +00:00
|
|
|
print "$other_build<BR>\n";
|
1999-02-12 21:31:03 +00:00
|
|
|
}
|
1999-02-12 21:29:53 +00:00
|
|
|
} #EndIf
|
1998-08-25 21:22:32 +00:00
|
|
|
}
|
|
|
|
} #Endfor
|
|
|
|
|
1999-02-12 21:29:53 +00:00
|
|
|
print "<INPUT Type='submit' name='submit' value='Add Comment'><BR>
|
1998-08-25 21:22:32 +00:00
|
|
|
</form>\n</body>\n</html>";
|
1998-06-16 21:43:24 +00:00
|
|
|
}
|
1998-08-25 21:22:32 +00:00
|
|
|
|
|
|
|
sub GetBuildNameIndex {
|
|
|
|
local($mailtime, $buildtime, $buildname, $errorparser, $buildstatus, $logfile, $binaryname);
|
|
|
|
|
|
|
|
open(BUILDLOG, "$tree/build.dat") or die "Couldn't open build.dat: $!\n";
|
|
|
|
|
|
|
|
while(<BUILDLOG>) {
|
|
|
|
chomp;
|
|
|
|
($mailtime, $buildtime, $buildname, $errorparser, $buildstatus, $logfile, $binaryname) =
|
|
|
|
split( /\|/ );
|
|
|
|
|
|
|
|
$build_name_index->{$buildname} = 0;
|
|
|
|
|
|
|
|
} #EndWhile
|
|
|
|
close(BUILDLOG);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub LoadBuildTable {
|
|
|
|
local($mailtime, $buildtime, $buildname, $errorparser, $buildstatus, $logfile, $binaryname);
|
|
|
|
|
|
|
|
open(BUILDLOG, "$tree/build.dat") or die "Couldn't open build.dat: $!\n";
|
|
|
|
|
|
|
|
while(<BUILDLOG>) {
|
|
|
|
chomp;
|
|
|
|
($mailtime, $buildtime, $buildname, $errorparser, $buildstatus, $logfile, $binaryname) =
|
|
|
|
split( /\|/ );
|
|
|
|
|
|
|
|
if ($buildtime > $build_name_index->{$buildname} ) {
|
|
|
|
$build_name_index->{$buildname} = $buildtime;
|
|
|
|
}
|
|
|
|
|
|
|
|
} #EndWhile
|
|
|
|
close(BUILDLOG);
|
|
|
|
|
|
|
|
}
|
|
|
|
|