line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MyCPAN::App::DPAN::Indexer; |
2
|
2
|
|
|
2
|
|
2787
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
87
|
|
3
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
72
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
863
|
use subs qw(get_caller_info); |
|
2
|
|
|
|
|
34
|
|
|
2
|
|
|
|
|
17
|
|
6
|
2
|
|
|
2
|
|
88
|
use vars qw($VERSION $logger); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
218
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# don't change the inheritance order |
9
|
|
|
|
|
|
|
# this should be done with roles, but we don't quite have that yet |
10
|
|
|
|
|
|
|
# it's a problem with who's cleanup() get called |
11
|
2
|
|
|
2
|
|
14
|
use base qw(MyCPAN::App::BackPAN::Indexer MyCPAN::Indexer); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
6305
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$VERSION = '1.28_11'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
MyCPAN::App::DPAN::Indexer - Create a D(ark)PAN out of the indexed distributions |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use MyCPAN::Indexer; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This module implements the indexer_class and reporter_class components |
26
|
|
|
|
|
|
|
to allow C to create a CPAN-like directory structure |
27
|
|
|
|
|
|
|
with its associated index files. This application of MyCPAN::Indexer is |
28
|
|
|
|
|
|
|
specifically aimed at creating a 02packages.details file, so it |
29
|
|
|
|
|
|
|
strives to collect a minimum of information. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
It runs through the indexing and prints a report at the end of the run. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
2
|
|
77300
|
use Cwd qw(cwd); |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
121
|
|
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
2
|
|
12
|
use Log::Log4perl; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
48
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
BEGIN { |
40
|
2
|
|
|
2
|
|
76
|
$logger = Log::Log4perl->get_logger( 'Indexer' ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Override the exit from the parent class so we can embed a run |
44
|
|
|
|
|
|
|
# inside a bigger application. Applications should override this |
45
|
|
|
|
|
|
|
# on their own to do any final processing they want. |
46
|
0
|
|
|
0
|
|
0
|
sub _exit { 1 } |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__PACKAGE__->activate( @ARGV ) unless caller; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 Indexer class |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=over 4 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item examine_dist_steps |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Returns the list of techniques that C should use |
57
|
|
|
|
|
|
|
to index distributions. See the documentation in |
58
|
|
|
|
|
|
|
C. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
For DPAN, unpack the dist, ensure you are in the dist directory, |
61
|
|
|
|
|
|
|
the find the modules. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub examine_dist_steps |
66
|
|
|
|
|
|
|
{ |
67
|
|
|
|
|
|
|
( |
68
|
|
|
|
|
|
|
# method error message fatal |
69
|
1
|
|
|
1
|
1
|
2693
|
[ 'unpack_dist', "Could not unpack distribution!", 1 ], |
70
|
|
|
|
|
|
|
[ 'find_dist_dir', "Did not find distro directory!", 1 ], |
71
|
|
|
|
|
|
|
[ 'find_modules', "Could not find modules!", 1 ], |
72
|
|
|
|
|
|
|
[ 'examine_modules', "Could not process modules!", 0 ], |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item find_module_techniques |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Returns the list of techniques that C should use |
79
|
|
|
|
|
|
|
to look for Perl module files. See the documentation in |
80
|
|
|
|
|
|
|
C. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub find_module_techniques |
85
|
|
|
|
|
|
|
{ |
86
|
1
|
|
|
1
|
1
|
6436
|
my( $self ) = @_; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=pod |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Save this feature for another time |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
my $config = $self->get_coordinator->get_config; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
if( my @techniques = $config->get( 'find_module_techniques' ) ) |
95
|
|
|
|
|
|
|
{ |
96
|
|
|
|
|
|
|
$logger->debug( "Using techniques [@techniques] to find modules" ); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
@techniques = map { |
99
|
|
|
|
|
|
|
my $can = $self->can( $_ ); |
100
|
|
|
|
|
|
|
$logger->warn( "The technique [$_] is unknown" ) |
101
|
|
|
|
|
|
|
unless $can; |
102
|
|
|
|
|
|
|
$can ? [ $_, 'Technique $_ specified by config' ] : (); |
103
|
|
|
|
|
|
|
} @techniques; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
return \@techniques; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
( |
112
|
1
|
|
|
|
|
6
|
[ 'look_in_cwd_and_lib', "Guessed from looking in lib/" ], |
113
|
|
|
|
|
|
|
[ 'look_in_lib', "Guessed from looking in lib/" ], |
114
|
|
|
|
|
|
|
[ 'look_in_cwd', "Guessed from looking in cwd" ], |
115
|
|
|
|
|
|
|
[ 'look_in_meta_yml_provides', "Guessed from looking in META.yml" ], |
116
|
|
|
|
|
|
|
[ 'look_for_pm', "Guessed from looking in cwd" ], |
117
|
|
|
|
|
|
|
); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item get_module_info_tasks |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Returns the list of techniques that C should use |
123
|
|
|
|
|
|
|
to extract data from Perl module files. See the documentation in |
124
|
|
|
|
|
|
|
C. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub get_module_info_tasks |
129
|
|
|
|
|
|
|
{ |
130
|
|
|
|
|
|
|
( |
131
|
1
|
|
|
1
|
1
|
8203
|
[ 'extract_module_namespaces', 'Extract the namespaces a file declares' ], |
132
|
|
|
|
|
|
|
[ 'extract_module_version', 'Extract the version of the module' ], |
133
|
|
|
|
|
|
|
) |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item setup_run_info |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Like C in C, but it remembers fewer |
139
|
|
|
|
|
|
|
things. The DarkPAN census really just cares about finding packages, |
140
|
|
|
|
|
|
|
so the details about the run aren't as interesting. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub setup_run_info |
145
|
|
|
|
|
|
|
{ |
146
|
|
|
|
|
|
|
# TRACE( sub { get_caller_info } ); |
147
|
|
|
|
|
|
|
|
148
|
1
|
|
|
1
|
1
|
22929
|
$_[0]->set_run_info( 'root_working_dir', cwd() ); |
149
|
1
|
|
|
|
|
159
|
$_[0]->set_run_info( 'run_start_time', time ); |
150
|
1
|
|
|
|
|
36
|
$_[0]->set_run_info( 'completed', 0 ); |
151
|
1
|
|
|
|
|
33
|
$_[0]->set_run_info( 'pid', $$ ); |
152
|
1
|
|
|
|
|
51
|
$_[0]->set_run_info( 'ppid', $_[0]->getppid ); |
153
|
|
|
|
|
|
|
|
154
|
1
|
|
|
|
|
73
|
$_[0]->set_run_info( 'indexer', ref $_[0] ); |
155
|
1
|
|
|
|
|
52
|
$_[0]->set_run_info( 'indexer_versions', $_[0]->VERSION ); |
156
|
|
|
|
|
|
|
|
157
|
1
|
|
|
|
|
25
|
return 1; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item setup_dist_info |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Like C in C, but it remembers fewer |
164
|
|
|
|
|
|
|
things. The test census really just cares about statements in the test |
165
|
|
|
|
|
|
|
files, so the details about the distribution aren't as interesting. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=cut |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub setup_dist_info |
170
|
|
|
|
|
|
|
{ |
171
|
|
|
|
|
|
|
# TRACE( sub { get_caller_info } ); |
172
|
|
|
|
|
|
|
|
173
|
0
|
|
|
0
|
1
|
|
my( $self, $dist ) = @_; |
174
|
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
|
$logger->debug( "Setting dist [$dist]\n" ); |
176
|
0
|
|
|
|
|
|
$self->set_dist_info( 'dist_file', $dist ); |
177
|
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
return 1; |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=back |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 SOURCE AVAILABILITY |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
This code is in Github: |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
git://github.com/briandfoy/mycpan-indexer.git |
188
|
|
|
|
|
|
|
git://github.com/briandfoy/mycpan--app--dpan.git |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 AUTHOR |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
brian d foy, C<< >> |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Copyright (c) 2008-2010, brian d foy, All Rights Reserved. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
You may redistribute this under the same terms as Perl itself. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |