author | William Roberts <williamr@symbian.org> |
Tue, 29 Jun 2010 17:58:44 +0100 | |
changeset 300 | 3b8bce67b574 |
parent 158 | 27cf0a88d449 |
permissions | -rw-r--r-- |
49
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
1 |
#! perl -w |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
2 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
3 |
# Copyright (c) 2009 Symbian Foundation Ltd |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
4 |
# This component and the accompanying materials are made available |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
5 |
# under the terms of the License "Eclipse Public License v1.0" |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
6 |
# which accompanies this distribution, and is available |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
8 |
# |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
9 |
# Initial Contributors: |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
10 |
# Symbian Foundation Ltd - initial contribution. |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
11 |
# |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
12 |
# Contributors: |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
13 |
# |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
14 |
# Description: |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
15 |
# |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
16 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
17 |
use strict; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
18 |
use Getopt::Long; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
19 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
20 |
use FindBin; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
21 |
#my $churn_core = "D:\\mirror\\churn_core.pl"; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
22 |
my $churn_core = "$FindBin::Bin\\churn_core.pl"; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
23 |
my $churn_output_temp = "$FindBin::Bin\\fbf_churn_output"; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
24 |
mkdir $churn_output_temp; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
25 |
|
55
7b39c2ae2526
Located clone_all_packages relative to the location of fbf_churn.
Chetan Kapoor <chetank@symbian.org>
parents:
49
diff
changeset
|
26 |
my $path = $FindBin::Bin; |
7b39c2ae2526
Located clone_all_packages relative to the location of fbf_churn.
Chetan Kapoor <chetank@symbian.org>
parents:
49
diff
changeset
|
27 |
$path =~ s/\//\\/g; |
7b39c2ae2526
Located clone_all_packages relative to the location of fbf_churn.
Chetan Kapoor <chetank@symbian.org>
parents:
49
diff
changeset
|
28 |
my $clone_packages = "$path\\..\\clone_packages\\clone_all_packages.pl"; |
7b39c2ae2526
Located clone_all_packages relative to the location of fbf_churn.
Chetan Kapoor <chetank@symbian.org>
parents:
49
diff
changeset
|
29 |
|
7b39c2ae2526
Located clone_all_packages relative to the location of fbf_churn.
Chetan Kapoor <chetank@symbian.org>
parents:
49
diff
changeset
|
30 |
|
49
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
31 |
sub Usage($) |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
32 |
{ |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
33 |
my ($msg) = @_; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
34 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
35 |
print "$msg\n\n" if ($msg ne ""); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
36 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
37 |
print <<'EOF'; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
38 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
39 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
40 |
fbf_churn.pl - simple script for calculating code churn in between two revisions |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
41 |
or labels for a package. This script can also be used to calculate code size for |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
42 |
a package. |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
43 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
44 |
When used without a package name or filter, this script runs for all the packages |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
45 |
in the BOM (build-info.xml) file supplied to it. |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
46 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
47 |
Important: |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
48 |
This script uses clone_all_packages.pl which clones all repositories listed in |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
49 |
the BOM or pull changes into a previously cloned repository. |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
50 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
51 |
This script uses its accompayning script churn_core.pl - which should be |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
52 |
present in the same directory as this script. |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
53 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
54 |
Limitations: |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
55 |
If a BOM is not supplied to the script using the -bom option, then the script |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
56 |
runs on the package locations inside both MCL and FCL producing two results |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
57 |
for a single package. For running the script for calculating code churn between |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
58 |
two release buils (using labels) or for calculating code size for a release build, |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
59 |
it is essential that a BOM (preferably for the newer build) is passed as an |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
60 |
argument using the -bom option. |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
61 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
62 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
63 |
Options: |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
64 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
65 |
-o --old old revision or label for a package/respoitory |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
66 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
67 |
-n --new new revision or label for a package/respoitory |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
68 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
69 |
--rev revision for package/respoitory - Use this while calculating code size for a single package |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
70 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
71 |
--label revision tag for package or release build - Use this while calculating code size |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
72 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
73 |
-bom --bom build-info.xml files supplied with Symbian PDKs |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
74 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
75 |
-verbose print the underlying "clone_all_packages" & "hg" commands before executing them |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
76 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
77 |
-help print this help information |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
78 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
79 |
-package <RE> only process repositories matching regular expression <RE> |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
80 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
81 |
-filter <RE> only process repositories matching regular expression <RE> |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
82 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
83 |
EOF |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
84 |
exit (1); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
85 |
} |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
86 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
87 |
print "\n\n==Symbian Foundation Code Churn Tool v1.0==\n\n"; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
88 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
89 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
90 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
91 |
my $old = "null"; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
92 |
my $new = ""; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
93 |
my $filter = ""; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
94 |
my $codeline = ""; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
95 |
my $package = ""; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
96 |
my $licence = ""; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
97 |
my $packagelist = ""; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
98 |
my $verbose = 0; |
158
27cf0a88d449
Made the '-mirror' switch optional
Chetan Kapoor <chetank@symbian.org>
parents:
55
diff
changeset
|
99 |
my $mirror = 0; |
49
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
100 |
my $help = 0; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
101 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
102 |
sub do_system |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
103 |
{ |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
104 |
my (@args) = @_; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
105 |
print "* ", join(" ", @args), "\n" if ($verbose); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
106 |
return system(@args); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
107 |
} |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
108 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
109 |
# Analyse the command-line parameters |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
110 |
if (!GetOptions( |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
111 |
"n|new-rev|new-label|label|rev=s" => \$new, |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
112 |
"o|old-rev|old-label=s" => \$old, |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
113 |
"f|filter=s" => \$filter, |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
114 |
"p|package=s" => \$filter, |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
115 |
"cl|codeline=s" => \$codeline, |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
116 |
"li|licence=s" => \$licence, |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
117 |
"bom|bom=s" => \$packagelist, |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
118 |
"v|verbose" => \$verbose, |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
119 |
"h|help" => \$help, |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
120 |
)) |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
121 |
{ |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
122 |
Usage("Invalid argument"); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
123 |
} |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
124 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
125 |
Usage("") if ($help); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
126 |
Usage("Too few arguments....use at least one from -n|new-rev|new-label|label|rev or -bom") if ($new eq "" && $packagelist eq ""); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
127 |
#Usage("Too many arguments") if ($new ne "" && $packagelist ne ""); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
128 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
129 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
130 |
if ($old eq 'null') |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
131 |
{ |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
132 |
print "\nCode size calculation....\n"; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
133 |
} |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
134 |
else |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
135 |
{ |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
136 |
print "\nCode churn calculation....\n"; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
137 |
} |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
138 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
139 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
140 |
my @packagelistopts = (); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
141 |
@packagelistopts = ("-packagelist", $packagelist) if ($packagelist ne ""); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
142 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
143 |
my @verboseopt = (); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
144 |
@verboseopt = "-v" if ($verbose); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
145 |
|
158
27cf0a88d449
Made the '-mirror' switch optional
Chetan Kapoor <chetank@symbian.org>
parents:
55
diff
changeset
|
146 |
my @mirroropt = (); |
27cf0a88d449
Made the '-mirror' switch optional
Chetan Kapoor <chetank@symbian.org>
parents:
55
diff
changeset
|
147 |
@mirroropt = "-mirror" if ($mirror); |
27cf0a88d449
Made the '-mirror' switch optional
Chetan Kapoor <chetank@symbian.org>
parents:
55
diff
changeset
|
148 |
|
49
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
149 |
my $new_rev = $new; |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
150 |
$new_rev = "%REV%" if ($new_rev eq ""); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
151 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
152 |
#TO_DO: Locate clone_all_packages relative to the location of this script. |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
153 |
#TO_DO: Remove references to absolute paths, change to relative paths. |
158
27cf0a88d449
Made the '-mirror' switch optional
Chetan Kapoor <chetank@symbian.org>
parents:
55
diff
changeset
|
154 |
do_system($clone_packages,@verboseopt,@mirroropt,"-filter","$licence.*$codeline.*$filter",@packagelistopts,"-exec","--", |
49
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
155 |
"hg","--config","\"extensions.hgext.extdiff=\"","extdiff","-p",$churn_core,"-o",$churn_output_temp, |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
156 |
"-r","$old","-r","$new_rev"); |
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
157 |
|
c0d2a34bf681
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff
changeset
|
158 |
exit(0); |