line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MyCPAN::App::DPAN; |
2
|
1
|
|
|
1
|
|
895
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use base qw(MyCPAN::App::BackPAN::Indexer); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
927
|
|
6
|
1
|
|
|
1
|
|
129953
|
use vars qw($VERSION $logger); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
72
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use Cwd qw(cwd); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
9
|
1
|
|
|
1
|
|
8
|
use File::Spec::Functions; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
159
|
|
10
|
1
|
|
|
1
|
|
7
|
use Log::Log4perl; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$VERSION = '1.28'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
BEGIN { |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
338
|
$SIG{INT} = sub { exit }; |
|
0
|
|
|
|
|
0
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
8459
|
my $cwd = cwd(); |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
36
|
my $report_dir = catfile( $cwd, 'indexer_reports' ); |
21
|
|
|
|
|
|
|
|
22
|
1
|
50
|
|
|
|
57
|
my %Defaults = ( |
23
|
|
|
|
|
|
|
ignore_packages => 'main MY MM DB bytes DynaLoader', |
24
|
|
|
|
|
|
|
indexer_class => 'MyCPAN::App::DPAN::Indexer', |
25
|
|
|
|
|
|
|
dispatcher_class => 'MyCPAN::Indexer::Dispatcher::Serial', |
26
|
|
|
|
|
|
|
queue_class => 'MyCPAN::App::DPAN::SkipQueue', |
27
|
|
|
|
|
|
|
organize_dists => 0, |
28
|
|
|
|
|
|
|
parallel_jobs => 1, |
29
|
|
|
|
|
|
|
pause_id => 'DPAN', |
30
|
|
|
|
|
|
|
reporter_class => 'MyCPAN::App::DPAN::Reporter::Minimal', |
31
|
|
|
|
|
|
|
backpan_dir => $cwd, |
32
|
|
|
|
|
|
|
fresh_start => defined $ENV{DPAN_FRESH_START} ? $ENV{DPAN_FRESH_START} : 0, |
33
|
|
|
|
|
|
|
skip_perl => 0, |
34
|
|
|
|
|
|
|
extra_reports_dir => undef, |
35
|
|
|
|
|
|
|
i_ignore_errors_at_my_peril => 0, |
36
|
|
|
|
|
|
|
ignore_missing_dists => 0, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub default_keys |
40
|
|
|
|
|
|
|
{ |
41
|
0
|
|
|
0
|
0
|
|
my %Seen; |
42
|
0
|
|
|
|
|
|
grep { ! $Seen{$_}++ } keys %Defaults, $_[0]->SUPER::default_keys; |
|
0
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub default |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
0
|
|
0
|
0
|
|
exists $Defaults{ $_[1] } |
48
|
|
|
|
|
|
|
? |
49
|
|
|
|
|
|
|
$Defaults{ $_[1] } |
50
|
|
|
|
|
|
|
: |
51
|
|
|
|
|
|
|
$_[0]->SUPER::default( $_[1] ); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
31
|
$logger = Log::Log4perl->get_logger( 'backpan_indexer' ); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub activate_steps |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
|
|
0
|
0
|
|
qw( |
60
|
|
|
|
|
|
|
process_options |
61
|
|
|
|
|
|
|
setup_coordinator |
62
|
|
|
|
|
|
|
setup_environment |
63
|
|
|
|
|
|
|
handle_config |
64
|
|
|
|
|
|
|
setup_logging |
65
|
|
|
|
|
|
|
fresh_start |
66
|
|
|
|
|
|
|
setup_dirs |
67
|
|
|
|
|
|
|
run_components |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub components |
72
|
|
|
|
|
|
|
{ |
73
|
|
|
|
|
|
|
( |
74
|
0
|
|
|
0
|
0
|
|
[ qw( queue MyCPAN::Indexer::Queue get_queue ) ], |
75
|
|
|
|
|
|
|
[ qw( dispatcher MyCPAN::Indexer::Dispatcher::Serial get_dispatcher ) ], |
76
|
|
|
|
|
|
|
[ qw( reporter MyCPAN::App::DPAN::Reporter::Minimal get_reporter ) ], |
77
|
|
|
|
|
|
|
[ qw( worker MyCPAN::Indexer::Worker get_task ) ], |
78
|
|
|
|
|
|
|
[ qw( interface MyCPAN::Indexer::Interface::Text do_interface ) ], |
79
|
|
|
|
|
|
|
) |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub fresh_start |
83
|
|
|
|
|
|
|
{ |
84
|
0
|
|
|
0
|
0
|
|
my( $application ) = @_; |
85
|
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
|
return unless $application->get_coordinator->get_config->fresh_start; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my $indexer_reports_dir = $application->get_coordinator->get_config->report_dir; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
require File::Path; |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
File::Path::remove_tree( $indexer_reports_dir ); |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
return 1; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub activate_end |
98
|
|
|
|
|
|
|
{ |
99
|
0
|
|
|
0
|
0
|
|
my( $application ) = @_; |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
my $reporter = $application->get_coordinator->get_reporter; |
102
|
|
|
|
|
|
|
|
103
|
0
|
0
|
|
|
|
|
if( $reporter->can( 'create_index_files' ) ) |
104
|
|
|
|
|
|
|
{ |
105
|
0
|
|
|
|
|
|
$reporter->create_index_files; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
else |
108
|
|
|
|
|
|
|
{ |
109
|
0
|
|
|
|
|
|
$logger->warn( 'Reporter class is missing create_index_files!' ); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
$application->SUPER::activate_end; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
1; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 NAME |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
MyCPAN::App::DPAN - Create a CPAN-like structure out of some dists |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 SYNOPSIS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
use MyCPAN::App::DPAN; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
my $application = MyCPAN::App::DPAN->activate( @ARGV ); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# do some other stuff, anything that you like |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
$application->activate_end; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 DESCRIPTION |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
This module ties together all the bits to let the C do its work. It |
135
|
|
|
|
|
|
|
overrides the defaults in C to provide the |
136
|
|
|
|
|
|
|
right components. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
The work happens in two steps. When you call C, the program goes |
139
|
|
|
|
|
|
|
through all of the steps to examin each of the module distributions. It creates |
140
|
|
|
|
|
|
|
a report for each distribution, then stops. This pause right after the |
141
|
|
|
|
|
|
|
examination gives you the chance to do something right before the program |
142
|
|
|
|
|
|
|
creates the PAUSE index files. The examination might take several minutes |
143
|
|
|
|
|
|
|
(or even hours depending on how much you want to index), so you have a chance |
144
|
|
|
|
|
|
|
to check the state of the world before the next step. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
When you call C, the program takes the results from the |
147
|
|
|
|
|
|
|
previous step and creates the PAUSE index files in the F directory. |
148
|
|
|
|
|
|
|
This step should be very quick since all of the information is ready-to-go. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 SOURCE AVAILABILITY |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This code is in Github: |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
git://github.com/briandfoy/mycpan-indexer.git |
157
|
|
|
|
|
|
|
git://github.com/briandfoy/mycpan--app--dpan.git |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 AUTHOR |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
brian d foy, C<< >> |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Copyright (c) 2008-2009, brian d foy, All Rights Reserved. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
You may redistribute this under the same terms as Perl itself. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=cut |