From e873b4d1bc3236fd93e271ce57f08b47521beaf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Thu, 28 Jul 2005 10:09:22 +0000 Subject: [PATCH] Shorten src / obj paths while capturing logs, making them both smaller and easier to read. --- tools/tools/tinderbox/tbmaster.pl | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tools/tools/tinderbox/tbmaster.pl b/tools/tools/tinderbox/tbmaster.pl index 8ea5b2752b9f..39682e586c37 100644 --- a/tools/tools/tinderbox/tbmaster.pl +++ b/tools/tools/tinderbox/tbmaster.pl @@ -70,6 +70,33 @@ my %INITIAL_CONFIG = ( ); my %CONFIG; +### +### Expand a path +### +sub realpath($;$); +sub realpath($;$) { + my $path = shift; + my $base = shift || ""; + + my $realpath = ($path =~ m|^/|) ? "" : $base; + my @parts = split('/', $path); + while (defined(my $part = shift(@parts))) { + if ($part eq '' || $part eq '.') { + # nothing + } elsif ($part eq '..') { + $realpath =~ s|/[^/]+$|| + or die("'$path' is not a valid path relative to '$base'\n"); + } elsif (-l "$realpath/$part") { + my $target = readlink("$realpath/$part") + or die("unable to resolve symlink '$realpath/$part': $!\n"); + $realpath = realpath($target, $realpath); + } else { + $realpath .= "/$part"; + } + } + return $realpath; +} + ### ### Perform variable expansion ### @@ -243,7 +270,7 @@ sub tinderbox($$$) { # Fork and start the tinderbox my @args = @{$CONFIG{'OPTIONS'}}; push(@args, "--hostname=" . expand('HOSTNAME')); - push(@args, "--sandbox=" . expand('SANDBOX')); + push(@args, "--sandbox=" . realpath(expand('SANDBOX'))); push(@args, "--arch=$arch"); push(@args, "--machine=$machine"); push(@args, "--cvsup=" . expand('CVSUP')) @@ -287,7 +314,9 @@ sub tinderbox($$$) { my @lines = (); my $error = 0; my $summary = ""; + my $root = realpath(expand('SANDBOX') . "/$branch/$arch/$machine"); while () { + s/\Q$root\E\/(src|obj)/\/$1/g; print(FULL $_); if (/^TB ---/ || /^>>> /) { if ($error) {