[LOSTWAGES] service.cgi - error handling
Brian Vincent
vinn at theshell.com
Wed Apr 7 01:25:13 CDT 2004
Newman -
Let's wait until you have some time to go over this
one. None of this is needed right now and I'm not
so sure it'll actually work.
Changelog:
Handle error reporting originating from winrash clients.
Index: service.cgi
===================================================================
RCS file: /home/wine/tools/winetest/service.cgi,v
retrieving revision 1.8
diff -u -r1.8 service.cgi
--- service.cgi 6 Apr 2004 21:05:10 -0000 1.8
+++ service.cgi 7 Apr 2004 06:20:45 -0000
@@ -20,11 +20,12 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# We expect our input to be one of two things:
+# We expect our input to be one of three things:
# - publish a new file for clients to download
# ?publish=winetest&url=http://myserver.com/path/to/current-winetest.exe
# - a request to download that looks like:
# ?winrash=1&cookie_name1=cookie_value1&cookie_name2=cookie_value2...
+# - an error report to be emailed to wine-tests-results at winehq.org
#
# We rely on the server to have directories available for every
# program that can be published. For example, we need a winetest directory:
@@ -40,7 +41,7 @@
use Date::Calc qw(Delta_DHMS);
use Digest::MD5;
-$hour_we_do_build = "2"; # hour, such as 2 or 17, in localtime, rounded up
+$hour_we_do_build = "5"; # hour, such as 2 or 17, in localtime, rounded up
$path_to_test_directories="/home/winehq/opt/winetest/";
$path_to_builds_txt="/home/winehq/opt/winetest/builds.txt";
$path_to_lynx="/usr/bin/lynx";
@@ -53,6 +54,14 @@
print "Content-type: text/plain\n\n";
%data_received = &User_Data;
+
+ if ($ENV{"REQUEST_URI"} =~ "error=true" &&
+ $ENV{"REQUEST_METHOD"} eq "POST") {
+ &email_error_log;
+ print "OK\n";
+ exit;
+ }
+
&get_all_cookies;
if ($data_received{"publish"}) {
@@ -191,7 +200,11 @@
$local_filename = $_[0] . "-". $formatted_date;
}
+ print "error_url http://test.winehq.org\n";
+ print "error_sleep $sleeptime\n";
+
print "download $local_filename $this_url\n";
+ print "download $local_filename.sig $this_url.sig\n";
if ($_[0] eq "winrash") {
print "fork $local_filename\n";
@@ -227,6 +240,26 @@
close(BUILDS_FH);
}
+sub email_error_log {
+
+ open(MAIL,"|/usr/lib/sendmail -t");
+ print MAIL "To: wine-tests-results\@winehq.org\n";
+ print MAIL "From: servicecgi at winehq.org\n";
+ print MAIL "Subject: winetest error report\n";
+ print MAIL "\n";
+
+ # Not really sure how the data will look, but at this point we
+ # know there's an error, so just cycle through everything we've
+ # got and flush it out.
+
+ foreach $key (sort keys(%data_received)) {
+ foreach (split(" : ", $data_received{$key})) {
+ $error_string .= "$_ \n";
+ }
+ }
+ print MAIL "$error_string \n\n";
+ close(MAIL);
+}
##########################################################################
#
@@ -258,7 +291,7 @@
}
my $waittime = ($diffdays * 24 * 60) + ($diffhour * 60) + $diffmin;
- my $randwait = int ( rand(60));
+ my $randwait = int ( rand(60) );
return (($waittime + $randwait) * 60);
}
@@ -299,7 +332,7 @@
local (%user_data, $user_string, $name_value_pair, @name_value_pairs,
$name, $value);
- if ($ENV{'REQUEST_METHOD'} eq "POST") {
+ if ($ENV{"REQUEST_METHOD"} eq "POST") {
read(STDIN,$user_string,$ENV{'CONTENT_LENGTH'});
}
else {
More information about the wine-patches
mailing list