releaseAutomation/releaseNotes.pl
author Simon Howkins <simonh@symbian.org>
Thu, 13 May 2010 12:34:20 +0100
changeset 239 d01a4084d621
parent 229 3487e8b7ed38
permissions -rw-r--r--
Extended to put the preferred column headings into the table. Also made a few other simplifications.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
208
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
219
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
     4
# This component and the accompanying materials are made available
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
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: 208
diff changeset
     6
# which accompanies this distribution, and is available
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
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: 208
diff changeset
     8
#
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
     9
# Initial Contributors:
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    11
# 
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    12
# Contributors:
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    13
#
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    14
# Description:
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    15
# Automates the creation of parts of the PDK Release Notes
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    16
208
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;
219
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    21
use Getopt::Long;
208
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    22
219
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    23
my $sourcesCSV;		# sources.csv file for this build
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    24
my $previousPdkLabel;	# hg tag to compare against
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    25
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    26
GetOptions((
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    27
	'sources=s' => \$sourcesCSV,
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    28
	'baseline=s' => \$previousPdkLabel,
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    29
));
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    30
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    31
if (!$sourcesCSV ||!$previousPdkLabel)
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    32
{
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    33
	warn "Necessary argument(s) not supplied\n\n";
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    34
	usage();
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    35
	exit (1);
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    36
}
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    37
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    38
if (@ARGV)
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    39
{
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
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: 208
diff changeset
    41
	usage();
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    42
	exit (1);
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    43
}
208
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
219
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    50
print <<"EOT";
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    51
== FCLs ==
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    52
229
3487e8b7ed38 Minor improvements to the output: a typo fix and hiding of tip tags.
Simon Howkins <simonh@symbian.org>
parents: 219
diff changeset
    53
This PDK was built using FCL versions of the packages listed below: for each one we list all the changes in the FCL which are not in the MCL.
219
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    54
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
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: 208
diff changeset
    56
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
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: 208
diff changeset
    58
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    59
EOT
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    60
208
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
219
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    91
	# See if previous PDK was built from MCL
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    92
	my $previousHash = `hg id -i -r $previousPdkLabel $packageMCL 2> nul:`;
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    93
	my $newMarker = $previousHash ? "'''NEW''' " : "";
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
    94
208
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
219
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
   102
	print "==== $packageShortName ([$package{source}/ $packagePath]) $newMarker====\n\n";
208
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
219
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
   105
	my $fclOnly = `hg -R $package{dst} out $packageMCL -r $package{pattern} -n -q --style $FindBin::Bin/hg.style.mediawiki`;
208
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;
229
3487e8b7ed38 Minor improvements to the output: a typo fix and hiding of tip tags.
Simon Howkins <simonh@symbian.org>
parents: 219
diff changeset
   110
		# Don't bother mentioning the tip revision
3487e8b7ed38 Minor improvements to the output: a typo fix and hiding of tip tags.
Simon Howkins <simonh@symbian.org>
parents: 219
diff changeset
   111
		$fclOnly =~ s['''tip''' ][]g;
208
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   112
		# Turn bug references into links
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   113
		$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
   114
		print "{|\n";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   115
		print $fclOnly;
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   116
		print "|}\n\n";
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
	else
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   119
	{
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   120
		# 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
   121
		print "'''Could use MCL!'''\n\n";
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   122
	}
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   123
}
2101b329ee80 New script for generating release note content.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   124
219
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
   125
sub usage
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
   126
{
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
   127
	warn <<EOT;
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
   128
Generates release notes content
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
   129
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
   130
releaseNotes.pl -sources=<SOURCES.CSV> -baseline=<PDK RELEASE LABEL>
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
   131
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
   132
EOT
d57b367400c0 Updated release notes generation:
Simon Howkins <simonh@symbian.org>
parents: 208
diff changeset
   133
}