]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/tools/whereintheworld/whereintheworld.pl
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / tools / whereintheworld / whereintheworld.pl
1 #!/usr/bin/perl -w
2 #
3 # whereintheworld
4 # Parses "make world" output and summarize where it's been so far.
5 #
6 # Bill Fenner <fenner@freebsd.org> 11 January 2000
7 # Dag-Erling Smørgrav <des@freebsd.org> 09 January 2003
8 #
9 # $Id: whereintheworld,v 1.3 2000/01/28 00:42:32 fenner Exp $
10 # $FreeBSD$
11 #
12
13 use strict;
14
15 my $line;
16 my $inside = 0;
17 my @lines = ();
18 my $thresh = 10;
19 my $lastwasdash = 0;
20 my $width = $ENV{COLUMNS} || 80;
21 my $error = 0;
22 my $elided = 0;
23
24 while ($line = <>) {
25         if ($line =~ /^------------/) {
26                 $inside = !$inside;
27                 print $line unless ($lastwasdash);
28                 $lastwasdash = 1;
29                 @lines = ();
30                 next;
31         }
32         if ($inside && $line =~ /^>>>/) {
33                 print $line;
34                 $lastwasdash = 0;
35                 next;
36         }
37         if ($line =~ /^TB /) {
38                 print $line;
39                 next;
40         }
41         if ($line =~ /^=+>/) {
42                 @lines = ();
43         }
44         push(@lines, $line);
45         if ($line =~ /^\*\*\* Error/ && $line !~ /\(ignored\)/) {
46                 $error = 1;
47                 while ($line = <>) {
48                         push(@lines, $line);
49                 }
50                 last;
51         }
52 }
53
54 if (@lines && !$error) {
55         print shift(@lines);
56         while (@lines > $thresh) {
57                 shift(@lines);
58                 ++$elided;
59         }
60         if ($elided > 0) {
61                 print "[$elided lines elided]\n";
62         }
63 }
64 foreach $line (@lines) {
65         if (!$error && $line !~ m/^TB / && length($line) >= $width) {
66                 substr($line, $width - 7) = " [...]\n";
67         }
68         print $line;
69 }