line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Carmel::Artifact; |
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
3
|
1
|
|
|
1
|
|
460
|
use CPAN::Meta; |
|
1
|
|
|
|
|
17748
|
|
|
1
|
|
|
|
|
27
|
|
4
|
1
|
|
|
1
|
|
641
|
use JSON (); |
|
1
|
|
|
|
|
8907
|
|
|
1
|
|
|
|
|
21
|
|
5
|
1
|
|
|
1
|
|
6
|
use Path::Tiny (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
639
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
0
|
|
|
0
|
0
|
|
my($class, $path) = @_; |
9
|
0
|
|
|
|
|
|
bless { path => Path::Tiny->new($path) }, $class; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
0
|
0
|
|
sub path { $_[0]->{path} } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub install { |
15
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
16
|
0
|
|
0
|
|
|
|
$self->{install} ||= $self->_build_install; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _build_install { |
20
|
0
|
|
|
0
|
|
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $file = $self->path->child("blib/meta/install.json"); |
23
|
0
|
0
|
|
|
|
|
if ($file->exists) { |
24
|
0
|
|
|
|
|
|
return JSON::decode_json($file->slurp); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
die "Can't read build artifact from ", $self->path; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub provides { |
31
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
32
|
0
|
|
|
|
|
|
$self->install->{provides}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# "cpanm" => ".../blib/script/cpanm" |
36
|
|
|
|
|
|
|
sub executables { |
37
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
38
|
0
|
|
|
0
|
|
|
$self->_find_files(sub { shift !~ /\.exists$/ }, $self->paths); |
|
0
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# "Foo/Bar.pm" => ".../blib/lib/Foo/Bar.pm" |
42
|
|
|
|
|
|
|
sub module_files { |
43
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
44
|
0
|
|
|
0
|
|
|
$self->_find_files(sub { shift =~ /\.pm$/ }, $self->libs); |
|
0
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _find_files { |
48
|
0
|
|
|
0
|
|
|
my($self, $what, @dirs) = @_; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my %found; |
51
|
0
|
|
|
|
|
|
for my $dir (@dirs) { |
52
|
|
|
|
|
|
|
$dir->visit( |
53
|
|
|
|
|
|
|
sub { |
54
|
0
|
|
|
0
|
|
|
my($path, $state) = @_; |
55
|
0
|
0
|
0
|
|
|
|
if ($path->is_file && $what->($path)) { |
56
|
0
|
|
|
|
|
|
$found{$path->relative($dir)->stringify} = $path; |
57
|
|
|
|
|
|
|
} |
58
|
0
|
|
|
|
|
|
return; # continue |
59
|
|
|
|
|
|
|
}, |
60
|
0
|
|
|
|
|
|
{ recurse => 1 }, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
%found; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub package { |
68
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
69
|
0
|
|
|
|
|
|
$self->install->{name}; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub version { |
73
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
74
|
0
|
|
|
|
|
|
$self->version_for($self->package); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub version_for { |
78
|
0
|
|
|
0
|
0
|
|
my($self, $package) = @_; |
79
|
0
|
|
0
|
|
|
|
version::->parse( $self->provides->{$package}{version} || '0' ); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub distname { |
83
|
0
|
|
|
0
|
0
|
|
$_[0]->path->basename; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub dist_version { |
87
|
0
|
|
|
0
|
0
|
|
$_[0]->install->{version}; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub blib { |
91
|
0
|
|
|
0
|
0
|
|
$_[0]->path->child("blib"); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub paths { |
95
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
96
|
0
|
|
|
|
|
|
($self->blib->child("script"), $self->blib->child("bin")); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub libs { |
100
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
101
|
0
|
|
|
|
|
|
($self->blib->child("arch"), $self->blib->child("lib")); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub nonempty_paths { |
105
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
106
|
0
|
|
|
|
|
|
grep $self->_nonempty($_), $self->paths; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub nonempty_libs { |
110
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
111
|
0
|
|
|
|
|
|
grep $self->_nonempty($_), $self->libs; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub sharedir_libs { |
115
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
116
|
0
|
|
|
|
|
|
grep $_->child('auto/share')->exists, $self->libs; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub meta { |
120
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
121
|
0
|
|
|
|
|
|
CPAN::Meta->load_file($self->path->child("MYMETA.json")); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub requirements { |
125
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
126
|
0
|
|
|
|
|
|
$self->requirements_for([qw( configure build runtime )], ['requires']); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub requirements_for { |
130
|
0
|
|
|
0
|
0
|
|
my($self, $phases, $types) = @_; |
131
|
0
|
|
|
|
|
|
$self->meta->effective_prereqs->merged_requirements($phases, $types); |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub _nonempty { |
135
|
0
|
|
|
0
|
|
|
my($self, $path) = @_; |
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
my $bool; |
138
|
|
|
|
|
|
|
$path->visit( |
139
|
|
|
|
|
|
|
sub { |
140
|
0
|
|
|
0
|
|
|
my($path, $state) = @_; |
141
|
0
|
0
|
0
|
|
|
|
if ($path->is_file && $path !~ /\.exists$/) { |
142
|
0
|
|
|
|
|
|
$bool = 1; |
143
|
0
|
|
|
|
|
|
return \0; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
}, |
146
|
0
|
|
|
|
|
|
{ recurse => 1 }, |
147
|
|
|
|
|
|
|
); |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
return $bool; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
1; |