releaseAutomation/mercurialComparison.pl
changeset 49 a5ee079f00dd
child 55 67168a24b405
equal deleted inserted replaced
48:c0d2a34bf681 49:a5ee079f00dd
       
     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 part of the PDK Release Notes: "Mercurial Comparison with PDK XXXXX"
       
    16 
       
    17 use strict;
       
    18 
       
    19 use FindBin;
       
    20 $FindBin::Bin =~ s{/}{\\}g;;
       
    21 
       
    22 my $bomInfoFile = shift or die "First argument must be BOM file for build being built/released\n";
       
    23 my $previousPdkLabel = shift or die  "Second argument must be hg label to compare against\n";
       
    24 my $detailsTsvFilename = shift or die "Third argument must be filename to write detailed TSV data into\n";
       
    25 defined shift and die "No more than three arguments please\n";
       
    26 
       
    27 # Use external scripts to get the raw data and produce the CSV summary (to go into Excel, etc)
       
    28 system("perl $FindBin::Bin\\..\\clone_packages\\clone_all_packages.pl -packagelist $bomInfoFile -exec -- hg status -C --rev $previousPdkLabel 2>&1 | perl $FindBin::Bin\\..\\williamr\\summarise_hg_status.pl 2> nul: > $detailsTsvFilename");
       
    29 
       
    30 # The redirection above means that we discard STDERR from summarise_hg_status,
       
    31 # which lists packages for which it was unable to generate any data
       
    32 # 
       
    33 # It's discarded because that happens either because it's a new package or has
       
    34 # moved from SFL -> EPL or we've reverted to using the MCL instead of the FCL
       
    35 # (in which cases it's dealt with in another part of the release notes) or it
       
    36 # just hasn't had any changes since the last release
       
    37 
       
    38 # Input from TSV file
       
    39 my @rawData;
       
    40 open my $fh, "<", $detailsTsvFilename;
       
    41 my @columns;
       
    42 foreach my $line (<$fh>)
       
    43 {
       
    44 	chomp $line;
       
    45 	my @values = split "\t", $line;
       
    46 	if (!@columns)
       
    47 	{
       
    48 		@columns = @values;
       
    49 	}
       
    50 	else
       
    51 	{
       
    52 		my %lineData;
       
    53 		@lineData{@columns} = @values;
       
    54 		push @rawData, \%lineData;
       
    55 	}
       
    56 }
       
    57 close $fh;
       
    58 
       
    59 # Pivot
       
    60 my %cookedData;
       
    61 foreach my $datum (@rawData)
       
    62 {
       
    63 	next if $datum->{Change} =~ m{^(same|M)$};
       
    64 	$cookedData{$datum->{Package}} += $datum->{Count};
       
    65 }
       
    66 
       
    67 # Cut-off for "interesting" packages
       
    68 foreach my $package (keys %cookedData)
       
    69 {
       
    70 	delete $cookedData{$package} unless $cookedData{$package} >= 350;
       
    71 }
       
    72 
       
    73 # Output
       
    74 print <<"EOT";
       
    75 == Mercurial Comparison with $previousPdkLabel ==
       
    76 
       
    77 The Mercurial changes from Nokia were delivered as a bulk update based on '''XXXXXXXXXXXXXXXXXXXXXX'''.
       
    78 
       
    79 List of the Mercurial changes (files added/removed/modified) between $previousPdkLabel and PDK '''XXXXX''' - [[Media:XXXX.txt]].
       
    80 
       
    81 A short study of the results which concentrated on the added and removed files has identified these significant package changes: 
       
    82 
       
    83 EOT
       
    84 
       
    85 foreach my $package (sort keys %cookedData)
       
    86 {
       
    87 	print <<"EOT";
       
    88 === $package ===
       
    89 
       
    90 $cookedData{$package} files added/removed
       
    91 
       
    92 * Cause1
       
    93 * etc
       
    94 
       
    95 EOT
       
    96 }
       
    97 
       
    98 if (!keys %cookedData)
       
    99 {
       
   100 	print "'''No packages were identified with large changes.'''";
       
   101 }
       
   102