releaseAutomation/mercurialComparison.pl
author Simon Howkins <simonh@symbian.org>
Mon, 14 Sep 2009 16:37:27 +0100
changeset 50 a5ee079f00dd
child 56 67168a24b405
permissions -rw-r--r--
Tool to help automate the "Mercurial Comparison" part of the Release Notes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     1
#!perl -w
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     2
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     4
# This component and the accompanying materials are made available
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     6
# which accompanies this distribution, and is available
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     8
#
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     9
# Initial Contributors:
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    11
# 
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    12
# Contributors:
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    13
#
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    14
# Description:
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    15
# Automates the creation of part of the PDK Release Notes: "Mercurial Comparison with PDK XXXXX"
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    16
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    17
use strict;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    18
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    19
use FindBin;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    20
$FindBin::Bin =~ s{/}{\\}g;;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    21
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    22
my $bomInfoFile = shift or die "First argument must be BOM file for build being built/released\n";
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    23
my $previousPdkLabel = shift or die  "Second argument must be hg label to compare against\n";
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    24
my $detailsTsvFilename = shift or die "Third argument must be filename to write detailed TSV data into\n";
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    25
defined shift and die "No more than three arguments please\n";
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    26
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    27
# Use external scripts to get the raw data and produce the CSV summary (to go into Excel, etc)
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    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");
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    29
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    30
# The redirection above means that we discard STDERR from summarise_hg_status,
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    31
# which lists packages for which it was unable to generate any data
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    32
# 
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    33
# It's discarded because that happens either because it's a new package or has
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    34
# moved from SFL -> EPL or we've reverted to using the MCL instead of the FCL
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    35
# (in which cases it's dealt with in another part of the release notes) or it
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    36
# just hasn't had any changes since the last release
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    37
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    38
# Input from TSV file
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    39
my @rawData;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    40
open my $fh, "<", $detailsTsvFilename;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    41
my @columns;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    42
foreach my $line (<$fh>)
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    43
{
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    44
	chomp $line;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    45
	my @values = split "\t", $line;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    46
	if (!@columns)
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    47
	{
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    48
		@columns = @values;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    49
	}
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    50
	else
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    51
	{
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    52
		my %lineData;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    53
		@lineData{@columns} = @values;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    54
		push @rawData, \%lineData;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    55
	}
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    56
}
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    57
close $fh;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    58
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    59
# Pivot
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    60
my %cookedData;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    61
foreach my $datum (@rawData)
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    62
{
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    63
	next if $datum->{Change} =~ m{^(same|M)$};
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    64
	$cookedData{$datum->{Package}} += $datum->{Count};
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    65
}
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    66
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    67
# Cut-off for "interesting" packages
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    68
foreach my $package (keys %cookedData)
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    69
{
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    70
	delete $cookedData{$package} unless $cookedData{$package} >= 350;
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    71
}
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    72
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    73
# Output
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    74
print <<"EOT";
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    75
== Mercurial Comparison with $previousPdkLabel ==
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    76
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    77
The Mercurial changes from Nokia were delivered as a bulk update based on '''XXXXXXXXXXXXXXXXXXXXXX'''.
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    78
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    79
List of the Mercurial changes (files added/removed/modified) between $previousPdkLabel and PDK '''XXXXX''' - [[Media:XXXX.txt]].
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    80
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    81
A short study of the results which concentrated on the added and removed files has identified these significant package changes: 
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    82
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    83
EOT
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    84
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    85
foreach my $package (sort keys %cookedData)
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    86
{
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    87
	print <<"EOT";
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    88
=== $package ===
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    89
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    90
$cookedData{$package} files added/removed
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    91
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    92
* Cause1
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    93
* etc
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    94
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    95
EOT
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    96
}
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    97
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    98
if (!keys %cookedData)
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    99
{
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   100
	print "'''No packages were identified with large changes.'''";
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   101
}
a5ee079f00dd Tool to help automate the "Mercurial Comparison" part of the Release Notes
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
   102