releaseAutomation/releaseNotes.pl
changeset 239 d57b367400c0
parent 227 2101b329ee80
child 251 3487e8b7ed38
equal deleted inserted replaced
238:1040fbff0705 239:d57b367400c0
     1 #!perl -w
     1 #!perl -w
       
     2 
       
     3 # Copyright (c) 2009 Symbian Foundation Ltd
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Symbian Foundation Ltd - initial contribution.
       
    11 # 
       
    12 # Contributors:
       
    13 #
       
    14 # Description:
       
    15 # Automates the creation of parts of the PDK Release Notes
     2 
    16 
     3 use strict;
    17 use strict;
     4 
    18 
     5 use FindBin;
    19 use FindBin;
     6 use Text::CSV;
    20 use Text::CSV;
       
    21 use Getopt::Long;
     7 
    22 
     8 my $sourcesCSV = shift or die "First arg must be sources.csv to process\n";
    23 my $sourcesCSV;		# sources.csv file for this build
       
    24 my $previousPdkLabel;	# hg tag to compare against
       
    25 
       
    26 GetOptions((
       
    27 	'sources=s' => \$sourcesCSV,
       
    28 	'baseline=s' => \$previousPdkLabel,
       
    29 ));
       
    30 
       
    31 if (!$sourcesCSV ||!$previousPdkLabel)
       
    32 {
       
    33 	warn "Necessary argument(s) not supplied\n\n";
       
    34 	usage();
       
    35 	exit (1);
       
    36 }
       
    37 
       
    38 if (@ARGV)
       
    39 {
       
    40 	warn "Don't know what to do with these arguments: @ARGV\n\n";
       
    41 	usage();
       
    42 	exit (1);
       
    43 }
     9 
    44 
    10 # Load CSV
    45 # Load CSV
    11 open my $csvText, "<", $sourcesCSV or die "Unable to open sources.csv from $sourcesCSV";
    46 open my $csvText, "<", $sourcesCSV or die "Unable to open sources.csv from $sourcesCSV";
    12 my $csv = Text::CSV->new();
    47 my $csv = Text::CSV->new();
    13 my @keys;
    48 my @keys;
       
    49 
       
    50 print <<"EOT";
       
    51 == FCLs ==
       
    52 
       
    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.
       
    54 
       
    55 The previous PDK also involved some FCLs, so we indicate which FCLs are new to this build.
       
    56 
       
    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.
       
    58 
       
    59 EOT
    14 
    60 
    15 while (my $line = <$csvText>)
    61 while (my $line = <$csvText>)
    16 {
    62 {
    17 	chomp $line;
    63 	chomp $line;
    18 	next unless $line;
    64 	next unless $line;
    40 	# Work out MCL for an FCL
    86 	# Work out MCL for an FCL
    41 	# (Ignore package if it's coming from an MCL anyway)
    87 	# (Ignore package if it's coming from an MCL anyway)
    42 	my $packageMCL = $package{source};
    88 	my $packageMCL = $package{source};
    43 	next unless $packageMCL =~ s{(oss|sfl)/FCL/}{$1/MCL/};
    89 	next unless $packageMCL =~ s{(oss|sfl)/FCL/}{$1/MCL/};
    44 
    90 
       
    91 	# See if previous PDK was built from MCL
       
    92 	my $previousHash = `hg id -i -r $previousPdkLabel $packageMCL 2> nul:`;
       
    93 	my $newMarker = $previousHash ? "'''NEW''' " : "";
       
    94 
    45 	# Work out package short name (leaf of path)
    95 	# Work out package short name (leaf of path)
    46 	my ($packageShortName) = $packageMCL =~ m{([^\\/]*)[\\/]?$};
    96 	my ($packageShortName) = $packageMCL =~ m{([^\\/]*)[\\/]?$};
    47 	# Work out package path (local path without preceeding /)
    97 	# Work out package path (local path without preceeding /)
    48 	my $packagePath = $package{dst};
    98 	my $packagePath = $package{dst};
    49 	$packagePath =~ s{^[\\/]}{};
    99 	$packagePath =~ s{^[\\/]}{};
    50 
   100 
    51 	# Heading for this package
   101 	# Heading for this package
    52 	print "==== $packageShortName ([$package{source}/ $packagePath]) ====\n\n";
   102 	print "==== $packageShortName ([$package{source}/ $packagePath]) $newMarker====\n\n";
    53 
   103 
    54 	# List all the changesets needed from the FCL
   104 	# List all the changesets needed from the FCL
    55 	my $fclOnly = `hg -R $package{dst} out $packageMCL -r $package{pattern} -n -q -M --style $FindBin::Bin/hg.style.mediawiki`;
   105 	my $fclOnly = `hg -R $package{dst} out $packageMCL -r $package{pattern} -n -q --style $FindBin::Bin/hg.style.mediawiki`;
    56 	if ($fclOnly)
   106 	if ($fclOnly)
    57 	{
   107 	{
    58 		# Substitute in the source URL
   108 		# Substitute in the source URL
    59 		$fclOnly =~ s[\${sf\.package\.URL}][$package{source}]g;
   109 		$fclOnly =~ s[\${sf\.package\.URL}][$package{source}]g;
    60 		# Turn bug references into links
   110 		# Turn bug references into links
    68 		# Nothing needed that's not already in MCL - package need not be taken from FCL!
   118 		# Nothing needed that's not already in MCL - package need not be taken from FCL!
    69 		print "'''Could use MCL!'''\n\n";
   119 		print "'''Could use MCL!'''\n\n";
    70 	}
   120 	}
    71 }
   121 }
    72 
   122 
       
   123 sub usage
       
   124 {
       
   125 	warn <<EOT;
       
   126 Generates release notes content
       
   127 
       
   128 releaseNotes.pl -sources=<SOURCES.CSV> -baseline=<PDK RELEASE LABEL>
       
   129 
       
   130 EOT
       
   131 }