head	1.1;
branch	1.1.1;
access;
symbols
	import-20090318:1.1.1.3
	import-20081205:1.1.1.3
	rel-8-1-2-sv:1.1.1.3
	import-20080404:1.1.1.3
	import-20071105:1.1.1.2
	import-20070116:1.1.1.1
	import-20061124:1.1.1.1
	freescale:1.1.1;
locks; strict;
comment	@# @;


1.1
date	2006.11.27.11.19.19;	author seh;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2006.11.27.11.19.19;	author seh;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2007.11.06.15.44.45;	author seh;	state Exp;
branches;
next	1.1.1.3;
commitid	AdKoH3Xx8FxdUwEs;

1.1.1.3
date	2008.04.04.10.51.55;	author seh;	state Exp;
branches;
next	;
commitid	GVikqE6sLnKPsMXs;


desc
@@


1.1
log
@Initial revision
@
text
@eval 'LANG=C exec perl -w -S $0 ${1+"$@@"}'
    if $running_under_some_shell;
$running_under_some_shell = 0;

######################################################################
#
# Copyright  Freescale Semiconductor, Inc. 2004-2005. All rights reserved.
#
# Stuart Hughes, stuarth@@freescale.com,  29th May 2006
#
# This file is part of LTIB.
# LTIB is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LTIB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LTIB; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#
#
######################################################################
$exclude = { m520xevb => 1, m532xevb => 1};

$irs = $/;
undef $/;
foreach $dir ( glob("*") ) {
    next unless -d $dir;
    open(MCF, "$dir/.config") or warn("no main config for $dir\n"), next;
    $_ = <MCF>;
    close MCF;
    ($tgt) = m,^CONFIG_PLATFORM_DIR="[^\s]+/([^/"]+)",m;
    next if $exclude->{$tgt};
    push @@tgts, $tgt;
    #warn "platform = $tgt\n";
    $len = length("$dir/rpm/BUILD/");
    foreach $fail ( glob("$dir/rpm/BUILD/*") ) {
        $pkg = substr($fail, $len);
        $pkgs->{$pkg}{$tgt} = 1;
    }
}
$/ = $irs;
@@astgts = sort @@tgts;

# save today's results for comparison next run
$wf = "pkg_res";
rename($wf, "$wf.old") if -f $wf;
open(WF, ">$wf") or die("open(>$wf): $!\n");
foreach $tgt (@@astgts) {
    print WF "$tgt";
    foreach $pkg ( sort keys %$pkgs ){
        if($pkgs->{$pkg}{$tgt}) {
            print WF "\t$pkg";
            $new->{$tgt}{$pkg} = 1;
        }
    }
    print WF "\n";
}
close(WF);

# calculate the diff list if there is a .old file
goto CALC_RES unless -f "$wf.old";
$dt = 1;
open(WF, "$wf.old") or die("open($wf.old): $!\n");
while($line = <WF>) {
    chomp $line;
    @@fails = split(/\s+/, $line);
    $tgt = shift(@@fails);
    # the second term is to list all packages
    map { $old->{$tgt}{$_} = 1; $pkgs->{$_}{$tgt} = 1 } @@fails;
}
close(WF);

CALC_RES:
print htheader();
print "<table border=1 cellpadding=2>\n<tr><th>Package</th>\n";
foreach $tgt (@@astgts) {
    print "<th>$tgt</th>";
}
print "</tr>\n";
foreach $pkg ( sort keys %$pkgs ){
    print "<tr>";
    print "<td>$pkg</td>";
    foreach $tgt (@@astgts) {
        if(! $dt) {
           $str = $pkgs->{$pkg}{$tgt} ? 'x' : '&nbsp';
           print "<td align=center>$str</td>";
           next;
        }
        if(       ! $new->{$tgt}{$pkg} && ! $old->{$tgt}{$pkg}) {
            $str = '&nbsp';
        } elsif ( ! $new->{$tgt}{$pkg} &&   $old->{$tgt}{$pkg} ) {
            $str = '-';
        } elsif (   $new->{$tgt}{$pkg} && ! $old->{$tgt}{$pkg} ) {
            $str = '+';
        } elsif  (   $new->{$tgt}{$pkg} &&   $old->{$tgt}{$pkg} ) {
            $str = 'x';
        }
        print "<td align=center>$str</td>";
        
    }
    print "</tr>\n";
}
print "</table>\n";

print htfooter();
exit 0;

sub htheader
{
    return <<TXT;
<html>
<body>
<center><b>BSP package build failures on ${\ scalar gmtime() } GMT</b></center>
<br>
<br>
<b><u>KEY</u></b><br>
<b>x</b> : Failed, failed last time<br>
<b>+</b> : Failed, new failure<br>
<b>-</b> : Changed from fail to pass<br>
<br>
TXT

}

sub htfooter
{
    return <<TXT;
</body>
</html>
TXT
}

@


1.1.1.1
log
@Import from fsl 20061124
@
text
@@


1.1.1.2
log
@Import from fsl 20071105
@
text
@a0 1
#!/usr/bin/perl -w
d7 1
a7 1
# Copyright  Freescale Semiconductor, Inc. 2004-2007. All rights reserved.
d28 1
a28 1
use Getopt::Std;
d30 2
a31 32
$exclude = { noautobuild => 1};
$build_log = 'build.log';
$date = scalar(gmtime());
chomp($hostname = `hostname`);

$opt_d = 0;
$opt_s = 0;
$opt_e = time();
$ti    = '<br>';

getopts("ds:e:") or die <<TXT;
Usage: mk_pkg_results [ -a ]
    where:
      -d      : just show the delta failure listing
      -s      : start time (seconds since the epoch)
      -e      : end time (seconds since the epoch)
TXT

if($opt_s) {
    $sdate = scalar gmtime($opt_s);
    $edate = scalar gmtime($opt_e);
    $elaps = $opt_e - $opt_s;
    $ti = <<TXT;
<center><table border=1>
<tr> <th>start time</th> <th> end time   </th> <th> elapsed </th> </tr>
<tr> <td>$sdate GMT </td> <td> $edate GMT </td> <td> $elaps seconds </td></tr>
</table></center>
TXT
}

# loop around each autobuilt directory and collect the target platform
# built and a list of packages built and failures
a33 3
    next if $exclude->{$dir};

    # extract the target for this directory
d35 1
a35 6
    while(<MCF>) {
        if(m,^CONFIG_PLATFORM_DIR="[^\s]+/([^/"]+)",) {
            ($tgt) = $1;
            last;
        }
    }
d37 2
a38 1
    next unless $tgt;
d40 5
a44 19

    # collect the lists of builds and fails
    # 1 => on the build list
    # 2 => failed to build
    $grab_line = 0;
    open(BL, "$dir/$build_log") or warn("open $dir/$build_log : $!\n"), next;
    while(<BL>) {
        if(m,^Processing: (.*),) {
            $pkgs->{$1}{$tgt} = 1;
        }
        if($grab_line) {
            $grab_line = 0;
            foreach $fpkg (split(/\s+/, $_)) {
                $pkgs->{$fpkg}{$tgt} = 2;
            }
        }
        if(m,^These packages failed to build:$,) {
            $grab_line = 1;
        }
d47 1
a49 2
if($opt_d) {

d57 1
a57 1
        if($pkgs->{$pkg}{$tgt} && $pkgs->{$pkg}{$tgt} == 2) {
d80 1
a80 14
print <<TXT;
<html>
<body>
<center><b><u>
BSP package build failures on $date GMT from $hostname
</u></b></center>
$ti
For full build results and other information <a href=http://bitshrine.org/ltib/>click here</a><br>
<b><u>KEY</u>:</b>
<b>x</b> : Failed, failed last time, 
<b>+</b> : Failed, new failure, 
<b>-</b> : Changed from fail to pass<br>
TXT

d86 1
a86 11

# merge the old and new fails into a single list
foreach $t (keys %$new) {
    foreach $pkg ( keys %{$new->{$t}} ) {
        $fails->{$pkg} = 1;
    }
    foreach $pkg ( keys %{$old->{$t}} ) {
        $fails->{$pkg} = 1;
    }
}
foreach $pkg ( sort keys %$fails ){
d91 1
a91 1
           $str = $new->{$pkg}{$tgt} ? 'x' : '&nbsp';
d111 1
a111 4
print <<TXT;
</body>
</html>
TXT
d114 3
a116 4
}

# or: print the full results
print <<TXT;
d119 8
a126 5
<center><b><u>
BSP package build information $date GMT from $hostname
</u></b></center>
$ti
<b><u>KEY</u>:</b> <b>o</b> = Built okay, <b>x</b> = Failed<br>
a128 20
print "<table border=1 cellpadding=2>\n<tr><th>Package</th>\n";
foreach $tgt (@@astgts) {
    print "<th>$tgt</th>";
}
print "</tr>\n";
foreach $pkg ( sort keys %$pkgs ){
    print "<tr>";
    print "<td>$pkg</td>";
    foreach $tgt (@@astgts) {
        if(! $pkgs->{$pkg}{$tgt} ) {
            $str = '&nbsp';
        } elsif( $pkgs->{$pkg}{$tgt} == 1 ) {
            $str = 'o';
        } elsif( $pkgs->{$pkg}{$tgt} == 2 ) {
            $str = 'x';
        }
        print "<td align=center>$str</td>";
        next;
    }
    print "</tr>\n";
a129 2
print "</table>\n";

d131 3
a133 1
print <<TXT;
d137 2
a138 1
exit 0;
@


1.1.1.3
log
@Import from fsl 20080404
@
text
@d167 1
a167 1
           $str = $new->{$pkg}{$tgt} ? 'x' : '&nbsp;';
d172 1
a172 1
            $str = '&nbsp;';
d216 1
a216 1
            $str = '&nbsp;';
@


