line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::cpackage; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
28306
|
use 5.010; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
49
|
|
6
|
1
|
|
|
1
|
|
978
|
use App::cpanminus 1.5002; # Dependency check |
|
1
|
|
|
|
|
33
|
|
|
1
|
|
|
|
|
96
|
|
7
|
1
|
|
|
1
|
|
951
|
use Capture::Tiny qw/capture/; |
|
1
|
|
|
|
|
47996
|
|
|
1
|
|
|
|
|
102
|
|
8
|
1
|
|
|
1
|
|
9
|
use Config; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
9
|
1
|
|
|
1
|
|
1104
|
use File::Copy; |
|
1
|
|
|
|
|
2970
|
|
|
1
|
|
|
|
|
69
|
|
10
|
1
|
|
|
1
|
|
936
|
use File::Spec::Functions qw/catfile curdir/; |
|
1
|
|
|
|
|
920
|
|
|
1
|
|
|
|
|
405
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '1.01'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub run { |
15
|
0
|
0
|
|
0
|
0
|
|
die "Usage: $0 cpanm_options module_name\n" unless @ARGV; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $module_name = pop @ARGV; |
18
|
0
|
|
|
|
|
|
my @cpanm_options = @ARGV; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#--Make our own copy of the 'cpanm' executable------------------------------ |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $cpanm = catfile($Config{bin},'cpanm'); |
23
|
0
|
0
|
|
|
|
|
die "Cannot find cpanm (looking in $Config{bin})" unless -e -r $cpanm; |
24
|
0
|
0
|
|
|
|
|
die "Cannot write to current directory" unless -w curdir; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
mkdir 'bin'; |
27
|
0
|
|
|
|
|
|
copy $cpanm => catfile(curdir, 'bin', 'cpanm'); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#--Use cpanm to get dependency list----------------------------------------- |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
mkdir 'extlib'; |
33
|
0
|
|
|
|
|
|
mkdir 'packages'; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
say "Analysing dependencies for $module_name"; |
36
|
|
|
|
|
|
|
my ($dist_list, $log) = capture { |
37
|
0
|
|
|
0
|
|
|
system($^X, 'bin/cpanm', @cpanm_options, '--format', 'dists', '--save-dists', 'packages', '-L', 'extlib', '--scandeps', $module_name); |
38
|
0
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
|
40
|
0
|
0
|
|
|
|
|
die "Couldn't extract depedencies:\n\n$log\n" unless $dist_list; |
41
|
0
|
|
|
|
|
|
rmdir 'extlib'; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
#--Write installer script--------------------------------------------------- |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $installer = 'install.pl'; |
47
|
0
|
|
|
|
|
|
open my $fh, '>', $installer; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
print $fh <<'EOT'; |
50
|
|
|
|
|
|
|
#! /usr/bin/env perl |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
use strict; |
53
|
|
|
|
|
|
|
use warnings; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my @cpanm_options = @ARGV; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
while () { |
58
|
|
|
|
|
|
|
chomp; |
59
|
|
|
|
|
|
|
if (my ($author) = split '/') { |
60
|
|
|
|
|
|
|
my $a = substr($author,0,1); |
61
|
|
|
|
|
|
|
my $ab = substr($author,0,2); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
system($^X, 'bin/cpanm', @cpanm_options, "packages/authors/id/$a/$ab/$_"); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
__DATA__ |