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