line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::BundleDeps; |
2
|
1
|
|
|
1
|
|
825
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
3
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
1063
|
use local::lib (); |
|
1
|
|
|
|
|
5765
|
|
|
1
|
|
|
|
|
24
|
|
5
|
1
|
|
|
1
|
|
7
|
use Cwd (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
14
|
|
6
|
1
|
|
|
1
|
|
99023
|
use ExtUtils::MakeMaker; |
|
1
|
|
|
|
|
244823
|
|
|
1
|
|
|
|
|
163
|
|
7
|
1
|
|
|
1
|
|
9
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
758
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.00006'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
0
|
|
|
0
|
0
|
|
my ($class, @args) = @_; |
13
|
0
|
|
|
|
|
|
return bless { |
14
|
|
|
|
|
|
|
extlib => File::Spec->catdir(File::Spec->curdir, 'extlib'), |
15
|
|
|
|
|
|
|
notest => 1, |
16
|
|
|
|
|
|
|
@args |
17
|
|
|
|
|
|
|
}, $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# XXX - accessors inlined for minimal setup |
21
|
|
|
|
|
|
|
sub extlib { |
22
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
23
|
0
|
0
|
|
|
|
|
$self->{extlib} = shift if @_; |
24
|
0
|
|
|
|
|
|
return $self->{extlib}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub notest { |
28
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
29
|
0
|
0
|
|
|
|
|
$self->{notest} = shift if @_; |
30
|
0
|
|
|
|
|
|
return $self->{notest}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub deps { |
34
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
35
|
0
|
0
|
|
|
|
|
$self->{deps} = shift if @_; |
36
|
0
|
|
|
|
|
|
return $self->{deps}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# given a META.yml file (if no arguments, looks for a META.yml in the current |
40
|
|
|
|
|
|
|
# directory), does the proper dep bundling |
41
|
|
|
|
|
|
|
sub bundle_from_meta { |
42
|
0
|
|
|
0
|
0
|
|
my ($self, $file) = @_; |
43
|
0
|
|
0
|
|
|
|
$file ||= 'META.yml'; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
require YAML; |
46
|
0
|
|
|
|
|
|
require YAML::Dumper; # yeah, really, wtf |
47
|
0
|
|
|
|
|
|
my $meta = eval { |
48
|
0
|
|
|
|
|
|
YAML::LoadFile($file) |
49
|
|
|
|
|
|
|
}; |
50
|
0
|
0
|
0
|
|
|
|
if (! $meta || $@) { |
51
|
0
|
|
0
|
|
|
|
$@ ||= 'Unknown reason'; |
52
|
0
|
|
|
|
|
|
die "Failed to load file $file: $@." |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
0
|
|
|
|
my $requires = $meta->{requires} || {}; |
56
|
0
|
|
0
|
|
|
|
my $build_requires = $meta->{build_requires} || {}; |
57
|
0
|
|
|
|
|
|
my %deps = (%{ $requires }, %{ $build_requires }); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$self->setup_deps(keys %deps); |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
$self->bundle(); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub bundle_modules { |
64
|
0
|
|
|
0
|
0
|
|
my($self, @modules) = @_; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$self->setup_deps(@modules); |
67
|
0
|
|
|
|
|
|
$self->bundle(); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub setup_deps { |
71
|
0
|
|
|
0
|
0
|
|
my ($self, @deps) = @_; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
@deps = grep { $_ ne 'perl' } sort @deps; |
|
0
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
$self->deps(\@deps); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub bundle { |
78
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
79
|
0
|
|
|
|
|
|
$self->bundle_deps(); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub bundle_deps { |
83
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
$ENV{PERL5LIB} = ''; # detach existent local::lib |
86
|
0
|
|
|
|
|
|
local::lib->setup_local_lib_for( Cwd::abs_path( $self->extlib ) ); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# wtf: ExtUtils::MakeMaker shipped with Leopard is old |
89
|
0
|
0
|
|
|
|
|
if ($ExtUtils::MakeMaker::VERSION < 6.31) { |
90
|
0
|
|
|
|
|
|
$ENV{PERL_MM_OPT} =~ s/INSTALL_BASE=(.*)/$& INSTALLBASE=$1/; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# no man pages TODO: do the same with Module::Build |
94
|
0
|
|
|
|
|
|
$ENV{PERL_MM_OPT} .= " INSTALLMAN1DIR=none INSTALLMAN3DIR=none"; |
95
|
0
|
|
|
|
|
|
$ENV{PERL_MM_USE_DEFAULT} = 1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# Remove /opt from PATH: end users won't have ports |
98
|
0
|
|
|
|
|
|
$ENV{PATH} = join ":", grep !/^\/opt/, split /:/, $ENV{PATH}; |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
my @cmd = ('cpanm', '--skip-installed'); |
101
|
0
|
0
|
|
|
|
|
if ($self->notest) { |
102
|
0
|
|
|
|
|
|
push @cmd, '--notest'; |
103
|
|
|
|
|
|
|
} |
104
|
0
|
|
|
|
|
|
push @cmd, @{ $self->deps }; |
|
0
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
system(@cmd); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
__END__ |