line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Build::Database::Helpers; |
2
|
6
|
|
|
6
|
|
22
|
use strict; |
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
179
|
|
3
|
6
|
|
|
6
|
|
18
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
206
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.56'; |
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
2751
|
use File::Which qw( which ); |
|
6
|
|
|
|
|
4647
|
|
|
6
|
|
|
|
|
313
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
|
|
42
|
use Sub::Exporter -setup => { |
9
|
|
|
|
|
|
|
exports => [ |
10
|
|
|
|
|
|
|
qw/do_system verify_bin info debug/ |
11
|
|
|
|
|
|
|
] |
12
|
6
|
|
|
6
|
|
2725
|
}; |
|
6
|
|
|
|
|
41850
|
|
13
|
|
|
|
|
|
|
|
14
|
0
|
0
|
|
0
|
0
|
0
|
sub info($) { print STDERR shift(). "\n" unless $ENV{MBD_QUIET}; } |
15
|
0
|
0
|
|
0
|
0
|
0
|
sub debug($) { print STDERR shift(). "\n" if $ENV{MBD_DEBUG}; } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub do_system { |
18
|
0
|
0
|
|
0
|
0
|
0
|
my $silent = ($_[0] eq '_silent' ? shift : 0); |
19
|
0
|
|
|
|
|
0
|
my $cmd = $_[0]; |
20
|
0
|
0
|
0
|
|
|
0
|
if ($ENV{MBD_FAKE} || $ENV{MBD_DEBUG}) { |
21
|
0
|
|
|
|
|
0
|
info "fake: system call : @_"; |
22
|
0
|
0
|
|
|
|
0
|
return if $ENV{MBD_FAKE}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
# Carp::cluck("doing------- @_\n"); |
25
|
|
|
|
|
|
|
system("@_") == 0 |
26
|
0
|
0
|
|
|
|
0
|
or do { |
27
|
0
|
0
|
0
|
|
|
0
|
return 0 if $silent && !$ENV{HARNESS_ACTIVE}; |
28
|
0
|
|
0
|
|
|
0
|
warn "# Error with '@_' : $? " . ( ${^CHILD_ERROR_NATIVE} || '' ) . "\n"; |
29
|
0
|
|
|
|
|
0
|
return 0; |
30
|
|
|
|
|
|
|
}; |
31
|
0
|
|
|
|
|
0
|
return 1; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub verify_bin { |
35
|
6
|
|
|
6
|
0
|
11
|
my $bin = shift; |
36
|
6
|
|
|
|
|
9
|
my $try = shift; |
37
|
6
|
|
|
|
|
24
|
for my $label (keys %$bin) { |
38
|
34
|
100
|
|
|
|
88
|
my @look_for = (ref $bin->{$label} eq 'ARRAY' ? @{ $bin->{$label} } : $bin->{$label}); |
|
4
|
|
|
|
|
9
|
|
39
|
34
|
|
|
|
|
28
|
my $found; |
40
|
34
|
|
|
|
|
36
|
for my $potential_cmd (@look_for) { |
41
|
38
|
50
|
33
|
|
|
499
|
if(defined $try && -x "$try/$potential_cmd") { |
42
|
0
|
|
|
|
|
0
|
$found = "$try/$potential_cmd"; |
43
|
0
|
|
|
|
|
0
|
last; |
44
|
|
|
|
|
|
|
} |
45
|
38
|
50
|
|
|
|
76
|
last if $found = which $potential_cmd; |
46
|
|
|
|
|
|
|
} |
47
|
34
|
50
|
|
|
|
3204
|
unless ($found) { |
48
|
34
|
100
|
|
|
|
1067
|
warn "could not find ".(join " or ",@look_for)." in current path\n" unless $label =~ /doc/; |
49
|
34
|
|
|
|
|
59
|
$found = "/bin/false"; |
50
|
|
|
|
|
|
|
} |
51
|
34
|
|
|
|
|
42
|
chomp $found; |
52
|
34
|
50
|
33
|
|
|
129
|
$found = Win32::GetShortPathName($found) if $^O eq 'MSWin32' && $found =~ /\s/; |
53
|
34
|
|
|
|
|
86
|
$bin->{$label} = $found; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|