line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Build::Database::Helpers; |
2
|
6
|
|
|
6
|
|
18
|
use strict; |
|
6
|
|
|
|
|
5
|
|
|
6
|
|
|
|
|
178
|
|
3
|
6
|
|
|
6
|
|
21
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
213
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.57'; |
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
2711
|
use File::Which qw( which ); |
|
6
|
|
|
|
|
4649
|
|
|
6
|
|
|
|
|
322
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
|
|
43
|
use Sub::Exporter -setup => { |
9
|
|
|
|
|
|
|
exports => [ |
10
|
|
|
|
|
|
|
qw/do_system verify_bin info debug/ |
11
|
|
|
|
|
|
|
] |
12
|
6
|
|
|
6
|
|
2748
|
}; |
|
6
|
|
|
|
|
41340
|
|
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
|
|
|
|
|
10
|
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
|
|
|
|
|
14
|
|
39
|
34
|
|
|
|
|
24
|
my $found; |
40
|
34
|
|
|
|
|
37
|
for my $potential_cmd (@look_for) { |
41
|
38
|
50
|
33
|
|
|
449
|
if(defined $try && -x "$try/$potential_cmd") { |
42
|
0
|
|
|
|
|
0
|
$found = "$try/$potential_cmd"; |
43
|
0
|
|
|
|
|
0
|
last; |
44
|
|
|
|
|
|
|
} |
45
|
38
|
50
|
|
|
|
77
|
last if $found = which $potential_cmd; |
46
|
|
|
|
|
|
|
} |
47
|
34
|
50
|
|
|
|
3062
|
unless ($found) { |
48
|
34
|
100
|
|
|
|
1236
|
warn "could not find ".(join " or ",@look_for)." in current path\n" unless $label =~ /doc/; |
49
|
34
|
|
|
|
|
65
|
$found = "/bin/false"; |
50
|
|
|
|
|
|
|
} |
51
|
34
|
|
|
|
|
43
|
chomp $found; |
52
|
34
|
50
|
33
|
|
|
97
|
$found = Win32::GetShortPathName($found) if $^O eq 'MSWin32' && $found =~ /\s/; |
53
|
34
|
|
|
|
|
240
|
$bin->{$label} = $found; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|