X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=results2html;h=a5a7688e5a8b040e534be21267409628eb6f635b;hb=6d7df444997670f97a367b89fab6c0f5d8ecc4fd;hp=abc520d3db5033cad7701e7725f29a09c7113adf;hpb=38fb5346628a7b16e9f2a3d066059539037498bf;p=pspp
diff --git a/results2html b/results2html
index abc520d3db..a5a7688e5a 100755
--- a/results2html
+++ b/results2html
@@ -3,7 +3,15 @@
use strict;
use warnings;
-use HTML::Entities;
+use File::Spec;
+use HTML::Entities qw();
+use URI::Escape;
+
+sub encode_entities {
+ return HTML::Entities::encode_entities($_[0], "<&>'\"");
+}
+
+my $gitweb_url = 'http://benpfaff.org/cgi-bin/gitweb.cgi?p=pspp;a=blob;f=[FILE];hb=[BRANCH]#l[LINE]';
open (LOG, '<', "LOG");
open (LOG_HTML, '>', "log.html");
@@ -11,6 +19,7 @@ open (LOG_HTML, '>', "log.html");
print LOG_HTML <
+
@@ -36,21 +45,31 @@ my (@products);
my (@steps);
my ($new_page) = 0;
my ($result) = "failure";
+my (%dist_files);
+my ($dist_dir);
+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 ($name, $product) = /^Saving(?:([^:]*):)?\s+(.*)$/) {
+ if (my ($name, $product) = /^Saving(?:\s+([^:]*):)?\s+(.*)$/) {
my $href = "$product/index.html";
$href = $product if ! -e $href;
@@ -61,6 +80,19 @@ while () {
$p{LN} = $ln;
push (@products, \%p);
push (@{$steps[$#steps]{CHILDREN}}, \%p);
+
+ if (defined ($name) && $name eq 'source distribution') {
+ open (DIST, '-|', "zcat $product | tar tf -");
+ while (my $line = ) {
+ chomp $line;
+ $line =~ s%^([./])*%%; # Trim leading ./
+ $dist_files{$line} = 1;
+ if (!defined ($dist_dir)) {
+ $dist_dir = (split ('/', $line))[0];
+ }
+ }
+ close (DIST);
+ }
} else {
my (%s);
$s{TITLE} = $_;
@@ -74,6 +106,32 @@ while () {
$d{DIAGNOSTIC} = lc ($diagnostic);
$d{MESSAGE} = $_;
$d{LN} = $ln;
+
+ if (@dirstack && defined ($dist_dir)
+ && (my ($match, $file, $line) = /^(([^\s:]+):(\d+):)/)) {
+ $file = File::Spec->rel2abs ($file, $dirstack[$#dirstack]);
+ my (@path) = grep ($_ ne '' && $_ ne '.', split ('/', $file));
+ for (my $i = 1; $i <= $#path; ) {
+ if ($path[$i] eq '..') {
+ splice (@path, $i - 1, 2);
+ $i-- if $i > 1;
+ } else {
+ $i++;
+ }
+ }
+
+ for (my $i = $#path; $i >= 0; $i--) {
+ if ($path[$i] eq $dist_dir) {
+ my $dist_file = join ('/', @path[$i..$#path]);
+ if (exists ($dist_files{$dist_file})) {
+ $d{MATCH} = length ($match);
+ $d{LINE} = $line;
+ $d{FILE} = $dist_file;
+ }
+ last;
+ }
+ }
+ }
push (@{$steps[$#steps]{CHILDREN}}, \%d);
$log_class = "$diagnostic";
@@ -134,9 +192,23 @@ foreach my $s (@steps) {
foreach my $c (@{$s->{CHILDREN}}) {
if (defined ($c->{DIAGNOSTIC})) {
print INDEX "{DIAGNOSTIC}\">";
- print INDEX "{LN}\">";
- print INDEX encode_entities ($c->{MESSAGE});
- print INDEX "
\n";
+ if (defined ($c->{MATCH})) {
+ my $href = $gitweb_url;
+ $href =~ s/\[FILE\]/uri_escape ($c->{FILE})/ge;
+ $href =~ s/\[LINE\]/$c->{LINE}/g;
+ $href =~ s/\[BRANCH\]/uri_escape ($vars{'dist_commit'})/e;
+
+ print INDEX '';
+ print INDEX encode_entities (substr ($c->{MESSAGE},
+ 0, $c->{MATCH}));
+ print INDEX '';
+ print INDEX encode_entities (substr ($c->{MESSAGE},
+ $c->{MATCH}));
+ } else {
+ print INDEX encode_entities ($c->{MESSAGE});
+ }
+ print INDEX " ", log_link ($c->{LN});
+ print INDEX "
\n";
} else {
print INDEX "→ {HREF}), "\">";
print INDEX encode_entities ($c->{PRODUCT});