releaseAutomation/releaseNotes.pl
author Simon Howkins <simonh@symbian.org>
Wed, 14 Apr 2010 12:58:22 +0100
changeset 239 d57b367400c0
parent 227 2101b329ee80
child 251 3487e8b7ed38
permissions -rw-r--r--
Updated release notes generation: Added copyright message Proper command line parsing Usage message if inputs are not right Added explanatory preamble to output "NEW" FCLs are marked as such Merge changesets are included in output
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
239
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
     4
# This component and the accompanying materials are made available
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
     6
# which accompanies this distribution, and is available
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
     8
#
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
     9
# Initial Contributors:
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    11
# 
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    12
# Contributors:
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    13
#
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    14
# Description:
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    15
# Automates the creation of parts of the PDK Release Notes
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    16
227
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    17
use strict;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    18
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    19
use FindBin;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    20
use Text::CSV;
239
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    21
use Getopt::Long;
227
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    22
239
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    23
my $sourcesCSV;		# sources.csv file for this build
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    24
my $previousPdkLabel;	# hg tag to compare against
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    25
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    26
GetOptions((
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    27
	'sources=s' => \$sourcesCSV,
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    28
	'baseline=s' => \$previousPdkLabel,
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    29
));
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    30
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    31
if (!$sourcesCSV ||!$previousPdkLabel)
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    32
{
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    33
	warn "Necessary argument(s) not supplied\n\n";
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    34
	usage();
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    35
	exit (1);
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    36
}
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    37
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    38
if (@ARGV)
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    39
{
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    40
	warn "Don't know what to do with these arguments: @ARGV\n\n";
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    41
	usage();
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    42
	exit (1);
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    43
}
227
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
# Load CSV
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    46
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
    47
my $csv = Text::CSV->new();
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    48
my @keys;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    49
239
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    50
print <<"EOT";
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    51
== FCLs ==
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    52
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    53
This PDK was built using FCL versions of the packages listed below: for each one we list allthe changes in the FCL which are not in the MCL.
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    54
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    55
The previous PDK also involved some FCLs, so we indicate which FCLs are new to this build.
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    56
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    57
Cloning the source from Mercurial is made more awkward by using a mixture of MCLs and FCLs, but we provide a tool to help - see [[How to build the Platform]] for details.
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    58
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    59
EOT
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    60
227
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    61
while (my $line = <$csvText>)
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    62
{
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    63
	chomp $line;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    64
	next unless $line;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    65
	unless ($csv->parse($line))
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    66
	{
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    67
		my $err = $csv->error_input();
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    68
		die "Failed to parse line '$line': $err";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    69
	}
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
	if (! @keys)
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    72
	{
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    73
		# First line - note the column names
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    74
		@keys =  $csv->fields();
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    75
		next;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    76
	}
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    77
	my %package;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    78
	# Read into a hash slice
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    79
	@package{@keys} = $csv->fields();
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    80
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    81
	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
    82
	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
    83
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    84
	$package{source} =~ s{[\\/]$}{};
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    85
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    86
	# Work out MCL for an FCL
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    87
	# (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
    88
	my $packageMCL = $package{source};
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    89
	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
    90
239
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    91
	# See if previous PDK was built from MCL
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    92
	my $previousHash = `hg id -i -r $previousPdkLabel $packageMCL 2> nul:`;
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    93
	my $newMarker = $previousHash ? "'''NEW''' " : "";
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
    94
227
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    95
	# Work out package short name (leaf of path)
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    96
	my ($packageShortName) = $packageMCL =~ m{([^\\/]*)[\\/]?$};
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    97
	# Work out package path (local path without preceeding /)
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    98
	my $packagePath = $package{dst};
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    99
	$packagePath =~ s{^[\\/]}{};
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   100
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   101
	# Heading for this package
239
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
   102
	print "==== $packageShortName ([$package{source}/ $packagePath]) $newMarker====\n\n";
227
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   103
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   104
	# List all the changesets needed from the FCL
239
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
   105
	my $fclOnly = `hg -R $package{dst} out $packageMCL -r $package{pattern} -n -q --style $FindBin::Bin/hg.style.mediawiki`;
227
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   106
	if ($fclOnly)
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   107
	{
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   108
		# Substitute in the source URL
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   109
		$fclOnly =~ s[\${sf\.package\.URL}][$package{source}]g;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   110
		# Turn bug references into links
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   111
		$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
   112
		print "{|\n";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   113
		print $fclOnly;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   114
		print "|}\n\n";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   115
	}
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   116
	else
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   117
	{
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   118
		# 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
   119
		print "'''Could use MCL!'''\n\n";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   120
	}
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   121
}
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   122
239
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
   123
sub usage
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
   124
{
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
   125
	warn <<EOT;
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
   126
Generates release notes content
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
   127
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
   128
releaseNotes.pl -sources=<SOURCES.CSV> -baseline=<PDK RELEASE LABEL>
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
   129
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
   130
EOT
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 227
diff changeset
   131
}