releaseAutomation/releaseNotes.pl
changeset 208 2101b329ee80
child 219 d57b367400c0
equal deleted inserted replaced
207:87279950a73e 208:2101b329ee80
       
     1 #!perl -w
       
     2 
       
     3 use strict;
       
     4 
       
     5 use FindBin;
       
     6 use Text::CSV;
       
     7 
       
     8 my $sourcesCSV = shift or die "First arg must be sources.csv to process\n";
       
     9 
       
    10 # Load CSV
       
    11 open my $csvText, "<", $sourcesCSV or die "Unable to open sources.csv from $sourcesCSV";
       
    12 my $csv = Text::CSV->new();
       
    13 my @keys;
       
    14 
       
    15 while (my $line = <$csvText>)
       
    16 {
       
    17 	chomp $line;
       
    18 	next unless $line;
       
    19 	unless ($csv->parse($line))
       
    20 	{
       
    21 		my $err = $csv->error_input();
       
    22 		die "Failed to parse line '$line': $err";
       
    23 	}
       
    24 
       
    25 	if (! @keys)
       
    26 	{
       
    27 		# First line - note the column names
       
    28 		@keys =  $csv->fields();
       
    29 		next;
       
    30 	}
       
    31 	my %package;
       
    32 	# Read into a hash slice
       
    33 	@package{@keys} = $csv->fields();
       
    34 
       
    35 	die "sources.csv should specify revisions by changeset" unless $package{type} eq "changeset";
       
    36 	die "sources.csv should specify changesets with a global ID" unless $package{pattern} =~ m{^[0-9a-z]{12}$}i;
       
    37 
       
    38 	$package{source} =~ s{[\\/]$}{};
       
    39 
       
    40 	# Work out MCL for an FCL
       
    41 	# (Ignore package if it's coming from an MCL anyway)
       
    42 	my $packageMCL = $package{source};
       
    43 	next unless $packageMCL =~ s{(oss|sfl)/FCL/}{$1/MCL/};
       
    44 
       
    45 	# Work out package short name (leaf of path)
       
    46 	my ($packageShortName) = $packageMCL =~ m{([^\\/]*)[\\/]?$};
       
    47 	# Work out package path (local path without preceeding /)
       
    48 	my $packagePath = $package{dst};
       
    49 	$packagePath =~ s{^[\\/]}{};
       
    50 
       
    51 	# Heading for this package
       
    52 	print "==== $packageShortName ([$package{source}/ $packagePath]) ====\n\n";
       
    53 
       
    54 	# 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`;
       
    56 	if ($fclOnly)
       
    57 	{
       
    58 		# Substitute in the source URL
       
    59 		$fclOnly =~ s[\${sf\.package\.URL}][$package{source}]g;
       
    60 		# Turn bug references into links
       
    61 		$fclOnly =~ s{\b(bug) (\d+)}{[http://developer.symbian.org/bugs/show_bug.cgi?id=$2 $1 $2]}gi;
       
    62 		print "{|\n";
       
    63 		print $fclOnly;
       
    64 		print "|}\n\n";
       
    65 	}
       
    66 	else
       
    67 	{
       
    68 		# Nothing needed that's not already in MCL - package need not be taken from FCL!
       
    69 		print "'''Could use MCL!'''\n\n";
       
    70 	}
       
    71 }
       
    72