common/tools/summary/brag_script.pl
author Simon Howkins <simonh@symbian.org>
Tue, 25 Aug 2009 11:06:23 +0100
changeset 380 d4dac57985d9
parent 366 cde2244c8ea6
child 382 63fdf0583f67
permissions -rw-r--r--
Bug 299 populateziptemplate.pl aborts if it cannot determine the license for a source component Changed so that even if it encounters an error it will still generate the output file before it exits with a failure error code.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
366
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2009 Symbian Foundation Ltd
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     2
# This component and the accompanying materials are made available
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     3
# under the terms of the License "Eclipse Public License v1.0"
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     4
# which accompanies this distribution, and is available
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     5
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     6
#
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     7
# Initial Contributors:
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     8
# Symbian Foundation Ltd - initial contribution.
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     9
#
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    10
# Contributors:
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    11
#
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    12
# Description:
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    13
# Generate build summary with BRAG status
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    14
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    15
use Getopt::Long;
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    16
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
my $buildid = '';
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
my $basedir = '';
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
my $help = 0;
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
GetOptions((
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    21
	'buildid=s' => \$buildid,
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    22
	'basedir=s' => \$basedir,
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    23
	'help!' => \$help
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    24
));
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    25
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    26
$help = 1 if (!$buildid or !$basedir);
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    27
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    28
if ($help)
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    29
{
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    30
	print "Generate build summary with BRAG status\n";
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
	print "Usage: perl brag_script.pl --buildid=ID --basedir=DIR\n";
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
	exit(0);
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
}
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    34
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    35
$buildid =~ /^([^_]*)_([^.]*)\./;
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    36
my $project = $1;
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    37
my $codeline = $2;
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    38
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    39
my $logdir = "$basedir\\$buildid\\output\\logs";
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    40
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    41
opendir(DIR, $logdir);
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    42
my @dir_content = readdir(DIR);
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    43
close(DIR);
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    44
#my @asSimilarDirs = grep(/^$sBaseName(\.|$)/, @asDirs);
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    45
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    46
my $nfiles = scalar(@dir_content);
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    47
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    48
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    49
open(FILE, ">$logdir\\build_summary.html");
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    50
print FILE "<html><body>build summary<br/>build id: $buildid<br/>log files: $nfiles</body></html>";
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    51
close(FILE);
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    52
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    53
my $copy_cmd = "copy $logdir\\build_summary.html \\\\bishare\\sf_builds\\$project\\builds\\$codeline\\$buildid";
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    54
print "Exec: $copy_cmd\n";
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    55
system($copy_cmd);
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    56
cde2244c8ea6 First drop of script to generate build summary
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    57