eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # $Id$ # # Reviews build logs and reports problems, via stdout or mail. $usage="$0 [-l log directory] [-m mail recipient(s)]\n"; #### #### Configuration parameters. #### $subject = 'ACE+TAO build results'; $find = 'find'; $mail = "mail -s '$subject'"; $ostype = $ENV{'OSTYPE'} || `/bin/uname -s`; if ( "$ostype" =~ /(solaris)|(SunOS)/i ) { $find = '/pkg/gnu/bin/find'; $mail = "/pkg/mh/bin/mhmail -subject '$subject'"; } $log_directory = '/project/danzontmp/levine/build-logs'; $mail_recipients = ''; #### #### Process command line args. #### while ($#ARGV >= $[) { if ($ARGV[0] eq '-l') { if ($ARGV[1] =~ /^\w+$/) { $log_directory = $ARGV[1]; shift; } else { print STDERR "$0: must provide argument for -l option\n"; die $usage; } } elsif ($ARGV[0] eq '-m') { if ($ARGV[1] =~ /^[\w@\.]+$/) { $mail_recipients = $ARGV[1]; shift; } else { print STDERR "$0: must provide argument for -m option\n"; die $usage; } } elsif ($ARGV[0] eq '-?') { print "$usage"; exit; } else { print "$0: unknown arg: $ARGV[0]\n"; print "$usage"; exit 1; } shift; } #### #### Find the log files. #### chdir $log_directory || die "$0: unable to cd to \"$log_directory\"\n"; ($log_files = ( `$find . -name '*.log' -daystart -ctime 0 -print` )) =~ tr [\n] [ ]; #### #### Grep the log files for problems. #### @output = (); open (EGREP, "egrep -n \'Error|errors|[^a][Ss]top|No rule to make|\(undefined symb\)|[Ww]arn|not exist|core dumped|: #[0-9]|cxx:\' $log_files |") || die "$0: unable to open egrep\n"; while () { push @output, $_ unless /calls, 0 errors$/ || /Found non-pic R_SPARC/; } close EGREP; #### #### Produce output, if there were any problems. #### if ($#output > -1) { if ("$mail_recipients") { open (MAIL, "| $mail $mail_recipients") || die "$0: unable to open pipe to $mail\n"; select MAIL; } print "This is an automatically generated message.\n\n"; print "Log files are in $log_directory.\n\n"; print @output; close MAIL if "$mail_recipients"; }