line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::BrewBuild::Regex; |
2
|
39
|
|
|
39
|
|
712
|
use strict; |
|
39
|
|
|
|
|
88
|
|
|
39
|
|
|
|
|
1114
|
|
3
|
39
|
|
|
39
|
|
219
|
use warnings; |
|
39
|
|
|
|
|
77
|
|
|
39
|
|
|
|
|
1442
|
|
4
|
|
|
|
|
|
|
|
5
|
39
|
|
|
39
|
|
197
|
use Carp qw(croak); |
|
39
|
|
|
|
|
84
|
|
|
39
|
|
|
|
|
1776
|
|
6
|
39
|
|
|
39
|
|
349
|
use Exporter qw(import); |
|
39
|
|
|
|
|
78
|
|
|
39
|
|
|
|
|
27136
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '2.21'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT = qw( |
11
|
|
|
|
|
|
|
re_brewbuild |
12
|
|
|
|
|
|
|
re_brewcommands |
13
|
|
|
|
|
|
|
re_dispatch |
14
|
|
|
|
|
|
|
re_git |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my %brewbuild = ( |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
check_failed => qr{failed.*?See\s+(.*?)\s+for details}, |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
check_result => qr{ |
22
|
|
|
|
|
|
|
[Pp]erl-\d\.\d+\.\d+(?:_\w+)? |
23
|
|
|
|
|
|
|
\s+===.*? |
24
|
|
|
|
|
|
|
(?=(?:[Pp]erl-\d\.\d+\.\d+(?:_\w+)?\s+===|$)) |
25
|
|
|
|
|
|
|
}xs, |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
extract_dzil_dist_name => qr{^name\s+=\s+(.*)$}, |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
extract_dzil_dist_version => qr{^version\s+=\s+(.*)$}, |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
extract_errors => qr{ |
32
|
|
|
|
|
|
|
cpanm\s+\(App::cpanminus\) |
33
|
|
|
|
|
|
|
.*? |
34
|
|
|
|
|
|
|
(?=(?:cpanm\s+\(App::cpanminus\)|$)) |
35
|
|
|
|
|
|
|
}xs, |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
extract_error_perl_ver => qr{cpanm.*?perl\s(5\.\d+)\s}, |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
extract_result => qr{ |
40
|
|
|
|
|
|
|
([Pp]erl-\d\.\d+\.\d+(?:_\w+)?\s+=+?) |
41
|
|
|
|
|
|
|
(\s+.*?) |
42
|
|
|
|
|
|
|
(?=(?:[Pp]erl-\d\.\d+\.\d+(?:_\w+)?\s+===|$)) |
43
|
|
|
|
|
|
|
}xs, |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
extract_perl_version => qr{^([Pp]erl-\d\.\d+\.\d+(_\d{2})?)}, |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my %brewcommands = ( |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
available_berrybrew => qr{(\d\.\d+\.\d+_\d+)}, |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
available_perlbrew => qr{(?
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
installed_berrybrew => qr{(\d\.\d{2}\.\d(?:_\d{2}))(?!=_)\s+\[installed\]}i, |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
installed_perlbrew => qr{i\s+(perl-\d\.\d+\.\d+)}, |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
using_berrybrew => qr{(\d\.\d{2}\.\d(?:_\d{2}))(?!=_)\s+\[installed\]\s+\*}i, |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my %dispatch = ( |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
extract_short_results => qr{(5\.\d{1,2}\.\d{1,2} :: \w{4})}, |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my %git = ( |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
extract_repo_name => qr{.*/(.*?)(?:\.git)*$}, |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
extract_commit_csum => qr{([A-F0-9]{40})\s+HEAD}i, |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub re_brewbuild { |
74
|
0
|
|
|
0
|
1
|
0
|
my $re = shift; |
75
|
0
|
|
|
|
|
0
|
_check(\%brewbuild, $re); |
76
|
0
|
|
|
|
|
0
|
return $brewbuild{$re}; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
sub re_brewcommands { |
79
|
1
|
|
|
1
|
1
|
7
|
my $re = shift; |
80
|
1
|
|
|
|
|
15
|
_check(\%brewcommands, $re); |
81
|
1
|
|
|
|
|
15
|
return $brewcommands{$re}; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
sub re_dispatch { |
84
|
0
|
|
|
0
|
1
|
0
|
my $re = shift; |
85
|
0
|
|
|
|
|
0
|
_check(\%dispatch, $re); |
86
|
0
|
|
|
|
|
0
|
return $dispatch{$re}; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
sub re_git { |
89
|
0
|
|
|
0
|
1
|
0
|
my $re = shift; |
90
|
0
|
|
|
|
|
0
|
_check(\%git, $re); |
91
|
0
|
|
|
|
|
0
|
return $git{$re}; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
sub _check { |
94
|
1
|
|
|
1
|
|
12
|
my ($module, $re) = @_; |
95
|
|
|
|
|
|
|
croak "regex '$re' doesn't exist for re_${module}()" |
96
|
1
|
50
|
|
|
|
16
|
if ! exists $module->{$re}; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 NAME |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Test::BrewBuild::Regex - Various regexes for the Test::BrewBuild platform |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 SYNOPSIS |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
use Test::BrewBuild::Regex; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
my $results = ...; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
my $re = re_brewbuild('extract_perl_version'); |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
if ($results =~ /$re/){ |
114
|
|
|
|
|
|
|
... |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# or, use the call inline with the deref trick |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
if ($results =~ /${ re_brewbuild('extract_perl_version') }/){ |
120
|
|
|
|
|
|
|
... |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 DESCRIPTION |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Single location for all regexes used throughout Test::BrewBuild. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 FUNCTIONS |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
All functions are exported by default. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 re_brewbuild($re_name) |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Provides regexes for the L library. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Available regexes are: |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
check_failed |
138
|
|
|
|
|
|
|
check_result |
139
|
|
|
|
|
|
|
extract_dist_name |
140
|
|
|
|
|
|
|
extract_dist_version |
141
|
|
|
|
|
|
|
extract_errors |
142
|
|
|
|
|
|
|
extract_error_perl_ver |
143
|
|
|
|
|
|
|
extract_result |
144
|
|
|
|
|
|
|
extract_perl_version |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 re_brewcommands($re_name) |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Provides regexes for the L library. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Available regexes are: |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
available_berrybrew |
153
|
|
|
|
|
|
|
available_perlbrew |
154
|
|
|
|
|
|
|
installed_berrybrew |
155
|
|
|
|
|
|
|
installed_perlbrew |
156
|
|
|
|
|
|
|
using_berrybrew |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 re_dispatch($re_name) |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Provides regexes for the L library. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Available regexes are: |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
extract_short_results |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head2 re_git($re_name) |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Provides regexes for the L library. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Available regexes are: |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
extract_repo_name |
173
|
|
|
|
|
|
|
extract_commit_csum |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 AUTHOR |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Steve Bertrand, C<< >> |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Copyright 2017 Steve Bertrand. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
184
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
185
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
See L for more information. |