1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
#!perl
# Generates info for perlhist from this perl tree
# run this from the root of a perl tree
#
# Data is on STDOUT.
use 5.010000;
use File::Find;
use warnings;
use strict;
sub calc_core {
my @core;
push @core, glob '*.h';
push @core, glob '*.c';
push @core, glob '*.y';
my $coresize = 0;
foreach my $corefile (@core) {
$coresize += (-s $corefile) / 1000;
}
my $corenumber = scalar @core;
$coresize = int $coresize;
say "core: $coresize $corenumber";
}
sub calc_lib {
our $libsize = 0;
our $libnumber = 0;
sub wanted_lib {
$File::Find::name =~ /[.] (?:pm|pl)\z/msx or return;
$libsize += (-s $_) / 1000;
$libnumber++;
}
find(\&wanted_lib, 'lib');
$libsize = int $libsize;
say "lib: $libsize $libnumber";
}
sub calc_ext {
our $extsize = 0;
our $extnumber = 0;
sub wanted_ext {
$File::Find::name =~ /[.] (?:h|c|y|t|xs|pm)\z/msx or return;
$extsize += (-s $_) / 1000;
$extnumber++;
}
if (-d 'dist') {
find(\&wanted_ext, 'ext', 'dist', 'cpan');
} else {
find(\&wanted_ext, 'ext');
}
$extsize = int $extsize;
say "ext: $extsize $extnumber";
}
sub calc_t {
our $tsize = 0;
our $tnumber = 0;
sub wanted_t {
$File::Find::name =~ /[.] t\z/msx or return;
$tsize += (-s $_) / 1000;
$tnumber++;
}
find(\&wanted_t, '.');
$tsize = int $tsize;
say "t: $tsize $tnumber";
}
sub calc_doc {
my @doc;
push @doc, 'INSTALL';
push @doc, 'README';
push @doc, glob 'README.*';
our $docsize = 0;
foreach my $docfile (@doc) {
$docsize += (-s $docfile) / 1000;
}
our $docnumber = scalar @doc;
sub wanted_doc {
$File::Find::name =~ /[.] pod\z/msx or return;
$docsize += (-s $_) / 1000;
$docnumber++;
}
find(\&wanted_doc, 'pod');
$docsize = int $docsize;
say "doc: $docsize $docnumber";
}
sub calc_dir {
my $dir = shift;
return if ! -d $dir;
our $dirnumber = 0;
our $dirsize = 0;
sub wanted_dir {
$dirsize += (-s $_) / 1000;
$dirnumber++;
}
find(\&wanted_dir, $dir);
$dirsize = int $dirsize;
say "$dir: $dirsize $dirnumber";
}
sub calc_longtable {
print "\n\nTable\n";
foreach my $dir (qw(beos)) {
calc_dir($dir);
}
my $configure_size = int ((-s 'Configure') / 1000);
say "Configure: $configure_size 1";
foreach my $dir (qw(Cross djgpp emacs epoc h2pl hints mad mint mpeix NetWare os2 plan9 Porting qnx symbian utils vms vos win32 x2p)) {
calc_dir($dir);
}
}
say "Selected release sizes for perl tarball:";
print "\n";
calc_core();
calc_lib();
calc_ext();
calc_t();
calc_doc();
calc_longtable();
exit;
|