line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::CheckDeps; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Test::CheckDeps::VERSION = '0.010'; |
4
|
|
|
|
|
|
|
} |
5
|
1
|
|
|
1
|
|
23848
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use Exporter 5.57 'import'; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
79
|
|
9
|
|
|
|
|
|
|
our @EXPORT = qw/check_dependencies/; |
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw/check_dependencies_opts/; |
11
|
|
|
|
|
|
|
our %EXPORT_TAGS = (all => [ @EXPORT, @EXPORT_OK ] ); |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
919
|
use CPAN::Meta 2.120920; |
|
1
|
|
|
|
|
35575
|
|
|
1
|
|
|
|
|
41
|
|
14
|
1
|
|
|
1
|
|
969
|
use CPAN::Meta::Check 0.007 qw/check_requirements requirements_for/; |
|
1
|
|
|
|
|
21967
|
|
|
1
|
|
|
|
|
106
|
|
15
|
1
|
|
|
1
|
|
10
|
use List::Util qw/first/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
77
|
|
16
|
1
|
|
|
1
|
|
6
|
use Test::Builder; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
527
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $builder = Test::Builder->new; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my %level_of = ( |
21
|
|
|
|
|
|
|
requires => 0, |
22
|
|
|
|
|
|
|
classic => 1, |
23
|
|
|
|
|
|
|
recommends => 2, |
24
|
|
|
|
|
|
|
suggests => 3, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub check_dependencies { |
28
|
1
|
|
50
|
1
|
1
|
891
|
my $level = $level_of{shift || 'classic'}; |
29
|
1
|
|
|
|
|
3
|
local $Test::Builder::Level = $Test::Builder::Level + 1; |
30
|
1
|
50
|
|
1
|
|
8
|
my $metafile = first { -e $_ } qw/MYMETA.json MYMETA.yml META.json META.yml/ or return $builder->ok(0, "No META information provided\n"); |
|
1
|
|
|
|
|
19
|
|
31
|
1
|
|
|
|
|
13
|
my $meta = CPAN::Meta->load_file($metafile); |
32
|
1
|
|
|
|
|
38626
|
check_dependencies_opts($meta, $_, 'requires') for qw/configure build test runtime/; |
33
|
1
|
50
|
|
|
|
11
|
check_dependencies_opts($meta, 'runtime', 'conflicts') if $level >= $level_of{classic}; |
34
|
1
|
50
|
|
|
|
4
|
if ($level >= $level_of{recommends}) { |
35
|
1
|
|
|
|
|
5
|
$builder->todo_start('recommends are not mandatory'); |
36
|
1
|
|
|
|
|
48
|
check_dependencies_opts($meta, $_, 'recommends') for qw/configure build test runtime/; |
37
|
1
|
|
|
|
|
9
|
$builder->todo_end(); |
38
|
|
|
|
|
|
|
|
39
|
1
|
50
|
|
|
|
19
|
if ($level >= $level_of{suggests}) { |
40
|
0
|
|
|
|
|
0
|
$builder->todo_start('suggests are not mandatory'); |
41
|
0
|
|
|
|
|
0
|
check_dependencies_opts($meta, $_, 'suggests') for qw/configure build test runtime/; |
42
|
0
|
|
|
|
|
0
|
$builder->todo_end(); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
1
|
50
|
|
|
|
5
|
check_dependencies_opts($meta, 'develop', 'requires') if $ENV{AUTHOR_TESTING}; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
32
|
return; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub check_dependencies_opts { |
51
|
9
|
|
|
9
|
1
|
25
|
my ($meta, $phases, $type) = @_; |
52
|
|
|
|
|
|
|
|
53
|
9
|
|
|
|
|
39
|
my $reqs = requirements_for($meta, $phases, $type); |
54
|
9
|
|
|
|
|
47045
|
my $raw = $reqs->as_string_hash; |
55
|
9
|
|
|
|
|
263
|
my $ret = check_requirements($reqs, $type); |
56
|
|
|
|
|
|
|
|
57
|
9
|
|
|
|
|
133035
|
local $Test::Builder::Level = $Test::Builder::Level + 1; |
58
|
9
|
|
|
|
|
17
|
for my $module (sort keys %{$ret}) { |
|
9
|
|
|
|
|
52
|
|
59
|
12
|
50
|
|
|
|
4156
|
$builder->ok(!defined $ret->{$module}, "$module satisfies '" . $raw->{$module} . "'") |
60
|
|
|
|
|
|
|
or $builder->diag($ret->{$module}); |
61
|
|
|
|
|
|
|
# Note: when in a TODO, diag behaves like note |
62
|
|
|
|
|
|
|
} |
63
|
9
|
|
|
|
|
1592
|
return; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
#ABSTRACT: Check for presence of dependencies |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# vim: set ts=2 sw=2 noet nolist : |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |