From: Ben Pfaff Date: Thu, 18 Feb 2010 05:33:35 +0000 (-0800) Subject: work on pointing error messages to source files X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=ec687b924f4a605bc8c2bc441105f47757a7c6cf;hp=90ef37bd9c3b35a462364e14a087ae507ff10834;p=pspp work on pointing error messages to source files --- diff --git a/build-pspp b/build-pspp index d8e4a794cb..6d13ccbf48 100755 --- a/build-pspp +++ b/build-pspp @@ -252,6 +252,10 @@ EOF my $tarname = "pspp-$version.tar.gz"; $tarball = save_result ("source distribution", "pspp$build_number/_build/$tarname", 1); + # Save distributed files in Git. + start_step ("Save distributed files in Git"); + run ("GIT_DIR=$topdir/.git $topdir/git-import-tar $resultsdir/$tarname refs/builds/$build_number/dist", "git-dist"); + # Build user manual start_step ("Build user manual"); run ("cd pspp$build_number && cp _build/doc/*.texi doc/"); diff --git a/git-import-tar b/git-import-tar index 30cd9fa3b1..13d70b1aa4 100755 --- a/git-import-tar +++ b/git-import-tar @@ -55,11 +55,8 @@ if (! -e $tarball) { or die "$0: failed to open \"$tarball\": $!\n"; } -my $commit_user = `git config --get user.name`; -chomp $commit_user; -my $commit_email = `git config --get user.email`; -chomp $commit_email; -my $committer = "$commit_user <$commit_email>"; +my $committer_ident = `git var GIT_COMMITTER_IDENT`; +chomp $committer_ident; open (GFI, "|-", "git fast-import --date-format=raw --quiet") or die "$0: \"git fast-import\" failed to start: $!\n"; @@ -114,7 +111,7 @@ for (;;) { my $commit = $mark++; print GFI "commit $branch\n"; print GFI "mark :$commit\n"; -print GFI "committer $committer ", time(), " +0000\n"; +print GFI "committer $committer_ident\n"; print GFI "data ", length($message), "\n"; print GFI $message, "\n"; print GFI "merge $branch^0\n" if !$new_branch; diff --git a/results2html b/results2html index abc520d3db..4bf398d35c 100755 --- a/results2html +++ b/results2html @@ -3,6 +3,7 @@ use strict; use warnings; +use File::Spec; use HTML::Entities; open (LOG, '<', "LOG"); @@ -36,16 +37,24 @@ 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;
@@ -74,6 +83,21 @@ while () {
 	    $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";
@@ -136,7 +160,11 @@ foreach my $s (@steps) {
 	    print INDEX "

{DIAGNOSTIC}\">"; print INDEX "{LN}\">"; print INDEX encode_entities ($c->{MESSAGE}); - print INDEX "

\n"; + print INDEX ""; + if (exists $c->{FILE}) { + print INDEX " in $c->{FILE}"; + } + print INDEX "

\n"; } else { print INDEX "

{HREF}), "\">"; print INDEX encode_entities ($c->{PRODUCT});