Shorten src / obj paths while capturing logs, making them both smaller and

easier to read.
This commit is contained in:
Dag-Erling Smørgrav 2005-07-28 10:09:22 +00:00
parent b9dc1340d2
commit e873b4d1bc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=148473

View File

@ -70,6 +70,33 @@ my %INITIAL_CONFIG = (
); );
my %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 ### Perform variable expansion
### ###
@ -243,7 +270,7 @@ sub tinderbox($$$) {
# Fork and start the tinderbox # Fork and start the tinderbox
my @args = @{$CONFIG{'OPTIONS'}}; my @args = @{$CONFIG{'OPTIONS'}};
push(@args, "--hostname=" . expand('HOSTNAME')); push(@args, "--hostname=" . expand('HOSTNAME'));
push(@args, "--sandbox=" . expand('SANDBOX')); push(@args, "--sandbox=" . realpath(expand('SANDBOX')));
push(@args, "--arch=$arch"); push(@args, "--arch=$arch");
push(@args, "--machine=$machine"); push(@args, "--machine=$machine");
push(@args, "--cvsup=" . expand('CVSUP')) push(@args, "--cvsup=" . expand('CVSUP'))
@ -287,7 +314,9 @@ sub tinderbox($$$) {
my @lines = (); my @lines = ();
my $error = 0; my $error = 0;
my $summary = ""; my $summary = "";
my $root = realpath(expand('SANDBOX') . "/$branch/$arch/$machine");
while (<RPIPE>) { while (<RPIPE>) {
s/\Q$root\E\/(src|obj)/\/$1/g;
print(FULL $_); print(FULL $_);
if (/^TB ---/ || /^>>> /) { if (/^TB ---/ || /^>>> /) {
if ($error) { if ($error) {