line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Smoker::Utils; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
118710
|
use warnings; |
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
57
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
36
|
|
5
|
2
|
|
|
2
|
|
7
|
use Exporter 'import'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
54
|
|
6
|
2
|
|
|
2
|
|
2946
|
use CPAN; |
|
2
|
|
|
|
|
520991
|
|
|
2
|
|
|
|
|
928
|
|
7
|
2
|
|
|
2
|
|
48
|
use CPAN::HandleConfig; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
1068
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw(is_distro_ok block_distro); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 'v1.0.0'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=pod |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
CPAN::Smoker::Utils - Set of CLI's to manage a Perl CPAN smoker machine |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
This module exports some functions used to manage a smoker testing machine |
22
|
|
|
|
|
|
|
based on L. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 Command Line Interfaces programs |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
The following programs are available under this distribution: |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=over |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=item * |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
dblock: blocks a distribution to be tested in the smoker. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=item * |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
mirror_cleanup: further removes spurious files from a local CPAN mirror. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item * |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
send_reports: send local stored tests results to a running metabase::relayd |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=back |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
You can check each program online documentation by using C, |
45
|
|
|
|
|
|
|
C and C after installing the |
46
|
|
|
|
|
|
|
distribution. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 EXPORTS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Only the C C is exported, if explicit requested. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 is_distro_ok |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Expects as parameter a string in the format C. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
It executes some very basic testing against the string. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Returns true or false depending if the string passes the tests. It will also |
59
|
|
|
|
|
|
|
C if things are not OK. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub is_distro_ok { |
64
|
151
|
|
|
151
|
1
|
35685
|
my $distro = shift; |
65
|
|
|
|
|
|
|
|
66
|
151
|
50
|
|
|
|
270
|
unless ( defined($distro) ) { |
67
|
0
|
|
|
|
|
0
|
warn "--distro is a required parameter!\n\n"; |
68
|
0
|
|
|
|
|
0
|
return 0; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
151
|
100
|
|
|
|
778
|
unless ( $distro =~ /^\w+\/[\w-]+$/ ) { |
72
|
1
|
|
|
|
|
14
|
warn "invalid string '$distro' in --distro!\n\n"; |
73
|
1
|
|
|
|
|
8
|
return 0; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
else { |
76
|
150
|
|
|
|
|
483
|
return 1; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 block_distro |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Blocks a distribution to be tested under the smoker by using a distroprefs file. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Expects as parameters: |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=over |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item 1. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
a distribution name (for example, "JOHNDOE/Some-Distro-Name"). |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item 2. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
The perl interpreter (which is in execution) configuration. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item 3. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
An comment to include in the distroprefs file. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=back |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
It returns a hash reference containing keys/values that could be directly |
103
|
|
|
|
|
|
|
serialized to YAML (or other format) but the C key, that contains |
104
|
|
|
|
|
|
|
a suggest complete path to the distroprefs file (based on the L |
105
|
|
|
|
|
|
|
C configuration client. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
If there is an already file created as defined in C key, it will |
108
|
|
|
|
|
|
|
C and return C. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub block_distro { |
113
|
2
|
|
|
2
|
1
|
423
|
my ( $distro, $perl_info, $comment ) = @_; |
114
|
2
|
|
|
|
|
5
|
my $distribution = '^' . $distro; |
115
|
2
|
|
|
|
|
5
|
my $filename = "$distro.yml"; |
116
|
2
|
|
|
|
|
22
|
$filename =~ s/\//./; |
117
|
|
|
|
|
|
|
|
118
|
2
|
|
50
|
|
|
13
|
my %data = ( |
119
|
|
|
|
|
|
|
comment => $comment || 'Tests hang smoker', |
120
|
|
|
|
|
|
|
match => { |
121
|
|
|
|
|
|
|
distribution => $distribution, |
122
|
|
|
|
|
|
|
perlconfig => $perl_info |
123
|
|
|
|
|
|
|
}, |
124
|
|
|
|
|
|
|
disabled => 1 |
125
|
|
|
|
|
|
|
); |
126
|
|
|
|
|
|
|
|
127
|
2
|
|
|
|
|
9
|
CPAN::HandleConfig->load; |
128
|
2
|
|
|
|
|
126
|
my $prefs_dir = $CPAN::Config->{prefs_dir}; |
129
|
2
|
50
|
|
|
|
27
|
die "$prefs_dir does not exist or it is not readable\n" |
130
|
|
|
|
|
|
|
unless ( -d $prefs_dir ); |
131
|
2
|
|
|
|
|
22
|
my $full_path = File::Spec->catfile( $prefs_dir, $filename ); |
132
|
|
|
|
|
|
|
|
133
|
2
|
50
|
|
|
|
34
|
if ( -f $full_path ) { |
134
|
0
|
|
|
|
|
0
|
warn "$full_path already exists, will not overwrite it."; |
135
|
0
|
|
|
|
|
0
|
return; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
else { |
138
|
2
|
|
|
|
|
7
|
$data{full_path} = $full_path; |
139
|
2
|
|
|
|
|
8
|
return \%data; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 SEE ALSO |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
For more details about those programs interact with the smoker and |
146
|
|
|
|
|
|
|
L, be sure to read the documentation about L client, |
147
|
|
|
|
|
|
|
specially the part about DistroPrefs. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
You will also want to take a look at the following programs documentation: |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=over |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item * |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
C |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
C |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item * |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
C |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=back |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 AUTHOR |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, Earfreitas@cpan.orgE |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
This software is copyright (c) 2017 of Alceu Rodrigues de Freitas Junior, |
174
|
|
|
|
|
|
|
arfreitas@cpan.org |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This file is part of CPAN Smoker Utils. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
CPAN Smoker Utils is free software: you can redistribute it and/or modify |
179
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
180
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
181
|
|
|
|
|
|
|
(at your option) any later version. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
CPAN Smoker Utils is distributed in the hope that it will be useful, |
184
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
185
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
186
|
|
|
|
|
|
|
GNU General Public License for more details. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
189
|
|
|
|
|
|
|
along with CPAN Smoker Utils. If not, see . |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=cut |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
1; |