X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=blobdiff_plain;f=results2html;h=4bf398d35c49b9734d92578e3abdc4a6c71f37d2;hp=8f8725f82f3067c85358951d6fb711bb138af7a7;hb=215d09f8d91f75eac208d4945906a959bc508701;hpb=b65ac0f58133c7057bad96b9de7af32e06b6e21c diff --git a/results2html b/results2html index 8f8725f82f..4bf398d35c 100755 --- a/results2html +++ b/results2html @@ -3,20 +3,12 @@ use strict; use warnings; +use File::Spec; use HTML::Entities; open (LOG, '<', "LOG"); -open (INDEX, '>','index.html'); open (LOG_HTML, '>', "log.html"); -print INDEX < - - - - -EOF - print LOG_HTML < @@ -39,41 +31,40 @@ sub read_vars { } return %vars; } - my (%vars) = read_vars ('VARS'); -print INDEX "

Build Properties

\n"; -print INDEX "\n"; -print INDEX "\n"; -foreach my $key (sort (keys (%vars))) { - print INDEX ""; - print INDEX ""; - print INDEX ""; - print INDEX "\n"; -} -print INDEX "
NameValue
", encode_entities ($key), "", encode_entities ($vars{$key}), "
\n"; my (@products); my (@steps); my ($new_page) = 0; +my ($result) = "failure"; +my @dirstack; while () { my $ln = $.; chomp; if (/^ $/) { $new_page = 1; + @dirstack = (); print LOG_HTML "
\n";
 	next;
     }
 
+    if (/Entering directory `(.*)'$/) {
+        push (@dirstack, $1);
+    } elsif (/Leaving directory `(.*)'$/) {
+        pop (@dirstack);
+    }
+
     my $log_class;
     if ($new_page) {
 	$new_page = 0;
 	$log_class = "step";
-	if (my ($product) = /^Saving (.*)$/) {
+	if (my ($name, $product) = /^Saving(?:([^:]*):)?\s+(.*)$/) {
 	    my $href = "$product/index.html";
 	    $href = $product if ! -e $href;
 
 	    my (%p);
+	    $p{NAME} = $name if defined ($name);
 	    $p{PRODUCT} = $product;
 	    $p{HREF} = $href;
 	    $p{LN} = $ln;
@@ -85,12 +76,28 @@ while () {
 	    $s{LN} = $ln;
 	    push (@steps, \%s);
 	}
+	$result = 'success' if $_ eq 'Success';
     } else {
-	if (my ($diagnostic) = /(error|warning):/) {
+	if (my ($diagnostic) = /(error|warning):/i) {
 	    my (%d);
-	    $d{DIAGNOSTIC} = $diagnostic;
+	    $d{DIAGNOSTIC} = lc ($diagnostic);
 	    $d{MESSAGE} = $_;
 	    $d{LN} = $ln;
+
+	    if (@dirstack && (my ($file, $line) = /^([^\s:]+):(\d+):\s/)) {
+		$file = File::Spec->rel2abs ($file, $dirstack[$#dirstack]);
+		my (@path) = grep ($_ ne '' && $_ ne '.', split ('/', $file));
+		for (my $i = 0; $i < $#path; ) {
+		    if ($path[$i + 1] eq '..') {
+			splice (@path, $i, 2);
+		    } else {
+			$i++;
+		    }
+		}
+
+		$d{LINE} = $line;
+		$d{FILE} = join ('/', @path);
+	    }
 	    push (@{$steps[$#steps]{CHILDREN}}, \%d);
 
 	    $log_class = "$diagnostic";
@@ -104,10 +111,35 @@ while () {
     }
 }
 
+open (INDEX, '>','index.html');
+
+print INDEX <
+
+  
+
+
+EOF
+
+print INDEX "

Build ", $vars{"build_number"}, ": $result

\n"; + +print INDEX "

Build Properties

\n"; +print INDEX "\n"; +print INDEX "\n"; +foreach my $key (sort (keys (%vars))) { + print INDEX ""; + print INDEX ""; + print INDEX ""; + print INDEX "\n"; +} +print INDEX "
NameValue
", encode_entities ($key), "", encode_entities ($vars{$key}), "
\n"; + print INDEX "

Build Products

\n"; print INDEX "