releaseAutomation/releaseNotes.pl
author Dario Sestito <darios@symbian.org>
Wed, 07 Apr 2010 17:31:01 +0100
changeset 228 ba90e30c0f3c
parent 227 2101b329ee80
child 239 d57b367400c0
permissions -rw-r--r--
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
227
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     1
#!perl -w
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     2
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     3
use strict;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     4
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     5
use FindBin;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     6
use Text::CSV;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     7
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     8
my $sourcesCSV = shift or die "First arg must be sources.csv to process\n";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     9
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    10
# Load CSV
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    11
open my $csvText, "<", $sourcesCSV or die "Unable to open sources.csv from $sourcesCSV";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    12
my $csv = Text::CSV->new();
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    13
my @keys;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    14
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    15
while (my $line = <$csvText>)
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    16
{
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    17
	chomp $line;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    18
	next unless $line;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    19
	unless ($csv->parse($line))
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    20
	{
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    21
		my $err = $csv->error_input();
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    22
		die "Failed to parse line '$line': $err";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    23
	}
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    24
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    25
	if (! @keys)
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    26
	{
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    27
		# First line - note the column names
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    28
		@keys =  $csv->fields();
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    29
		next;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    30
	}
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    31
	my %package;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    32
	# Read into a hash slice
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    33
	@package{@keys} = $csv->fields();
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    34
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    35
	die "sources.csv should specify revisions by changeset" unless $package{type} eq "changeset";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    36
	die "sources.csv should specify changesets with a global ID" unless $package{pattern} =~ m{^[0-9a-z]{12}$}i;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    37
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    38
	$package{source} =~ s{[\\/]$}{};
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    39
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    40
	# Work out MCL for an FCL
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    41
	# (Ignore package if it's coming from an MCL anyway)
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    42
	my $packageMCL = $package{source};
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    43
	next unless $packageMCL =~ s{(oss|sfl)/FCL/}{$1/MCL/};
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    44
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    45
	# Work out package short name (leaf of path)
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    46
	my ($packageShortName) = $packageMCL =~ m{([^\\/]*)[\\/]?$};
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    47
	# Work out package path (local path without preceeding /)
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    48
	my $packagePath = $package{dst};
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    49
	$packagePath =~ s{^[\\/]}{};
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    50
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    51
	# Heading for this package
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    52
	print "==== $packageShortName ([$package{source}/ $packagePath]) ====\n\n";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    53
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    54
	# List all the changesets needed from the FCL
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    55
	my $fclOnly = `hg -R $package{dst} out $packageMCL -r $package{pattern} -n -q -M --style $FindBin::Bin/hg.style.mediawiki`;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    56
	if ($fclOnly)
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    57
	{
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    58
		# Substitute in the source URL
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    59
		$fclOnly =~ s[\${sf\.package\.URL}][$package{source}]g;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    60
		# Turn bug references into links
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    61
		$fclOnly =~ s{\b(bug) (\d+)}{[http://developer.symbian.org/bugs/show_bug.cgi?id=$2 $1 $2]}gi;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    62
		print "{|\n";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    63
		print $fclOnly;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    64
		print "|}\n\n";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    65
	}
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    66
	else
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    67
	{
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    68
		# Nothing needed that's not already in MCL - package need not be taken from FCL!
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    69
		print "'''Could use MCL!'''\n\n";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    70
	}
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    71
}
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    72